Hi Ketil,
I'm trying to launch the WB in a separate thread, but I'm afraid I'm not waiting/exiting or CoUninitialize-ing it correctly, and it sometimes raises an error on quit.
I feel quite guilty asking you for help for a third time in two weeks, but I have no one else to ask :(
Could you happen to have a threaded WB skeleton, or maybe you can spot the bad idea in mine?
I've made the attached code as short as possible to save your time.
[attachment deleted by admin]
Hi
I'm not an expert in this area.
The idea is to make a controled thread termination. It might work.
KetilO
[attachment deleted by admin]
Thank you very much, Ketil!
I also tried to play with PostThreadMessage, just my code looked much uglier, with "the guy started 3 weeks ago" written between the lines.
Your workaround is working, and looks much less workaroundish than my own attempts.
If you one day accidently stumble upon how it's advised to be done by the headquaters, please post here.
Thank you again, and good luck :thumbu
Ketil,
Your code contains an interesting puzzle - you actually don't escape the loop:
.elseif uMsg==WM_CLOSE
invoke PostThreadMessage,IDT_WB,WM_QUIT,0,0
mov uExit,STILL_ACTIVE
.while uExit==STILL_ACTIVE
invoke GetExitCodeThread,hThread,addr uExit
invoke GetMessage,addr msg,NULL,0,0
invoke TranslateMessage,addr msg
invoke DispatchMessage,addr msg
invoke Sleep,10
.endw
on WM_CLOSE itself, but an additional interaction with the window is required.
I've noticed it when sending WM_CLOSE on tray icon click - the window won't close unlil mouseover or keyboard. It wasn't noticable in your example as there WM_CLOSE is always from the mouse or keyboard.
I've attached your code with added WM_CLOSE sent on tray icon click, see how strange it looks - thread dies, main window lives.
It's more of a logical puzzle than an urgent matter, but pretty interesting.
[attachment deleted by admin]