OpenNETCF - ApplicationEX class - VB.NET conversion - NotSupported Error

  • Thread starter Christopher Pragash
  • Start date

C

Christopher Pragash

Hello All,

I am trying to convert the ApplicationEX class from OpenNETCF Framework to
VB.NET (since my complete project is in VB.NET and we want consistency in
code language) - I translated all the code but I keep getting an error
"NotSupported" when a call is made to GetMessage inside the Pump function.
Here is my calling signature:

If GetMessage(msg, IntPtr.Zero, 0, 0) Then 'This line returns a
"NotSupported" Exception
My P/Invode Declerations and the msg Structrure are listed below. Any
thoughts or suggestions on this would be really helpful. Thanks in advance,
Chris

Following are my P/Invoke Decelerations:

<DllImport("coredll.dll", EntryPoint:="PeekMessage", SetLastError:=True)> _
Private Shared Function PeekMessage(ByVal lpMSG As msg, ByVal hWnd As
IntPtr, ByVal wMsgFilterMin As Integer, ByVal wMsgFilterMax As Integer,
ByVal wRemoveMsg As Integer) As Boolean

End Function

<DllImport("coredll.dll", EntryPoint:="GetMessageW", SetLastError:=True)> _
Private Shared Function GetMessage(ByVal lpMSG As msg, ByVal hWnd As IntPtr,
ByVal wMsgFilterMin As Integer, ByVal wMsgFilterMax As Integer) As Boolean

End Function

<DllImport("coredll.dll", EntryPoint:="TranslateMessage",
SetLastError:=True)> _
Private Shared Function TranslateMessage(ByVal lpMsg As msg) As Boolean

End Function

<DllImport("coredll.dll", EntryPoint:="DispatchMessage",
SetLastError:=True)> _
Private Shared Function DispatchMessage(ByVal lpMsg As msg) As Boolean

End Function

<DllImport("coredll.dll", EntryPoint:="PostQuitMessage",
SetLastError:=True)> _
Private Shared Sub PostQuitMessage(ByVal nExitCode As Integer)

End Sub

Following is my MSG Structure decleration

Public Structure MSG
Public hwnd As IntPtr
Public message As Integer
Public wParam As IntPtr
Public lParam As IntPtr
Public time As Integer
Public pt_x As Integer
Public pt_y As Integer
End Structure
 
Ad

Advertisements

P

Peter Foot [MVP]

Why not just use the compiled ApplicationEx class as-is from your VB.NET
code? Would save you a lot of time and avoid introducing bugs into the code.
Besides it looks like you need to pass your msg structure ByRef rather than
ByVal in your declarations.

Peter
 
C

Christopher Pragash

Peter & Alex,

Thanks for you response - that worked ( I kind of figured that was the
problem - but there were other related issues which caused the error). About
the "WHY DO YOU FEEL YOU NEED TO DO THIS?" - my answer is - "my client wants
it that way so I have to" !!

Thanks again,
Cheers,
Chris
 
Ad

Advertisements

Z

Zanna

Christopher Pragash said:
Thanks for you response - that worked ( I kind of figured that was the
problem - but there were other related issues which caused the error). About
the "WHY DO YOU FEEL YOU NEED TO DO THIS?" - my answer is - "my client wants
it that way so I have to" !!

There are much unmanaged code in OpenNETCF that cannot be converted in
VB.net, so your working way is really a looser way.

Normally you rewrite all the third-parts components you use?

You should just reference the compiled files and STOP THERE!

If they change their code you loose your time to report modifies and charge
yourself of the risk that the code don't works in VB.net?
 

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