Click here to Skip to main content
15,918,976 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: excutable file location Pin
Anonymous16-Apr-04 2:54
Anonymous16-Apr-04 2:54 
GeneralDebug MFC Pin
Member 61706715-Apr-04 11:21
Member 61706715-Apr-04 11:21 
QuestionCSplitterWnd - bug??? Pin
_-:: PhOeNiX ::-_15-Apr-04 10:34
_-:: PhOeNiX ::-_15-Apr-04 10:34 
GeneralNeed Urgent C++ help Pin
Anonymous15-Apr-04 10:34
Anonymous15-Apr-04 10:34 
GeneralRe: Need Urgent C++ help Pin
Christian Graus15-Apr-04 11:01
protectorChristian Graus15-Apr-04 11:01 
GeneralRemotely Connecting to SQL Server! Pin
abc87615-Apr-04 9:52
abc87615-Apr-04 9:52 
GeneralVB client for a C++ api Pin
Jim Crafton15-Apr-04 9:48
Jim Crafton15-Apr-04 9:48 
GeneralRe: VB client for a C++ api Pin
Gary R. Wheeler15-Apr-04 11:58
Gary R. Wheeler15-Apr-04 11:58 
Jim Crafton wrote:
The VB client has no need to work in multiple threads, or be aware of their presence.

You will need to be careful how your events are passed to the VB client. It may expect or require that callbacks to it are on the GUI thread.

It's probably not the right way to do it when using COM (all that apartment stuff comes to mind), but I've used the 'hidden window and user-defined messages' trick to handle this. In the GUI thread, create a hidden window. Your event handler, which is called on an unknown thread, uses ::PostMessage and the window's handle to drop a message into the hidden window. The hidden window, running on the GUI thread, processes the user-defined message and handles the event. If the event has information, you can use the WPARAM and LPARAM arguments for small things, or pass pointers to objects allocated from the heap. If you do the latter, you need to ensure that the hidden window has a WM_DESTROY handler that will run the message pump dry via PeekMessage and delete the arguments.

The event handler and the GUI thread are decoupled in this case, which can be useful. The event handler doesn't block (except briefly during the PostMessage call). Events are maintained in order by the hidden window message queue.


Software Zen: delete this;
GeneralWinApp::OnIdle Pin
_-:: PhOeNiX ::-_15-Apr-04 9:44
_-:: PhOeNiX ::-_15-Apr-04 9:44 
GeneralRe: WinApp::OnIdle Pin
PJ Arends15-Apr-04 11:53
professionalPJ Arends15-Apr-04 11:53 
GeneralSTACKS AND QUES Pin
PDALE15-Apr-04 8:04
PDALE15-Apr-04 8:04 
GeneralRe: STACKS AND QUES Pin
toxcct15-Apr-04 8:16
toxcct15-Apr-04 8:16 
GeneralRe: STACKS AND QUES Pin
Jim Crafton15-Apr-04 10:15
Jim Crafton15-Apr-04 10:15 
GeneralRe: STACKS AND QUES Pin
Jim Crafton15-Apr-04 10:17
Jim Crafton15-Apr-04 10:17 
GeneralMaskededit control Pin
C++NewBe15-Apr-04 7:49
C++NewBe15-Apr-04 7:49 
GeneralRe: Maskededit control Pin
David Crow15-Apr-04 10:14
David Crow15-Apr-04 10:14 
GeneralRe: Maskededit control Pin
C++NewBe15-Apr-04 10:19
C++NewBe15-Apr-04 10:19 
GeneralRe: Maskededit control Pin
David Crow15-Apr-04 10:33
David Crow15-Apr-04 10:33 
GeneralRe: Maskededit control Pin
C++NewBe15-Apr-04 10:42
C++NewBe15-Apr-04 10:42 
GeneralSerialize Pin
Demian Panello15-Apr-04 5:48
Demian Panello15-Apr-04 5:48 
GeneralMulti threading Pin
dreamerzz15-Apr-04 5:13
dreamerzz15-Apr-04 5:13 
GeneralRe: Multi threading Pin
David Crow15-Apr-04 7:16
David Crow15-Apr-04 7:16 
GeneralRe: Multi threading Pin
dreamerzz15-Apr-04 20:38
dreamerzz15-Apr-04 20:38 
GeneralRe: Multi threading Pin
David Crow19-Apr-04 2:28
David Crow19-Apr-04 2:28 
GeneralRe: Multi threading Pin
dreamerzz20-Apr-04 2:14
dreamerzz20-Apr-04 2:14 

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.