Click here to Skip to main content
15,913,709 members
Home / Discussions / COM
   

COM

 
GeneralRe: table selection. Pin
Member 52815529-Aug-04 20:52
Member 52815529-Aug-04 20:52 
GeneralDifferences COM/ActiveX/Automation Pin
User 21559727-Aug-04 3:51
User 21559727-Aug-04 3:51 
GeneralRe: Differences COM/ActiveX/Automation Pin
Lim Bio Liong27-Aug-04 8:03
Lim Bio Liong27-Aug-04 8:03 
GeneralRe: Differences COM/ActiveX/Automation Pin
User 21559729-Aug-04 19:07
User 21559729-Aug-04 19:07 
GeneralRe: Differences COM/ActiveX/Automation Pin
Jörgen Sigvardsson27-Aug-04 14:13
Jörgen Sigvardsson27-Aug-04 14:13 
GeneralRe: Differences COM/ActiveX/Automation Pin
User 21559729-Aug-04 19:12
User 21559729-Aug-04 19:12 
GeneralMS Word Automation from consol App Pin
Dean Warren27-Aug-04 0:44
Dean Warren27-Aug-04 0:44 
GeneralMS Word Automation: Attempted the same thing with Visual C++ .NET Pin
ursus zeta28-Aug-04 11:24
ursus zeta28-Aug-04 11:24 
A couple of weeks ago I was attempting to do something similar, except that I was using Visual C++ .NET and had imported the Word type library with TlbImp.exe. TlbImp.exe converts the Type Library into a metadata assembly (basically it's C syntax with attributes), and any .NET compiler can access it; all you have to do is reference the DLL and the namespace in your code. It's considerably easier than what you're doing here.
However, I did make a lot or errors with the Word Type Library (I used verion 10.0) objects and methods because I was reading the help file which was written for Visual Basic programmers. As I recall, before opening a document, you had to call the function which returns a Documents Collection object (this is the Get Documents Collection code block from the code you are using); this is implemented by the IApplication interface, or the Application CoClass,...in other words, you must instantiate the Application object before anything else. Then call Documents::Open (this returns a Document object if it is successful). I had created a blank document with calls to the Windows API CreateDirectory and CreateFile (you can accomplish the same thing by opening Word beforehand and creating a new document the way the article you are working from suggests). If you call Documents::Add, you are actually creating a NEW document. And, when you create a NEW document in Word, it's actually a Microsoft Office object, and this object is created from a separate DLL, the Office Type Library (in the Interop assembly that I used it's a enumeration in Office.dll). Anyway, after trying several approaches, I discovered that it is easier and more straightforward to call Documnents::Open and pass the string for a document that has already been created. But, you must obtain the Documents Collection object first, or the call to Documents::Open will fail, and you won't know why unless you look up the HRESULT.
Read through the help file for the Word Object hierarchy; it's in a directory called, 1033, or something, in the Microsoft Office directory. The code examples won't be helpful, but, it will give you an idea what methods to invoke from which objects.
When you do get it to work, there are methods for creating tables in the type library, you must extend the range to accomodate the table structure. As I recall you can call methods like Range::InsertAfter and Range::InsertBefore, but they take string objects as method parameters (they are just for text editing). Also, it would be easier to create the table as a JPEG document and use the Range::InsertPicture method. You really must be able to examine the entire type library to make appropriate choices with your code implementation.
I'm curious, and I'd like to attempt the same thing in unmanaged code, how do you read the type library to understand how the COM objects and interfaces are implemented? In Visual C++ .NET, the IL Disassembler will display the entire type library (as an Interop Assembly), which makes it much easier to decide which methods to call, and what parameters and their types are necessary to make the calls successful. Then, (and this part is like cheating), you use Intellisense to invoke the correct methods in sequence. Also, exceptions are easier to deal with than HRESULTS.
GeneralAfterword Pin
ursus zeta29-Aug-04 10:04
ursus zeta29-Aug-04 10:04 
Generaldemodulation Pin
maxuk26-Aug-04 16:08
maxuk26-Aug-04 16:08 
GeneralRe: demodulation Pin
darkbyte28-Aug-04 5:22
darkbyte28-Aug-04 5:22 
GeneralRe: demodulation Pin
maxuk29-Aug-04 3:31
maxuk29-Aug-04 3:31 
GeneralRe: demodulation Pin
Jörgen Sigvardsson28-Aug-04 11:41
Jörgen Sigvardsson28-Aug-04 11:41 
GeneralMS-WORD Addin Pin
deepha8226-Aug-04 5:16
deepha8226-Aug-04 5:16 
GeneralInterface inheritance Pin
Anonymous25-Aug-04 23:42
Anonymous25-Aug-04 23:42 
Questioncan i disable the IE File->new menu in a Activex Control(based on MFC) Pin
max_xiayi25-Aug-04 17:53
max_xiayi25-Aug-04 17:53 
Generalplz give me some sites for mshtml interfaces Pin
Member 52815524-Aug-04 20:51
Member 52815524-Aug-04 20:51 
Generalimplement pre element Pin
Member 52815524-Aug-04 19:40
Member 52815524-Aug-04 19:40 
GeneralThe server did not register with DCOM within the required timeout. Pin
sergeyv200220-Aug-04 10:16
sergeyv200220-Aug-04 10:16 
GeneralRe: The server did not register with DCOM within the required timeout. Pin
Milton Karimbekallil22-Aug-04 20:07
Milton Karimbekallil22-Aug-04 20:07 
GeneralRe: The server did not register with DCOM within the required timeout. Pin
sergeyv200223-Aug-04 3:21
sergeyv200223-Aug-04 3:21 
GeneralRe: The server did not register with DCOM within the required timeout. Pin
Milton Karimbekallil23-Aug-04 18:34
Milton Karimbekallil23-Aug-04 18:34 
GeneralGet class name from interface Pin
Anonymous19-Aug-04 9:31
Anonymous19-Aug-04 9:31 
GeneralRe: Get class name from interface Pin
Jörgen Sigvardsson19-Aug-04 14:14
Jörgen Sigvardsson19-Aug-04 14:14 
GeneralRe: Get class name from interface Pin
Anonymous19-Aug-04 17:44
Anonymous19-Aug-04 17:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.