Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

GetActiveOLEObject

adibicheaadibichea Member Posts: 46
help with this please

[code]
var
_id :IDispatch;
begin
_id := GetActiveOLEObject(TButton.ClassName); //here it's an error
...
[/code]

[red]'Invalid class string'[/red]
how to use this instruction?

Comments

  • pritaeaspritaeas Member Posts: 274
    Hi. A TButton is not a valid OLE Object. See here for an example:

    http://www.informit.com/articles/article.asp?p=130494&seqNum=3

    hth, pritaeas

    : help with this please
    :
    : [code]
    : var
    : _id :IDispatch;
    : begin
    : _id := GetActiveOLEObject(TButton.ClassName); //here it's an error
    : ...
    : [/code]
    :
    : [red]'Invalid class string'[/red]
    : how to use this instruction?
  • adibicheaadibichea Member Posts: 46
    [code]
    ...
    sc1.AddObject('button1',_id,true);
    [/code]

    sc1 is msscriptcontrol from vb and i need to insert 'tbutton'.

  • pritaeaspritaeas Member Posts: 274
    [b][red]This message was edited by Moderator at 2004-5-17 4:23:20[/red][/b][hr]
    TButton is NOT a currently running, registered COM object. So it won't work.

    hth, pritaeas


    The following comes from the OLH:

    --
    GetActiveOLEObject

    Retrieves a reference to an IDispatch interface to a currently running, registered COM object.

    Unit

    ComObj

    Category

    COM utilities

    function GetActiveOleObject(const ClassName: string): IDispatch;

    Description

    GetActiveOleObject returns a reference to the IDispatch interface of the active object for the given class indicated by ClassName. ClassName is the programmatic ID for the class of the active object from the OLE running object table. GetActiveOleObject is used to access the OLE running object table. To add an object to this table, use the RegisterActiveObject API.

    If either the the class object or the IDispatch interface are not successfully returned, an EOleSysError exception is raised.

    : [code]
    : ...
    : sc1.AddObject('button1',_id,true);
    : [/code]
    :
    : sc1 is msscriptcontrol from vb and i need to insert 'tbutton'.



  • adibicheaadibichea Member Posts: 46
    ok! understand ! thank you
Sign In or Register to comment.