Page 9 of 39

Posted: Wed Sep 10, 2008 8:10 am
by Sveinung
@Glops
Are you using PB 4.20? I got the same error when I tested it on 4.10

Regards
Sveinung

thanks

Posted: Wed Sep 10, 2008 8:29 am
by glops
Thx Sveinung, I checked and was still runing PB 4.2 beta 4...I updated PB to the official 4.2..and now it is ok :D

Posted: Wed Sep 10, 2008 10:01 am
by srod
Kiffi wrote:Hello srod,

i have a curious problem. I want to create a TypeLibInfo-Object
(TlbInf32.dll). The DLL ist registered.

But COMate_CreateObject() returns 0 and
COMate_GetLastErrorDescription() says everything is OK:

Code: Select all

TLITypeLibInfo.COMateObject

TLITypeLibInfo = COMate_CreateObject( "TLI.TypeLibInfo" )

If TLITypeLibInfo = 0
  If COMate_RegisterCOMServer("C:\WINDOWS\system32\TlbInf32.dll") = #S_OK
    blnRegister = #True
    TLITypeLibInfo = COMate_CreateObject( "TLI.TypeLibInfo" )
  EndIf
EndIf

Debug COMate_GetLastErrorDescription() ; -> Okay

Debug TLITypeLibInfo ; -> 0 
In VB6 there is no problem:

Code: Select all

Dim tliTypeLibInfo As TypeLibInfo
Set tliTypeLibInfo = New TypeLibInfo ' works
TIA & Greetings ... Kiffi
Well I downloaded a copy of the dll, registered it okay, but my oleviewer and interface generator programs do not show a program.id of TLI.TypeLibInfo at all!

Does it work with PureDispHelper?

**EDIT : doesn't work here with PureDispHelper. Perhaps this dll does not function correctly on Vista! Let me try XP. ---Nope, same problem. Not sure there's much I can do.

Posted: Wed Sep 10, 2008 10:17 am
by Kiffi
srod wrote:but my oleviewer and interface generator programs do not show a program.id of TLI.TypeLibInfo at all!
vbAccelerator provides an ActiveX Documenter.
With this tool, the members of TlbInf32.dll can be listed.

http://www.vbaccelerator.com/home/VB/Ut ... rticle.asp

... strange!

Greetings ... Kiffi

Posted: Wed Sep 10, 2008 10:23 am
by srod
I've looked inside the dll and the only prog.id listed comes up (vista and xp) as "TLI, TypeLib Information" which is pretty much garbage! I can see all the dispinterfaces however!

Can you e-mail me your copy of the dll?

I'll be away for a few hours now but I'll have a look when I get back.

Posted: Wed Sep 10, 2008 10:32 am
by ts-soft
I can only found a ClassID: {8B217746-717D-11CE-AB5B-D41203C10000}
You can use the OCX_CreateGadget as example of using with ClassID,
without ProgramID. (not tested)

Posted: Wed Sep 10, 2008 1:03 pm
by srod
Right, let me modify COMate to accept a CLSID in string form and then I'll have another crack at the dll! :)

Posted: Wed Sep 10, 2008 1:23 pm
by srod
@Kiffi : there was a bug in COMate causing the HRESULT value to not be reported in this case. I am now getting a CLASS_E_NOAGGREGATION error code which I shall investigate. :)

**EDIT : no luck.

However, looking at that VB code you posted above, you do realise that that code doesn't use automation don't you?
Using a specified type in the line

Code: Select all

Dim tliTypeLibInfo As TypeLibInfo
will cause Visual Basic to use the underlying vtables to access member functions etc. Admittedly the vtables will be extrapolated from the underlying type library.

I don't know if this is pertinent to the problem here?

What you need to do is try :

Code: Select all

Dim tliTypeLibInfo As Object
Set tliTypeLibInfo = CreateObject("TypeLibInfo")

Posted: Wed Sep 10, 2008 2:55 pm
by srod
@Kiffi : found the problem; it is a class factory issue. I have a fix for it, but it will take an hour or so to fully check out. :)

Posted: Wed Sep 10, 2008 4:00 pm
by srod
Update - version 1.1.4. 10th Sept. 2008.
Version 1.1.4 fixes a bug with the COMate_CreateObject() function which would not set the appropriate error fields under certain circumstances.

Problems interfacing with Microsoft's "TypeInfoLib" library also necessitated the following change:
  • ProgID's can now contain CLSIDs (class identifiers) in string form. These must be placed in braces; e.g. {8B217746-717D-11CE-AB5B-D41203C10000}. These are for those objects not exposing a 'friendly name' (of which the damn TypeInfoLib appears to be one such!)
See the nxSoftware site for the download.

==============================

@Kiffi : As I indicated above, the problems with the TypeInfoLib stemed from the classfactory which was refusing to return the requested interface. Couple this with the fact that the TypeInfoLib doesn't seem to export a friendly-name (progID) and I begin to see why VB uses the Vtables to get at the underlying methods with this particular component! :)

The changes I have made with COMate 1.1.4 fix these issues and the following code runs fine here with the dll you sent me (Vista) :

Code: Select all

IncludePath "..\"
XIncludeFile "COMate.pbi"

TypeInfoLibCLSID$ = "{8B217746-717D-11CE-AB5B-D41203C10000}"

TLITypeLibInfo.COMateObject 
TLITypeLibInfo = COMate_createObject(TypeInfoLibCLSID$) 

If TLITypeLibInfo
  TLITypeLibInfo\SetProperty("ContainingFile = 'tlbinf32.dll'")
  Debug TLITypeLibInfo\GetStringProperty("ContainingFile")
  TLITypeLibInfo\Release()
EndIf
I left out the code for registering the server.

The CLSID (which ts-soft identified) can be located easily enough with MS's OleViewer program. :) I hope this helps.

Posted: Wed Sep 10, 2008 6:58 pm
by SFSxOI
How timely this update was. I just happen to have something i'm starting on where this particular update might be needed. Thanks srod! :)

When WMI returns a date it looks something like this ; 20080910144149.000000-300. Then send it thru something to change it into some readable.

There is a method to convert those with WMI to normal people-easy-readable dates and times with WMI scripting here: http://msdn.microsoft.com/en-us/library ... S.85).aspx

I was wondering if this could be added to Comate as a method. A single command like maybe a GetDateTimeProperty(command.s)?

Posted: Thu Sep 11, 2008 10:30 am
by srod
I don't know about that. I'm not really that keen to add more methods to COMate unless they are related to it's 'core business'.

What you can easily do of course is use COMate to create a SWbemDateTime object and then take it from there. It would be straight forward to create a 'helper file' to wrap this object in etc. Not sure I'll be doing it though! :wink:

Posted: Thu Sep 11, 2008 11:13 am
by Kiffi
srod wrote:The CLSID (which ts-soft identified) can be located easily enough with MS's OleViewer program. :)
pffft! I don't need MS's OleViewer program. Now i am able to write my own. :D

Many thanks!!! Image

Greetings ... Kiffi

Posted: Thu Sep 11, 2008 11:15 am
by srod
Ah, I was wondering if that is what you were doing? :) I'd be interested in seeing that.

Posted: Thu Sep 11, 2008 1:01 pm
by srod
Update - version 1.1.5. 11th Sept. 2008.
Version 1.1.5 fixes a bug related to the changes in version 1.1.4. Doh!!! Basically if using a CLSID in string form, COMate would sometimes fail in it's check to see if this represented a registered component or not! Double-doh!!!

See the nxSoftware site for the download.