Click here to Skip to main content
15,914,221 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Accessing Activex control methods from static functions?? Pin
Nibu babu thomas27-Mar-06 19:05
Nibu babu thomas27-Mar-06 19:05 
GeneralRe: Accessing Activex control methods from static functions?? Pin
vanip27-Mar-06 20:36
vanip27-Mar-06 20:36 
AnswerRe: Accessing Activex control methods from static functions?? Pin
Vinaya27-Mar-06 19:05
Vinaya27-Mar-06 19:05 
AnswerRe: Accessing Activex control methods from static functions?? Pin
Roger Stoltz27-Mar-06 21:11
Roger Stoltz27-Mar-06 21:11 
GeneralRe: Accessing Activex control methods from static functions?? Pin
vanip27-Mar-06 20:34
vanip27-Mar-06 20:34 
GeneralRe: Accessing Activex control methods from static functions?? Pin
vanip27-Mar-06 22:10
vanip27-Mar-06 22:10 
GeneralRe: Accessing Activex control methods from static functions?? Pin
Vinaya27-Mar-06 20:56
Vinaya27-Mar-06 20:56 
AnswerRe: Accessing Activex control methods from static functions?? Pin
Roger Stoltz27-Mar-06 22:41
Roger Stoltz27-Mar-06 22:41 
The thread controlling function can be a non-static member of the class.

When you spawn the new thread with e.g. AfxbeginThread, you should pass the this-pointer as the LPVOID parameter. Your thread controlling function takes a LPVOID as argument which would now be your this-pointer. Type cast it and you'll be able to access both non-static member variables and functions from your thread.

Joe Newcomer has written a very nice article about threading that I strongly recommend everyone who is doing multithreading. You'll find it here[^]. He's got a lot of very useful tips, tricks and how-to's on his site.

When you're done with the threading stuff, a new problem may occur depending on how your ActiveX works. If you plan to use COM objects from a thread you have to initialize COM for that thread by a call to ::CoInitialize or similar. This sets up a new apartment. Now you have another problem: you can't cross apartment boundaries without marshalling the COM interface. Have a look at ::CoMarshalInterThreadInterfaceInStream and ::CoGetInterfaceAndReleaseStream for info about how to do that.
This is the correct way to do this. You have to marshal the interface. There are no shortcuts.

Post again if you have more troubles. If they are COM/ActiveX related, post your query in the COM forum.

Hope this helps
--
Roger


It's supposed to be hard, otherwise anybody could do it!
GeneralRe: Accessing Activex control methods from static functions?? Pin
vanip27-Mar-06 22:06
vanip27-Mar-06 22:06 
GeneralRe: Accessing Activex control methods from static functions?? Pin
Vinaya27-Mar-06 23:02
Vinaya27-Mar-06 23:02 
Question__declspec(allocate)'d sections in library being stripped (I wish to keep them) Pin
Michael Abbott27-Mar-06 18:33
Michael Abbott27-Mar-06 18:33 
QuestionListCtrl Tabs Pin
vinod.sankuthodi27-Mar-06 18:28
vinod.sankuthodi27-Mar-06 18:28 
AnswerRe: ListCtrl Tabs Pin
Nibu babu thomas27-Mar-06 19:24
Nibu babu thomas27-Mar-06 19:24 
AnswerRe: ListCtrl Tabs Pin
Hamid_RT27-Mar-06 19:29
Hamid_RT27-Mar-06 19:29 
GeneralRe: ListCtrl Tabs Pin
vinod.sankuthodi27-Mar-06 21:07
vinod.sankuthodi27-Mar-06 21:07 
GeneralRe: ListCtrl Tabs Pin
ThatsAlok27-Mar-06 23:02
ThatsAlok27-Mar-06 23:02 
GeneralRe: ListCtrl Tabs Pin
Hamid_RT28-Mar-06 18:08
Hamid_RT28-Mar-06 18:08 
Questioncalling mmsystem.h function, getting linker errors Pin
Judah Gabriel Himango27-Mar-06 18:02
sponsorJudah Gabriel Himango27-Mar-06 18:02 
AnswerRe: calling mmsystem.h function, getting linker errors Pin
Waldermort27-Mar-06 18:10
Waldermort27-Mar-06 18:10 
GeneralRe: calling mmsystem.h function, getting linker errors Pin
Judah Gabriel Himango28-Mar-06 4:01
sponsorJudah Gabriel Himango28-Mar-06 4:01 
AnswerRe: calling mmsystem.h function, getting linker errors Pin
ThatsAlok27-Mar-06 23:04
ThatsAlok27-Mar-06 23:04 
GeneralRe: calling mmsystem.h function, getting linker errors Pin
Judah Gabriel Himango28-Mar-06 4:01
sponsorJudah Gabriel Himango28-Mar-06 4:01 
QuestionRemoving resource.hm Pin
Jack Puppy27-Mar-06 17:56
Jack Puppy27-Mar-06 17:56 
AnswerRe: Removing resource.hm Pin
Waldermort27-Mar-06 18:09
Waldermort27-Mar-06 18:09 
AnswerRe: Removing resource.hm Pin
Nibu babu thomas27-Mar-06 19:01
Nibu babu thomas27-Mar-06 19:01 

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.