can i convert a .NET handle to a win32 HWND?
Yes:
System.IntPtr handle = new IntPtr( panelX.Handle.ToInt32() );
handle can then be passed on as HWND (to managed C++ for example).
System.IntPtr handle = new IntPtr( panelX.Handle.ToInt32() );
handle can then be passed on as HWND (to managed C++ for example).
Handle is already IntPtr, no need to cast it to int32 and then back (on x64 it will be wrong).
Correct way would be (in C++/CLR):
Correct way would be (in C++/CLR):
HWND hwnd = (HWND)ctrl->Handle->ToPointer();
Is there any problems with including un-managed c++ libs with Managed code? I'm just wondering because I can't seem to link my libraries...
thanks,
stringa
thanks,
stringa
You'll need to tell us exactly what you're trying to do and what errors you're getting because we can't read your computer screen from here.
I got 34 of these...
Error 17 error LNK2028: unresolved token (0A0000B3) "public: __clrcall quat::quat(float,float,float,float)" (??0quat@@$$FQAM@MMMM@Z) referenced in function "void __clrcall `anonymous namespace'::`dynamic initializer for 'void __clrcall quat_id::A0x604c53a7(void)''(void)" (???__E?A0x604c53a7@quat_id@@YMXXZ@?A0x604c53a7@@$$FYMXXZ) Editor.obj
I'm trying to link my regular c++ libraries into a WinForms Application. Basically, I'm creating a level editor for my game and I want to use .NET but still keep it c++.
It's like I didn't include the libraries, but i did. Do I have to use some sort of extern so that It know's how to link the functions?
thanks in advance...
stringa
Error 17 error LNK2028: unresolved token (0A0000B3) "public: __clrcall quat::quat(float,float,float,float)" (??0quat@@$$FQAM@MMMM@Z) referenced in function "void __clrcall `anonymous namespace'::`dynamic initializer for 'void __clrcall quat_id::A0x604c53a7(void)''(void)" (???__E?A0x604c53a7@quat_id@@YMXXZ@?A0x604c53a7@@$$FYMXXZ) Editor.obj
I'm trying to link my regular c++ libraries into a WinForms Application. Basically, I'm creating a level editor for my game and I want to use .NET but still keep it c++.
It's like I didn't include the libraries, but i did. Do I have to use some sort of extern so that It know's how to link the functions?
thanks in advance...
stringa
Tried to make a post modification but it didn't seem to go through.
The complier is acting like I didn't include the libraries, but I did. Do I have to define some sort of extern so it knows how to link the functions?
thanks,
stringa
The complier is acting like I didn't include the libraries, but I did. Do I have to define some sort of extern so it knows how to link the functions?
thanks,
stringa
What type of project are you linking the library with (is it a C++/CLI one, or a C# one?). What type of library is it (pure native, or C++/CLI)?
I've enabled everything as CLR. Well, this is all the link errors I got left....
As you can see, they are all my windows calls : 1 for timeGetTime and 3 for setting up and running openGL in a win32 window.
How can I fix this?
tia,
stringa
8>AIEngine.lib(Time.obj) : error LNK2001: unresolved external symbol "extern "C" unsigned long __stdcall timeGetTime(void)" (?timeGetTime@@$$J10YGKXZ)
8>GraphicsEngine.lib(GFXEngine.obj) : error LNK2001: unresolved external symbol "extern "C" int __stdcall SetPixelFormat(struct HDC__ *,int,struct tagPIXELFORMATDESCRIPTOR const *)" (?SetPixelFormat@@$$J212YGHPAUHDC__@@HPBUtagPIXELFORMATDESCRIPTOR@@@Z)
8>GraphicsEngine.lib(GFXEngine.obj) : error LNK2001: unresolved external symbol "extern "C" int __stdcall ChoosePixelFormat(struct HDC__ *,struct tagPIXELFORMATDESCRIPTOR const *)" (?ChoosePixelFormat@@$$J18YGHPAUHDC__@@PBUtagPIXELFORMATDESCRIPTOR@@@Z)
8>GraphicsEngine.lib(GFXEngine.obj) : error LNK2001: unresolved external symbol "extern "C" int __stdcall SwapBuffers(struct HDC__ *)" (?SwapBuffers@@$$J14YGHPAUHDC__@@@Z)
[Edited by - stringa on April 27, 2009 2:01:14 PM]
As you can see, they are all my windows calls : 1 for timeGetTime and 3 for setting up and running openGL in a win32 window.
How can I fix this?
tia,
stringa
8>AIEngine.lib(Time.obj) : error LNK2001: unresolved external symbol "extern "C" unsigned long __stdcall timeGetTime(void)" (?timeGetTime@@$$J10YGKXZ)
8>GraphicsEngine.lib(GFXEngine.obj) : error LNK2001: unresolved external symbol "extern "C" int __stdcall SetPixelFormat(struct HDC__ *,int,struct tagPIXELFORMATDESCRIPTOR const *)" (?SetPixelFormat@@$$J212YGHPAUHDC__@@HPBUtagPIXELFORMATDESCRIPTOR@@@Z)
8>GraphicsEngine.lib(GFXEngine.obj) : error LNK2001: unresolved external symbol "extern "C" int __stdcall ChoosePixelFormat(struct HDC__ *,struct tagPIXELFORMATDESCRIPTOR const *)" (?ChoosePixelFormat@@$$J18YGHPAUHDC__@@PBUtagPIXELFORMATDESCRIPTOR@@@Z)
8>GraphicsEngine.lib(GFXEngine.obj) : error LNK2001: unresolved external symbol "extern "C" int __stdcall SwapBuffers(struct HDC__ *)" (?SwapBuffers@@$$J14YGHPAUHDC__@@@Z)
[Edited by - stringa on April 27, 2009 2:01:14 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement