CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    May 1999
    Posts
    318

    RaiseEvent and vbModal

    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 ???





  2. #2

    Re: RaiseEvent and vbModal

    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
    [email protected]



  3. #3
    Join Date
    Sep 1999
    Posts
    202

    Re: RaiseEvent and vbModal

    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)


  4. #4
    Join Date
    May 1999
    Posts
    318

    Re: RaiseEvent and vbModal

    Thanx

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




  5. #5
    Join Date
    Oct 1999
    Location
    India
    Posts
    5

    Re: RaiseEvent and vbModal

    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.



  6. #6
    Join Date
    May 1999
    Posts
    318

    Re: RaiseEvent and vbModal

    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.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured