MsgBox in a different thread, problems with VB5 
Author Message
 MsgBox in a different thread, problems with VB5

Hello,

using some API calls, it is possible to run some parts of a VB5 exe
file in a different thread. But this should be done only if really
necessary.

I had problems with the MsgBox function of VB when the subroutine
using it was running in a different thread, I did not see any of the
Message Boxes necessary for reporting of invalid input data. But when
I tried the same subroutine without a different thread all Message
Boxes apeared as they should.

Then I used the Message Boxes via an API call to user32.dll:

Declare Function MessageBox Lib "user32" Alias "MessageBoxA" _
    (ByVal hwnd As Long, ByVal lpText As String, _
    ByVal lpCaption As String, ByVal wType As Long) As Long

I used the window handle of my form (MyForm.hWnd) containing the
subroutine for the first parameter hWnd and the same parameters of the
VB MsgBox function for the three other parameters, but in the
different order:
MsgBox(prompt[, buttons] [, title])
MessageBox(hWnd, prompt, title, buttons)

Now it worked without problems, running in different threads and also
in the same thread.

Good luck and bye,

Uwe
--
Uwe Hercksen
Elektronikwerkstatt
Universit?t Erlangen-Nrnberg
Cauerstr. 5
D91058 Erlangen



Tue, 07 Aug 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Threading problem --> threads die

2. Single Thread and Apartment Thread Problem

3. Msgbox Acts different in vbscript

4. MsgBox freezes ActiveX EXE when running in a different security context

5. VB.NET How Do I Run MDI-Child On Different Thread

6. Timer in a different thread

7. SOCKET : Receiving and sending in different threads

8. Adding a node to a treeview from a different thread

9. invoking an event on a different thread

10. 8001010e -- interface that was marshalled for different thread ???

11. 8001010e -- interface that was marshalled for different thread ???

12. 8001010e -- interface that was marshalled for different thread ???

 

 
Powered by phpBB® Forum Software