Tech Support > Microsoft Windows > Drivers > Custom message loop
Custom message loop
Posted by Nak on July 7th, 2004


Hi there,

I am attempting to make a custom message loop in VB.NET so that I can
use it for interprocess communication. At current I am successfully
creating a window class that never actually gets drawn to screen so that I
can recieve messages, this seems to work but for only a few messages then
all of a sudden my application seems to start unloading.

I have a class that exposes shared methods, mainly windows API's and
types, after a couple of messages have been sent to the "windowless" I can
no longer use any of the shared methods as I am being told that the object
is not referenced, I never thought it was??!?

I am wondering if there is anything else that I should be processing in
order to keep this object alive, currently my Windows message handler looks
like so...

-----

Private Function MyWndProc(ByVal hWnd As Integer, ByVal msgvalue As Integer,
ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Dim pIntRetVal As Integer

Select Case msgvalue
Case WM_DESTROY
Call PostQuitMessage(0)
Case Else
RaiseEvent messageRecieved(msgvalue, wParam, lParam)
pIntRetVal = DefWindowProc(hWnd, msgvalue, wParam, lParam)
End Select

Return (pIntRetVal)

End Function

-----

I seem to be able to send about 2 or 3 of my own messages to the window
before it suddenly stops working, maybe it has something to do with
DefWindowProc being called at the wrong time?

If anyone has any suggestions I would be most appreciative. Thanks
loads in advance!!!

Nick.


Posted by Nak on July 7th, 2004


Sorry, wrong group!

"Nak" <a@a.com> wrote in message
news:O1R00qBZEHA.556@tk2msftngp13.phx.gbl...



Similar Posts