• Welcome to Theos PowerBasic Museum 2017.

PB COM Browser

Started by Dave Paton, September 24, 2008, 06:51:32 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dave Paton

I'm getting some funny behavior with PB COM Browser working inside FireFly or PB. When I generate the include file via COM Browser in PB, I get these GUID's...

$CLSID_CommonDialog = GUID$("{F9043C85-F6F2-101A-A3C9-08002B2F49FB}")
$CLSID_Event_ICommonDialogEvents = GUID$("{2AF6DB78-DE78-41DD-980D-E15F88D089AC}") = GUID$("{5B6DC0C4-0EC2-4ED2-B7AA-D205DE892ED4}")

' Interface Indentifiers
$IID_ICommonDialog = GUID$("{083039C2-13F4-11D1-8B7E-0000F8754DA1}")
$IID_ICommonDialogEvents = GUID$("{F9043C87-F6F2-101A-A3C9-08002B2F49FB}")

The include file compiles no problem. But when I generate the same include file via COM Browser from within FireFly, I get the following GUID's....

$CLSID_CommonDialog = GUID$("{F9043C85-F6F2-101A-A3C9-08002B2F49FB}")
$CLSID_Event_ICommonDialogEvents = GUID$("{8EE8D036-3E1D-4A4A-99C4-93C29AB1621A}") = GUID$("{D2A54C89-A4C3-44C1-B810-2790F0BA6EBA}")

' Interface Indentifiers
$IID_ICommonDialog = GUID$("{083039C2-13F4-11D1-8B7E-0000F8754DA1}")
$IID_ICommonDialogEvents = GUID$("{F9043C87-F6F2-101A-A3C9-08002B2F49FB}")

All the GUID's are the same except for $CLSID_Event_ICommonDialogEvents, which are different according to whether the include file was generated within PB or within FF. That particular statement gives a compiler error when run from within FF but it compiles OK when run from within PB. I tried copying the line from the PB file to the FF file but no luck, I still get a compiler error from within FF. I also tried copying the line from the FF file to the PB file and that line will also compile OK from within PB. So the actual GUID's even though they are different, appear to be OK within a PB environment but not within a FF environment. Now I was led to believe that GUID stands for a globally unique ID, but here is a case of a MS control with two different GUID's for events, both of which will compile under PB and neither of which will compile under FireFly. I am confused and I hope someone can help me.

José Roca

#1
 
I have been able to replicate the problem of constants with two guids by unchecking the option "Prefix GUIDs/ProgIDs with Library Name", so it is clearly a bug of the browser. If you check it, only one guid is listed.

$CLSID_MSComDlg_Event_ICommonDialogEvents = GUID$("{03E4687E-E07B-4410-A45E-093B2D11C980}") is not a guid present in the type library of comdlg32.ocx, but an auto generated guid for the events class, that the PB COM browser adds to the include file (my browser generates event classes separately). For example:


$CLSID_MSComDlg_Event_ICommonDialogEvents = GUID$("{03E4687E-E07B-4410-A45E-093B2D11C980}")

' Interface Name  : ICommonDialogEvents
' ClassID         : $CLSID_MSComDlg_Event_ICommonDialogEvents
' ProgID          : $PROGID_MSComDlg_CommonDialog
' Version ProgID  : $PROGID_MSComDlg_CommonDialog1
Class Class_ICommonDialogEvents $CLSID_MSComDlg_Event_ICommonDialogEvents As Event
    Interface ICommonDialogEvents $IID_MSComDlg_ICommonDialogEvents
        Inherit IDispatch

    End Interface
End Class


This guid will be different each time you generate a new include file.

So just remove one of the two  = GUID$( [...].

You can also use my browser: http://www.jose.it-berater.org/index.html

Or MSComDlg.inc: http://www.jose.it-berater.org/smfforum/index.php?topic=2273.0

Or in this particular case you can remove both the constant with duplicate guids and the class, because it has no event methods.

Dave Paton

OK, thanks. GUID's are completely new to me since VB6 protected me from such complexities. I'll be talking to you more about COM objects as I've heard that you are the Sultan of COM in PB.