Announcement

Collapse
No announcement yet.

A question about GUID numbers as seen in this code

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • A question about GUID numbers as seen in this code

    In message #4 of this thread: http://www.powerbasic.com/support/pb...ad.php?t=39228

    Dave Biggs posted the following code (and more). (I added the Bold Underline for emphasis and focus in this message.)

    Code:
    Function FindIEinReg()As String
     Local hKey   As Dword
     Local zData1 As Asciiz * %MAX_PATH
     Local zData2 As Asciiz * %MAX_PATH
     Local sTest, sTest2 As String
                                            'Test Registry entry for IExplore..
     If RegOpenKeyEx(%HKEY_CLASSES_ROOT,"CLSID\{0002DF01-0000-0000-C000-000000000046}\LocalServer32", _
                     ByVal %Null, %KEY_READ, hKey) = %ERROR_SUCCESS  Then
    
       RegQueryValueEx hKey, "", ByVal %Null, ByVal %Null, ByVal VarPtr(zData1), %MAX_PATH
       RegCloseKey hKey
       ExpandEnvironmentStrings ByVal VarPtr(zData1), ByVal VarPtr(zData2), %MAX_PATH
     End If
      Function = zData2
    End Function
    '------------------/FindIEinReg
    My question pertains specifically to the GUID number in the IF:

    How did Dave know that this GUID would get him the IE entries? If I had to create a similar routine, how would I know what GUID would return a specific entry?

  • #2
    Com Browser!

    James

    Comment


    • #3
      {with the eyes rolling and voice of Lou Costello} Hoy, boy! {slaps side of face}

      Seems the more questions I ask, the deeper I get... I'm going to have to take the COM plunge eventually, eh?

      Comment


      • #4
        >I'm going to have to take the COM plunge eventually, eh?

        Do what I am doing. I am USING a library (ADO) to get the feel for the syntax.

        When I get the urge to create a COM component, at least I won't be starting "cold."

        MCM
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          I appreciate the direction, Michael, and I reserve the right to come back and ask you for details on the WHAT and HOW... (like which ADO library, how is it a bridge to COM, etc. (Can't get into it now; am signing off for the night.)

          Comment


          • #6
            Personally depending on your background
            "Take the Neastea Plunge"

            Might be cold at first, but could save you a ton of time wading in the shallow end

            (ok so I spent toooo much time in the shallow end) Thank god for PB

            and yes I am still learning to plunge into COM myself
            Engineer's Motto: If it aint broke take it apart and fix it

            "If at 1st you don't succeed... call it version 1.0"

            "Half of Programming is coding"....."The other 90% is DEBUGGING"

            "Document my code????" .... "WHYYY??? do you think they call it CODE? "

            Comment


            • #7
              How did Dave know that this GUID would get him the IE entries? If I had to create a similar routine, how would I know what GUID would return a specific entry?
              Good question - I've been trying to back track..!

              I'm sure that I started off with the example code from Pierre Bellisle http://www.powerbasic.com/support/pb...64&postcount=6
              That was about finding the path for WordPad from it's registry entry. I probably then searched my own registry HKEY_CLASSES_ROOT for iexplore.exe to find the CLSID.
              However, around that time I was also playing with the WebBrowser.inc file from the PBWin90 samples and the CLSID for internet explorer can be found there in a couple of places too.

              Using Com Browser you'd have to look in the "Microsoft Internet Controls 1.1" Registered Library - filename 'shdocvw.dll' or 'ieframe.dll' - depending what version IE you have installed

              I figured, "OK if this CLSID thingy is a unique id created for a particular application when it's first developed then there would have to be list of existing ids readily available
              for the Microsoft apps somewhere, right"?
              I've done a bit of googling without too much success. The best I've found so far is here http://www.windowsitlibrary.com/Content/368/13/1.html#3
              If Microsoft maintain a public list I have been looking in the wrong places to date..

              Good luck with the COM thing!
              Rgds, Dave

              Comment


              • #8
                > I reserve the right to come back and ask you for details on the WHAT and HOW

                Generic 'ADO' Connection and Query Tester (CC 5+/Win 9+) 11-02-08

                MCM
                Michael Mattias
                Tal Systems (retired)
                Port Washington WI USA
                [email protected]
                http://www.talsystems.com

                Comment


                • #9
                  Originally posted by Dave Biggs View Post
                  Good question - I've been trying to back track..!
                  ...
                  Using Com Browser you'd have to look in the "Microsoft Internet Controls 1.1" Registered Library - filename 'shdocvw.dll' or 'ieframe.dll' - depending what version IE you have installed
                  How'd anyone even know that was there?!? Let alone to search it with the COM browser? It would appear I am missing some basic knowledge. (Wow, was that ever stating the obvious!)

                  I figured, "OK if this CLSID thingy is a unique id created for a particular application when it's first developed...
                  Ah! Here's one of those basic knowledge items! That a CLSID is "created for a particular application when it's first developed"... I didn't have a clue.

                  Then also, Logic would have me conclude that I should be generating a CLSID for each of the apps I develop, too? Didn't know that before. So, after I generate it, what do I need to do with it? Who's expecting to be able to see it, and where should I store it? What will other apps use it for? Is there a protocol to follow?


                  Good luck with the COM thing!
                  I'll start focusing on COM next month. I really can't afford to start learning it now; I have 2 other projects nearing completion. But I'm starting to make a list of the questions I'll need answers to... And thanks, I'll need all the good wishes and support!

                  Comment


                  • #10
                    Originally posted by Michael Mattias View Post
                    > I reserve the right to come back and ask you for details on the WHAT and HOW

                    Generic 'ADO' Connection and Query Tester (CC 5+/Win 9+) 11-02-08

                    MCM
                    I've marked this for follow-up when I start my COM education. Thanks for the reference and the code.

                    I still reserve the right to ask more questions!!

                    Comment


                    • #11
                      FindIEinReg() in the code referenced in Msg#1 above isn't actually using Com services or anything oop like - it's just taking advantage of the info that is stored in the system registry for applications, like Internet Explorer, that support Com Interfaces.

                      How'd anyone even know that was there?!? Let alone to search it with the COM browser?
                      Apart from manually searching the registry or Com Browser, another way to find out details for all registered Com Components is to use RegDllView. It is a free utility that displays a list of registered dll/ocx/exe files and related data including CLSIDs, Program names and filepaths. There are a lot, > 1000 on my PC, but the list is searchable http://www.nirsoft.net

                      Ah! Here's one of those basic knowledge items! That a CLSID is "created for a particular application when it's first developed"... I didn't have a clue..
                      Then also, Logic would have me conclude that I should be generating a CLSID for each of the apps I develop, too?..
                      I guess that would depend upon how 'classy' your apps need to be!!

                      Seriously, I think that you will only need to generate GUID /CLSIDs for your apps when you start to write Com Components.

                      Some notes mostly cut from PB's help files that might help clarify:
                      A COM Component is generally known as a COM SERVER, because it serves up information or actions requested by a COM CLIENT. A COM SERVER is a special form of code library (embedded in a dll/ocx/exe file) that conforms to the COM specification. It provides at least one public interface, and is identified by a globally unique CLSID so that it's Methods and Properties can be made public and a COM CLIENT can call them as needed.

                      It's own CLSID identifier is stored in the Windows Registry for each COM Component when it is installed and registered. (e.g. by calling, regsvr32.exe "MyComServer.dll"). Additional info is stored along with the CLSID - including a key called "LocalServer32", which holds the actual path\filename of the server application.
                      Rgds, Dave

                      Comment

                      Working...
                      X