How to execute tollbarfunction in Drawing control by code in VB6

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Jon-Olav Hermansen (jonoh_Takeaway__at_gmx.net)
Date: 03/10/04


Date: Wed, 10 Mar 2004 09:04:34 +0100

Hello,

I am trying to execute the "connector tool" toolbar button from code in VB6.
I am using the OleLib.tlb and OleLib2.tlb

I have used the C# code in this post as a reference:

http://groups.google.com/groups?selm=Oagzv1mrDHA.2416%40TK2MSFTNGP10.phx.gbl&oe=UTF-8&output=gplain

My code is as follows:

Public Sub DoClick()
    Dim ret As Variant
    Dim t As Variant
    Dim tmpGUID As olelib.UUID
    Dim tmpTarget As IOleCommandTarget

    tmpGUID.Data1 = &H21A20
    tmpGUID.Data2 = &H0
    tmpGUID.Data3 = &H0
    tmpGUID.Data4(0) = &HC0
    tmpGUID.Data4(1) = &H0
    tmpGUID.Data4(2) = &H0
    tmpGUID.Data4(3) = &H0
    tmpGUID.Data4(4) = &H0
    tmpGUID.Data4(5) = &H0
    tmpGUID.Data4(6) = &H0
    tmpGUID.Data4(7) = &H46

    Set tmpTarget = dcobj.object
    tmpTarget.Exec tmpGUID, visCmdDRConnectorTool
End Sub

When I execute this sub, I get a "Invalid procedure call or argument" error
message.

Does anyone have an idea of what I am doing wrong?
Is this possible from VB6?

Jon-Olav


Quantcast