G
Guest
Hello Friends,
I made a 'dll' in C++ with Visual Studio 2005 with one
function. I defined the export function with Extern 'C' to avoid C++
managling. After that added 'dll' to my C# test program and called the method
then I am getting Exception 'NotSupportedException'. Just to let you know
that I am using .NET compact framework 1.0. Can anybody help me what's going
wrong ? Here is complete code.
C++ code :
DWORD GetScreenOrientation()
{
DEVMODE devmode = {0};
devmode.dmSize = sizeof(DEVMODE);
devmode.dmFields = DM_DISPLAYORIENTATION;
ChangeDisplaySettingsEx(NULL, &devmode, 0, CDS_TEST, NULL);
return devmode.dmDisplayOrientation;
}
#ifdef __cplusplus
extern "C" {
#endif //__cplusplus
__declspec(dllexport) DWORD GetScreenOrientation();
#ifdef __cplusplus
} // extern "C"
#endif //__cplusplus
C# import declaration:
[DllImport("screenrotation.dll", EntryPoint = "GetScreenOrientation",
SetLastError = true, CharSet = CharSet.Unicode)]
public static extern long GetScreenOrientation();
Thanks in advance.
Regards,
-Santosh
I made a 'dll' in C++ with Visual Studio 2005 with one
function. I defined the export function with Extern 'C' to avoid C++
managling. After that added 'dll' to my C# test program and called the method
then I am getting Exception 'NotSupportedException'. Just to let you know
that I am using .NET compact framework 1.0. Can anybody help me what's going
wrong ? Here is complete code.
C++ code :
DWORD GetScreenOrientation()
{
DEVMODE devmode = {0};
devmode.dmSize = sizeof(DEVMODE);
devmode.dmFields = DM_DISPLAYORIENTATION;
ChangeDisplaySettingsEx(NULL, &devmode, 0, CDS_TEST, NULL);
return devmode.dmDisplayOrientation;
}
#ifdef __cplusplus
extern "C" {
#endif //__cplusplus
__declspec(dllexport) DWORD GetScreenOrientation();
#ifdef __cplusplus
} // extern "C"
#endif //__cplusplus
C# import declaration:
[DllImport("screenrotation.dll", EntryPoint = "GetScreenOrientation",
SetLastError = true, CharSet = CharSet.Unicode)]
public static extern long GetScreenOrientation();
Thanks in advance.
Regards,
-Santosh