P
Prateek
Hi,
I am trying to pass an integer value from .NET CF to evc4 ATL Com dll
function through <dllImport> attribute. As soon as i Pass this value
this value is converted to 0 in evc4. For eg: if i am pass an interger
value 55 thorugh .Net CF, then i receive an interger value 0 in eVC4
dll function.
Can anyone help me out in finding the reason for this behaviour. Below
is the signature for both functions at both ends:
In eVC4 Dll function defination:
#define EXP extern "C" __declspec(dllexport)
EXP int Sample::intValPassTest(int var)
{
/* //Code for converting the integer value to string and see it
through MessageBox in .Net CF
//Shows that integer value 0 is received.
TCHAR arr[5];
wsprintf(arr,TEXT("%d"),var);
MessageBox(NULL,arr,L"emVC4",NULL);
*/
return var;
} ///Class Sample declaration with all function declarations is given
in a Header file which is included in the project.
..Net CF Function.
<DllImport("Sample_ATL_COM.dll",
CallingConvention:=CallingConvention.Winapi, CharSet:=CharSet.Auto,
EntryPoint:="intValPassTest", SetLastError:=True)> _
Public Shared Function intValPassTest(ByVal i As Integer) As
Integer
End Function
And I am calling this function on a button_click event. And its code is
written below:
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button10.Click
Try
Dim i As Integer = 55
Dim ii As Integer
ii = intValPassTest(i)
MsgBox(ii) '''msgbox shows 0.
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Any help is appreciated and thanks in advance.
I am trying to pass an integer value from .NET CF to evc4 ATL Com dll
function through <dllImport> attribute. As soon as i Pass this value
this value is converted to 0 in evc4. For eg: if i am pass an interger
value 55 thorugh .Net CF, then i receive an interger value 0 in eVC4
dll function.
Can anyone help me out in finding the reason for this behaviour. Below
is the signature for both functions at both ends:
In eVC4 Dll function defination:
#define EXP extern "C" __declspec(dllexport)
EXP int Sample::intValPassTest(int var)
{
/* //Code for converting the integer value to string and see it
through MessageBox in .Net CF
//Shows that integer value 0 is received.
TCHAR arr[5];
wsprintf(arr,TEXT("%d"),var);
MessageBox(NULL,arr,L"emVC4",NULL);
*/
return var;
} ///Class Sample declaration with all function declarations is given
in a Header file which is included in the project.
..Net CF Function.
<DllImport("Sample_ATL_COM.dll",
CallingConvention:=CallingConvention.Winapi, CharSet:=CharSet.Auto,
EntryPoint:="intValPassTest", SetLastError:=True)> _
Public Shared Function intValPassTest(ByVal i As Integer) As
Integer
End Function
And I am calling this function on a button_click event. And its code is
written below:
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button10.Click
Try
Dim i As Integer = 55
Dim ii As Integer
ii = intValPassTest(i)
MsgBox(ii) '''msgbox shows 0.
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Any help is appreciated and thanks in advance.