B
Bebel
Hello,
I tried to register my own window class by using the RegisterClass function
of lib CoreDll.dll in Visual Basic for Visual Studio.net 2008. My Device is a
Windows Mobile 5 device. Each time I tried to register, I received a
System.NotSupportedException message. Why?
regards,
'Declarations:
<DllImport("coredll.dll", CharSet:=CharSet.Auto, SetLastError:=True,
EntryPoint:="RegisterClass")> _
Friend Shared Function RegisterClassW(ByRef lpwcx As WindowClass) As
Integer
End Function
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto)> _
Public Structure WindowClass
Public style As UInteger
Public Delegate Sub lpfnWndProc()
Public cbClsExtra As Integer
Public cbWndExtra As Integer
Public hInstance As IntPtr
Public hIcon As IntPtr
Public hCursor As IntPtr
Public hbrBackground As IntPtr
<MarshalAs(UnmanagedType.LPStr)> _
Public lpszMenuName As String
<MarshalAs(UnmanagedType.LPStr)> _
Public lpszClassName As String
End Structure
'Code:
Dim hInstance As IntPtr = NativeMethods.GetModuleHandle(Nothing)
Dim wndclass As NativeMethods.WindowClass = New
NativeMethods.WindowClass
With wndclass
.hInstance = hInstance
.cbClsExtra = 0
.cbWndExtra = 0
.hCursor = Nothing
.hIcon = Nothing
.hbrBackground = NativeMethods.COLOR_WINDOW
.style = NativeMethods.CS_DBLCLKS
.lpszMenuName = Nothing
.lpszClassName = "Test"
End With
Dim classAtom As Integer =
NativeMethods.RegisterClassW(wndclass)
If classAtom = 0 Then
Dim err As Integer = Marshal.GetLastWin32Error()
Throw New Win32Exception(err, "Enregistrement de la
classe impossible.")
End If
thnk you for your help,
regards
I tried to register my own window class by using the RegisterClass function
of lib CoreDll.dll in Visual Basic for Visual Studio.net 2008. My Device is a
Windows Mobile 5 device. Each time I tried to register, I received a
System.NotSupportedException message. Why?
regards,
'Declarations:
<DllImport("coredll.dll", CharSet:=CharSet.Auto, SetLastError:=True,
EntryPoint:="RegisterClass")> _
Friend Shared Function RegisterClassW(ByRef lpwcx As WindowClass) As
Integer
End Function
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto)> _
Public Structure WindowClass
Public style As UInteger
Public Delegate Sub lpfnWndProc()
Public cbClsExtra As Integer
Public cbWndExtra As Integer
Public hInstance As IntPtr
Public hIcon As IntPtr
Public hCursor As IntPtr
Public hbrBackground As IntPtr
<MarshalAs(UnmanagedType.LPStr)> _
Public lpszMenuName As String
<MarshalAs(UnmanagedType.LPStr)> _
Public lpszClassName As String
End Structure
'Code:
Dim hInstance As IntPtr = NativeMethods.GetModuleHandle(Nothing)
Dim wndclass As NativeMethods.WindowClass = New
NativeMethods.WindowClass
With wndclass
.hInstance = hInstance
.cbClsExtra = 0
.cbWndExtra = 0
.hCursor = Nothing
.hIcon = Nothing
.hbrBackground = NativeMethods.COLOR_WINDOW
.style = NativeMethods.CS_DBLCLKS
.lpszMenuName = Nothing
.lpszClassName = "Test"
End With
Dim classAtom As Integer =
NativeMethods.RegisterClassW(wndclass)
If classAtom = 0 Then
Dim err As Integer = Marshal.GetLastWin32Error()
Throw New Win32Exception(err, "Enregistrement de la
classe impossible.")
End If
thnk you for your help,
regards