• Welcome to Theos PowerBasic Museum 2017.

How to use running object?

Started by Lutfie Ahmad, March 17, 2009, 05:28:51 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Lutfie Ahmad

Hi,
I know its possible in PB which have native COM support,
but how to use this in plain C?
example, I have running msword, and I want to use it opened document in my application.
say its an dictionary application.

José Roca

 
I have no idea of C programming. This Microsoft article should be help you to get started:

HOWTO: Use OLE Automation from a C Application Rather Than C++
http://support.microsoft.com/kb/181473/


Greg Lyon


Lutfie Ahmad

thank you all,
quick look at the links,
I think its all about createinstance within our application,
I mean, in my case, its all about we open the msword and use it, not use already opened msword.

@Jose Roca, @Edwin Knoppert
I dont mean to use C, you can use old PB, before it has native COM support ^_^.
I say it plain C, to explain that it has no active COM support.
as a matter a fact I know little about C ^_^

@Greg Lyon
its a must read COM article, for those who want to make COM server ^_^

José Roca

#5
 
If what you want to do is to use an existing instance of an object instead of creating a new one, then call the GetActiveObject API function:

http://msdn.microsoft.com/en-us/library/ms221467.aspx

That only works with running objects that have been registered with OLE calling RegisterActiveObject. Office applications do it.

Lutfie Ahmad

it seems GetActiveObject is answer for my question,
thank you again Mr. Jose Roca ^_^