Hi everyone:
I should admit, that I do not have much experience working with COM/automation. My goal is to create a C++ module whose methods could be exposed/called by a JScript script running in a .JS file via the Windows Script Host.
In other words, when I call the following from JScript:
It should invoke my Show() C++ method in the DLL.
So I did some research and found this and this articles.
Now, trying to combine them into my own MFC-based DLL, I did the following:
1. I went into VS 2008 and created a template MFC DLL with support for automation (using the VS wizard.)
2. I then added the code from the second article:
http://www.codeproject.com/Articles/...C-applications
to implement the COM methods.
But the issue is that I'm probably missing something due to my limited knowledge of COM/automation.
My project seems to compile but the linker gives me this error:
1>TestComObjMFC32.obj : error LNK2001: unresolved external symbol _IID_ITestComObjMFC
Note that IID_ITestComObjMFC is not defined anywhere in the project directly. It's later added to a TestComObjMFC32_i.c file that is created by the MIDL compiler (if I understand it correctly.)
I tried studying a similar project from the link above which doesn't seem to produce this error but I can't see what's different in my case.
I'll attach my test VS 2008 solution here. (For simplicity, I disabled automatic COM registration is Solution Properties -> Linker -> Register Output.)
Can someone please take a look?
Also, is my implementation of the method described above correct?
PS. I can't reuse the first C-only project, since I need to use MFC in my DLL (my existing libraries are written with it.)
I should admit, that I do not have much experience working with COM/automation. My goal is to create a C++ module whose methods could be exposed/called by a JScript script running in a .JS file via the Windows Script Host.
In other words, when I call the following from JScript:
Code:
var Obj = new ActiveXObject("ITestComObjMFC.object");
var Result = Obj.Show();
So I did some research and found this and this articles.
Now, trying to combine them into my own MFC-based DLL, I did the following:
1. I went into VS 2008 and created a template MFC DLL with support for automation (using the VS wizard.)
2. I then added the code from the second article:
http://www.codeproject.com/Articles/...C-applications
to implement the COM methods.
But the issue is that I'm probably missing something due to my limited knowledge of COM/automation.
My project seems to compile but the linker gives me this error:
Quote:
1>TestComObjMFC32.obj : error LNK2001: unresolved external symbol _IID_ITestComObjMFC
I tried studying a similar project from the link above which doesn't seem to produce this error but I can't see what's different in my case.
I'll attach my test VS 2008 solution here. (For simplicity, I disabled automatic COM registration is Solution Properties -> Linker -> Register Output.)
Can someone please take a look?
Also, is my implementation of the method described above correct?
PS. I can't reuse the first C-only project, since I need to use MFC in my DLL (my existing libraries are written with it.)