Theos PowerBasic Museum 2017

Archive => Discussion - Legacy Software (PBWIN 9.0+/PBCC 5.0+) => Topic started by: Lutfie Ahmad on March 17, 2009, 05:28:51 AM

Title: How to use running object?
Post by: Lutfie Ahmad on March 17, 2009, 05:28:51 AM
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.
Title: Re: How to use running object?
Post by: José Roca on March 17, 2009, 04:37:28 PM
 
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/
Title: Re: How to use running object?
Post by: Edwin Knoppert on March 17, 2009, 11:29:45 PM
Try this website:
http://www.q-software-solutions.de/products/lcc-win32/com-support.shtml
Title: Re: How to use running object?
Post by: Greg Lyon on March 22, 2009, 12:28:13 AM
Maybe this article will help:  COM in Plain C (http://www.codeproject.com/KB/COM/com_in_c1.aspx)


Title: Re: How to use running object?
Post by: Lutfie Ahmad on March 23, 2009, 02:11:54 AM
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 ^_^
Title: Re: How to use running object?
Post by: José Roca on March 23, 2009, 03:00:35 AM
 
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.
Title: Re: How to use running object?
Post by: Lutfie Ahmad on March 23, 2009, 04:27:22 AM
it seems GetActiveObject is answer for my question,
thank you again Mr. Jose Roca ^_^