Click to See Complete Forum and Search --> : Pumping Messages


AEN
September 16th, 1999, 11:32 AM
OK, Here's a question...

I am a VC++ developer, and I am writing a VB client for one of my C++ servers. I want to know how to make a VB app that is a Sub Main() based project, pump messages or run.
If you load a form, VB will run the UI until a user presses a button to cause an exit. I have no main form and haven't figured out how to make the Sub Main() stay alive until the server sends a exit message.
Yes this is a little unusual, but quite needed for what I am doing. How about it?

September 16th, 1999, 09:04 PM
Wouldn't this work? I don't know the Get Message API's but since your a C++ programmer you probably know them :)


Sub Main()
Dim bExit as Boolean
Do
' Poll for the message here
' I'm not sure if you want forms to load but,

' If the message wants a new form to load then:
' Load form1
' Form1.Show
' End If

' If the Message wants the app to quit then
' bExit = true
' End If

DoEvents ' Allow other windows apps to operate
Loop Until bExit = true
End Sub