I created an application for Windows CE 5.0 in VB. The class application AppCEClass is inherited from Microsoft.WindowsCE.Forms.MessageWindow. I have a problem to launch an application, because something like this does not work:
Public Shared Sub Main()
Windows does not recognize the class name and throw error AppCEClass() cannot be converted on System.Windows.Forms.Form.
I am doing program in VB for Windows CE 5.0. I need to catch messages from other programs in VB window. In VB is defined a function WndProc. But, this function does not work (or exist) on CE. Compiler cannot recognize it.
ProtectedOverridesSub WndProc(ByRef recWinMessage As Microsoft.WindowsCE.Forms.Message)
I tried to read an article, but I didn't find anything helpful. Problem is, that I am using VB for Windows CE and there is not supported WndProc. What can I do?
This is a fragment of code. What I am doing wrong? WndProc cannot be recognized od VB for Window CE.
<DllImport("coredll.dll", SetLastError:=True, CharSet:=CharSet.Auto)> Private Shared Function FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
<DllImport("coredll.dll", SetLastError:=True, CharSet:=CharSet.Auto)> Private Shared Function SendMessage( _
ByVal hwnd As IntPtr, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As Int32) As Int32
<DllImport("coredll.dll", SetLastError:=True)> _
Private Shared Function SetWindowLong(ByVal hWnd As IntPtr, ByVal nIndex As Integer, ByVal dwNewLong As WndProc) As Integer
Public Shared Sub Main2()
Dim ip As IntPtr
ip = FindWindow(vbNullString, "Kvant 1.0")
If (ip <> 0) Then
SendMessage(ip, &H10, 0, 0)
Dim GWL_WNDPROC As Long = -4
Dim lpPrevWndProc As Integer
Public Function SubClass(ByVal lHwnd As Long) As Boolean
lpPrevWndProc = SetWindowLong(lHwnd, GWL_WNDPROC, AddressOf WndProc)
Protected Overrides Sub WndProc(ByRef recWinMessage As Microsoft.WindowsCE.Forms.Message)
Shared Sub Main()
The "ShowDialog" method is blocking; it will halt the execution of the current thread until the dialog is dismissed by the user. You're checking whether the result of that method equals the enumerated value "DialogResult.OK".
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]