Using Application.Run() without a form

G

Guest

Is it possible to put a VB.NET application in a message loop without a form?
From what I've read the method Application.Run() (parameterless) allows for
this...but how do you define the message loop handler that's the equivalent
of WndProc for an application that does not have a form? Unfortunately
Application.Run(new form()) makes the form visible so using a dummy form
doesn't work here. Thanks in advance for any help.

-Mike
 
H

Herfried K. Wagner [MVP]

mike2036 said:
Is it possible to put a VB.NET application in a message loop without a
form?
From what I've read the method Application.Run() (parameterless) allows
for
this...but how do you define the message loop handler that's the
equivalent
of WndProc for an application that does not have a form? Unfortunately
Application.Run(new form()) makes the form visible so using a dummy form
doesn't work here. Thanks in advance for any help.

Check out 'Application.AddMessageFilter' in the documentation.
 
G

Guest

Hi Herfried,

Thanks for the reply. Do I still need a hidden form using a message filter,
since I need to pass a handle to external app's to be signaled with messages?
Or can I get the application handle somehow from a formless app?

-Mike
 
H

Herfried K. Wagner [MVP]

mike2036 said:
Thanks for the reply. Do I still need a hidden form using a message
filter,
since I need to pass a handle to external app's to be signaled with
messages?
Or can I get the application handle somehow from a formless app?

If the other application requires a window handle, you'll have to create a
window.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top