Click here to Skip to main content
15,915,160 members
Home / Discussions / COM
   

COM

 
AnswerRe: How to do the CoCreateInstance Pin
Stuart Dootson26-Aug-09 22:13
professionalStuart Dootson26-Aug-09 22:13 
There will be a structure in the code generated by the #import statement that represents the class. You can do __uuidof(that struct) to get its CLSID. Look at the example I have here using Excel:

#import "libid:00020813-0000-0000-C000-000000000046" version("1.6") auto_search no_dual_interfaces rename("DialogBox", "excelDialogBox") rename("RGB", "excelRGB") rename("DocumentProperties", "excelDocumentProperties") rename("SearchPath", "excelSearchPath") rename("CopyFile", "excelCopyFile") rename("ReplaceText", "excelReplaceText")

int _tmain(int argc, _TCHAR* argv[])
{
   CoInitializeEx(0, COINIT_MULTITHREADED);
   {
      Excel::_ApplicationPtr xl;
      if (SUCCEEDED(xl.CreateInstance(__uuidof(Excel::Application)))) // This is where we get the CLSID.
      {
         // Do stuff with the application pointer
      }
   }
}


HTH!

Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

GeneralRe: How to do the CoCreateInstance Pin
deadlyabbas26-Aug-09 22:52
deadlyabbas26-Aug-09 22:52 
GeneralRe: How to do the CoCreateInstance Pin
Stuart Dootson26-Aug-09 23:07
professionalStuart Dootson26-Aug-09 23:07 
GeneralRe: How to do the CoCreateInstance Pin
deadlyabbas27-Aug-09 1:36
deadlyabbas27-Aug-09 1:36 
GeneralRe: How to do the CoCreateInstance Pin
Stuart Dootson27-Aug-09 1:58
professionalStuart Dootson27-Aug-09 1:58 
QuestionHow to get the CLSID of a COM DLL Pin
deadlyabbas26-Aug-09 21:04
deadlyabbas26-Aug-09 21:04 
AnswerRe: How to get the CLSID of a COM DLL Pin
Stuart Dootson26-Aug-09 22:10
professionalStuart Dootson26-Aug-09 22:10 
Questiondebug with /embedding setting does not work on vista Pin
Fwzklmn26-Aug-09 8:15
Fwzklmn26-Aug-09 8:15 
Questionvista security and out-of-proc COM servers Pin
WayneS21-Aug-09 4:18
WayneS21-Aug-09 4:18 
QuestionInvokeHelper Pin
MsmVc21-Aug-09 0:37
MsmVc21-Aug-09 0:37 
AnswerRe: InvokeHelper Pin
Vi221-Aug-09 1:07
Vi221-Aug-09 1:07 
GeneralRe: InvokeHelper Pin
MsmVc21-Aug-09 1:18
MsmVc21-Aug-09 1:18 
GeneralRe: InvokeHelper Pin
Vi221-Aug-09 1:30
Vi221-Aug-09 1:30 
GeneralRe: InvokeHelper Pin
MsmVc21-Aug-09 1:41
MsmVc21-Aug-09 1:41 
GeneralRe: InvokeHelper Pin
Vi221-Aug-09 1:44
Vi221-Aug-09 1:44 
GeneralRe: InvokeHelper Pin
MsmVc21-Aug-09 1:50
MsmVc21-Aug-09 1:50 
GeneralRe: InvokeHelper Pin
Vi221-Aug-09 2:09
Vi221-Aug-09 2:09 
GeneralRe: InvokeHelper Pin
MsmVc21-Aug-09 2:23
MsmVc21-Aug-09 2:23 
GeneralRe: InvokeHelper Pin
Vi221-Aug-09 2:32
Vi221-Aug-09 2:32 
GeneralRe: InvokeHelper Pin
MsmVc21-Aug-09 2:46
MsmVc21-Aug-09 2:46 
GeneralRe: InvokeHelper Pin
Vi221-Aug-09 2:51
Vi221-Aug-09 2:51 
GeneralRe: InvokeHelper Pin
MsmVc21-Aug-09 3:00
MsmVc21-Aug-09 3:00 
GeneralRe: InvokeHelper Pin
MsmVc23-Aug-09 19:48
MsmVc23-Aug-09 19:48 
GeneralRe: InvokeHelper Pin
gaurav_quexst24-Aug-09 1:08
gaurav_quexst24-Aug-09 1:08 
QuestionHow to display images of my custom filetype in IE Pin
srivas20-Aug-09 19:59
srivas20-Aug-09 19:59 

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.