I have been hunting around and have gotten bits and pieces of information regarding windows messaging. I am trying to create a service that captures messages coming in from windows and depending on the message it is supposed to call the function/subs in the main program.
I have found this bit of code that I want to modify:
VB Code:
Protected Overloads Sub WndProc(ByRef m As Message) Select Case m.Msg 'If from Meny Close Is Selected then Case Is = WM_SYSCOMMAND Select Case m.WParam.ToInt32 Case Is = SC_CLOSE MsgBox("Closing") Case Is = SC_MAXIMIZE MsgBox("Maximize") Case Is = SC_RESTORE MsgBox("Restore") End Select Case Is = WM_DESTROY MsgBox("Destroy") Case Is = WM_CLOSE MsgBox("Close") Case Is = WM_KEYDOWN MsgBox(m.HWnd.ToString) 'MsgBox("Key Down : Virtual Code : " & m.HWnd.ToInt32 & vbCrLf & "Key Data : " & m.LParam.ToInt32) End Select MyBase.WndProc(m) End Sub
However, I am not sure how to get the messages from windows in the first place. Also, I am getting a msg that wndproc is not part of system.serviceprocess.ServiceBase. Can anybody pls point me in the right direction?
Thank you,
D
