Click here to Skip to main content
15,920,031 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralList box not repainting correctly Pin
Anonymous11-Jan-00 10:31
suss Anonymous11-Jan-00 10:31 
GeneralContext menu in dialogs & command routing with MFC Pin
Member 339711-Jan-00 6:49
Member 339711-Jan-00 6:49 
Generalchanging the default editor of Visual C++ IDE Pin
Stephane10-Jan-00 23:59
Stephane10-Jan-00 23:59 
Generalmemory DC bitmap... Pin
John Mancini10-Jan-00 14:07
suss John Mancini10-Jan-00 14:07 
GeneralWorker pointers Pin
Anonymous10-Jan-00 10:42
suss Anonymous10-Jan-00 10:42 
GeneralRE: Worker pointers Pin
Member 40411-Jan-00 14:08
Member 40411-Jan-00 14:08 
GeneralCOM works in VB but not VC. Pin
Member 35177-Jan-00 16:00
Member 35177-Jan-00 16:00 
GeneralRE: COM works in VB but not VC. Pin
Alex Gorev10-Jan-00 6:41
Alex Gorev10-Jan-00 6:41 
Hi !

When you create the object in VB using "WithEvens" it means that the object can fire events. See VB documentation for more details.

You are trying to use the IDispatch interface but probably the object you are using supports dual interfaces. It's much easier from C++ and much faster. You can use the #import directive with the name of the DLL file you are using to import the type library information and the use the QueryInterface function.

Regards,
Alex Gorev,
Dundas Software.

==================
The original message was:

Here is a VB test app. It is not very complex or clever, but it works.

Dim WithEvents mcs As MCSClient
mcs.Initialize "MyString"

where MCSClient is a com object added to the VB environment by adding a reference. Not a component, but a reference.

I would like an equivalent VC app to this VB app. So I wrote some code like this.

I use the Wizard to generate a wrapper class over the same dll the VB referenced and in my header I define a variable of the wrapper type as such.

IMCSClient m_IMCSClient;

Then in my code I successfully create the dispatch like so.

if(((*(COleDispatchDriver*)(&m_IMCSClient))).m_lpDispatch==NULL){
if (!(m_IMCSClient.CreateDispatch("4E51E425-021E-11D2-B759-0020AFF84106", &oe))) {
}
}

I can also use the progid in creating the dispatch, either way works.

Here comes the problem, I want to perform the Initialze method. (Just like VB did.)
m_IMCSClient.Initialize("MyString);

When, this code excutes it will throw the following exception.
DISP_E_MEMBERNOTFOUND

I am not sure what it means.
Is anyone familar enough with VB to know what WithEvents means?
Can anyone suggest a different course of action.

GeneralBring up Modeless Forms in VB DLL from VC Pin
Linda Yang7-Jan-00 10:26
Linda Yang7-Jan-00 10:26 
Generalc++ and reports in MS Access Pin
Ruud7-Jan-00 6:21
Ruud7-Jan-00 6:21 
GeneralRE: c++ and reports in MS Access Pin
Ed Dixon8-Jan-00 10:00
Ed Dixon8-Jan-00 10:00 
GeneralRE: c++ and reports in MS Access Pin
Ed Dixon8-Jan-00 10:01
Ed Dixon8-Jan-00 10:01 
GeneralJapanese Windows 95/98/NT4 problem with VC++ apps Pin
Member 36526-Jan-00 13:23
Member 36526-Jan-00 13:23 
GeneralRE: Japanese Windows 95/98/NT4 problem with VC++ apps Pin
Mike Dunn7-Jan-00 7:49
Mike Dunn7-Jan-00 7:49 
GeneralRE: Japanese Windows 95/98/NT4 problem with VC++ apps Pin
Member 127931-Jan-00 10:08
Member 127931-Jan-00 10:08 
GeneralRe: Japanese Windows 95/98/NT4 problem with VC++ apps Pin
Member 116395373-Aug-00 10:55
Member 116395373-Aug-00 10:55 
QuestionDoes any one have any vc++ code which promotes a web site or determines the position of a web site? Pin
Erich Ruth6-Jan-00 11:55
Erich Ruth6-Jan-00 11:55 
AnswerRE: Does any one have any vc++ code which promotes a web site or determines the position of a web site? Pin
Ghazi /Dundas17-Jan-00 9:24
sussGhazi /Dundas17-Jan-00 9:24 
General[Q] How to detect when a window is created/displayed by another application Pin
Bruce Duncan6-Jan-00 6:52
Bruce Duncan6-Jan-00 6:52 
Generaltemplate in a mfc static lib Pin
b_Davis6-Jan-00 5:50
suss b_Davis6-Jan-00 5:50 
QuestionRichEditCtrl - pasted text not visible initially!? Pin
Steve Roach5-Jan-00 3:41
Steve Roach5-Jan-00 3:41 
AnswerRE: RichEditCtrl - pasted text not visible initially!? Pin
Steve Roach5-Jan-00 4:29
Steve Roach5-Jan-00 4:29 
GeneralRE: RE: RichEditCtrl - pasted text not visible initially!? Pin
Steve Roach6-Jan-00 2:56
Steve Roach6-Jan-00 2:56 
GeneralRE: RE: RE: RichEditCtrl - pasted text not visible initially!? Pin
Dmitriy6-Jan-00 3:14
Dmitriy6-Jan-00 3:14 
GeneralAdmin Lockouts Pin
Member 11564-Jan-00 14:20
Member 11564-Jan-00 14:20 

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.