D - DOM questions
- Robert M. Münch (46/46) Jan 13 2003 Hi, be aware the following might be silly stuff but anway I have my prob...
- Robert M. Münch (1/1) Jan 13 2003 Of course the subject should have been COM questions... Robert
Hi, be aware the following might be silly stuff but anway I have my problems
with it:
I try to create a DLL that has one simple function start_word() that should
create a MS Word instance with a new document.
I have written the DLL and it can be used from my scripting language. The
problem I have is with the COM part. The code looks like this so far:
export extern (Windows) void start_word() {
CLSID word_clsid;
// Retrieve CLSID from the ProgID for Word.
HRESULT hr = CLSIDFromProgID("Word.Application", &word_clsid);
if(FAILED(hr)) {
MessageBoxA(null,"Faialed to get Word CLSID","Rebol DLL Error", MB_OK);
return;
}
// Let's create a Word instance
IUnknown word;
hr=CoCreateInstance(&word_clsid, null, CLSCTX_ALL, &IID_IUnknown, &word);
if (FAILED(hr)) {
MessageBoxA(null,"Failed to create Word Object","Rebol DLL Error", MB_OK);
return;
}
// free ressource
word.Release();
return;
}
So this is all nice and working. But now the questions arise:
1. Of course I would like to use the <IUnknown word> thing to get access to
on other interface provided by word. But what interfaces are provided? I
need a GUID for the interface. Where to get it from? I think things like
typelibraries would be my friends here. How to use these with D?
2. To get an interface I further need the interface in D. So something like
this:
interface Word : IUnknown {
extern (Windows):
open(....)
}
Where the open member must match the COM implemented memember. Do I have to
build these all myself? Is there a way to get those definitions?
I looked around about all this COM stuff but only found MFC, VB etc.
infected examples that don't show just the bare facts.
--
Robert M. Münch
IT & Management Freelancer
Mobile: +49 (0)177 2452 802
Fax : +49 (0)721 8408 9112
Web : http://www.robertmuench.de
Jan 13 2003
Of course the subject should have been COM questions... Robert
Jan 13 2003








"Robert M. Münch" <robert.muench robertmuench.de>