Click to See Complete Forum and Search --> : RaiseEvent and vbModal


eric33
October 5th, 1999, 07:24 AM
I made an activex with VB6 and use RaiseEvent to send event to the client.
I made too a client under vb6 to test my control.

If i have a modal dialog box opened by the activex code then the client don't receive the raised event sent by the control (on a timer scheduler).

WHY ???

czimmerman
October 5th, 1999, 11:35 AM
If you have a modal dialog box open, application of a program's execution is delayed until it is closed. This is illustrated more clearly by the following example.

frmMyForm.show vbModal
msgbox "Form closed"




It is probably obvious that the message box above is not displayed unless the form is closed. In your case, it is less obvious but the same principle applies.

Charlie Zimmerman
http://www.freevbcode.com
czimmerman@freevbcode.com

Bruno
October 5th, 1999, 12:49 PM
Your client exe will work when it is compiled (when both OCX and client project are compiled).
This is known difference between running program in VB IDE and compiled.

When modal form is shown, VB IDE will not (there are some exceptions*) fire events on other forms. In EXE events will be fired.
(Sample for this behaviour is Karl E. Peterson's code for closing MsgBox; uses the fact that Timers are only blocked in the IDE, and will continue to work in an EXE)

If you need your events in IDE, there are 2 workarounds:
- use non compiled version of OCX, i.e. add OCX project to project group. (*)
- use special class for creating events (complicated)

eric33
October 6th, 1999, 01:05 AM
Thanx

i test it using the exe (and not under vb) and all is ok.

suntosh
October 6th, 1999, 01:18 AM
this is because once the modal window is initiated all the code after the window call is paused until the modal window is closed. no code of the timer will be executed until the modal window is released.

take for example the sample code :

Form1.Show vbModal
msgbox "Hello World !!"

the msgbox will not be display until the Form1 is closed.

eric33
October 6th, 1999, 01:35 AM
No i know that and i raise on a timer scheduler.

But ok now the problem is that in vb environment event are not raised until modal window are opened.
But all is ok now if i run the compiled exe.