Announcement

Collapse
No announcement yet.

Dim AS from GUID

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

  • Dim AS from GUID

    I am still trying to wrap my head around what VB hid from me in the past, and not sure if PB can do this, or if I am just totally misunderstanding.

    From the oWord.inc in the samples folder
    Code:
    ' Library Name: Word
    ' Library File: C:\Program Files\Microsoft Office\OFFICE11\MSWORD.OLB
    ' Description : Microsoft Word 11.0 Object Library
    ' Help File : C:\Program Files\Microsoft Office\OFFICE11\VBAWD10.CHM
    ' Help Context : 0
    ' GUID : {00020905-0000-0000-C000-000000000046}
    ' LCID : 0
    ' Version : 8.3
    
    ' Version Dependant ProgID's
    $PROGID_Application11 = "Word.Application.11"
    $PROGID_Document8 = "Word.Document.8"
    
    ' Version Independant ProgID's
    $PROGID_Application = "Word.Application"
    $PROGID_Document = "Word.Document"
    
    ' Class Indentifiers
    $CLSID_Global = GUID$("{000209F0-0000-0000-C000-000000000046}")
    $CLSID_Application = GUID$("{000209FF-0000-0000-C000-000000000046}")
    where what I think I am after is $CLSID_Global and $CLSID_Application and somehow wind up with $PROGID_Application = "Word.Application"

    I don't see how this is happening (cause I think all the code is hardcoded) but lets say I have my own class I am developing, and (I may be phrasing this incorrectly but hopefully you get what I am after) but how would I go from my combination of GUID's to something like $SerialPort_Class = "SerialPort.ClassInterface"

    That way in other languages like VB I could something like
    Code:
    Dim MyPort AS SerialPort
    Set MyPort = CreateObject("SerialPort.ClassInterface")
    can someone show me how to go about this??? I have been working on it for 3 days, and feeling pretty lost and confused.
    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? "

  • #2
    Cliff,

    SET is being deprecated, although it still is supported in 9/5.

    So, first declare variable(s) as an interface(s) of the class you are going to use for your object.

    Then instantiate the object by using one of the forms shown on the:
    LET statement (with Objects) help page.

    Suggestion: Read slowly, lot's there to digest

    Please note the use of the keyword "LET" is ptional

    If your CLASS code will reside in a registered external COM server DLL or EXE, e.g. the MS Word Sample, then the app using it could use code like this psuedo-code:

    Code:
    Dim MyPort AS Int_SerialPort
    ...
    MyPort = NEWCOM $ProgramID_MySerialPortApp
    ...
    However if your code is all in one app, i.e. the CLASS is defined there as well as the code using it, the following psuedo-code is used.

    Code:
    Dim MyPort AS Int_SerialPort
    ...
    MyPort = CLASS "MySerialPortClassName"
    It is only when you you are dealing with a external COM server that has no $ProgID that you get into LET forms that use a $ClassID. These are aptly explained on the referenced help page. You can aslo see this illustrated by looking at the post entitled "A NON COM All - In - One CLASS demo" here http://www.powerbasic.com/support/pb...ad.php?t=38286
    The first post in that thread shows how to construct a published COM server DLL and then use it with an app.
    Last edited by Richard Angell; 12 Sep 2008, 09:13 AM. Reason: added reference and improved
    Rick Angell

    Comment

    Working...
    X