I wrote a very simple code in VB.NET to send just a key to active window, conpiled into DLL. Also wrote a MapBasic app that recalls that DLL but at runtime MapInfo fails.
My VB.NET code:
Imports Microsoft.VisualBasic.Devices
Namespace MyApp1
Public Class SENDKEY2MAPINFO
Public Shared Function SENDKEYX(s_key As String) As String
My.Computer.Keyboard.SendKeys(s_key, True)
Return 0
End Function
End Class
End Namespace
It compliles right into "SendKey2Mapinfo.dll"
My MB code:
Declare Method SENDKEYX Class "MyApp1.SENDKEY2MAPINFO" Lib "SendKey2MapInfo.dll" (ByVal s_key as String) As String
... ... ...
Dim retval, s_key as String
s_key="{C}"
retval = SENDKEYX(s_key)
At runtime it crashes with the message : "(appname.mb:line) Could not find class "MyApp1.SENDKEY2MAPINFO". TypeLoadException, Could not load type 'MyApp1.SENDKEY2MAPINFO' from assembly 'SendKey2MapInfo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. "
The same failing result if the
VB.NET code is
Imports Microsoft.VisualBasic.Devices
Namespace MyApp1
Public Class SENDKEY2MAPINFO
Public Shared Function SENDKEYX(s_key As String)
My.Computer.Keyboard.SendKeys(s_key, True)
Return 0
End Function
End Class
End Namespace
And MB code is:
Declare Method SENDKEYX Class "MyApp1.SENDKEY2MAPINFO" Lib "SendKey2MapInfo.dll" (ByVal s_key as String)
... ... ...
...
Call SENDKEYX(s_key)
Without parameters, the result is the same fail.
I'm editing VB.NEt with VisualStudio, is tehre any compilation option to look at?
May anyone find where the problem is?
Thank you in advance.
SGR
------------------------------
Sergi Gamiz-Ribelles
Knowledge Community Shared Account
------------------------------