a question about types

G

GAEL

I am creating an unmanaged Diretcx 9 application but I
want to integrate it to my managed c++ application.

Here is the problem:
I dont want to use
m_hWnd = CreateWindow( _T("D3D Window"),m_strWindowTitle,
m_dwWindowStyle, CW_USEDEFAULT, (rc.right-rc.left),
(rc.bottom-rc.top), 0,LoadMenu( hInstance, MAKEINTRESOURCE
(IDR_MENU) ), hInstance, 0 );
to create my window.

I just use the windows Form designer.

but to create my device, I need a window handle of type
HWND.

how can I retrieve this type (HWND) from my form Form1
(this)?
this->Handle returns me an object of type System::IntPtr

How can I convert (if possible) IntPtr to HWND in
(managed) c++?
 
D

Daniel O'Connell

GAEL said:
I am creating an unmanaged Diretcx 9 application but I
want to integrate it to my managed c++ application.

Here is the problem:
I dont want to use
m_hWnd = CreateWindow( _T("D3D Window"),m_strWindowTitle,
m_dwWindowStyle, CW_USEDEFAULT, (rc.right-rc.left),
(rc.bottom-rc.top), 0,LoadMenu( hInstance, MAKEINTRESOURCE
(IDR_MENU) ), hInstance, 0 );
to create my window.

I just use the windows Form designer.

but to create my device, I need a window handle of type
HWND.

how can I retrieve this type (HWND) from my form Form1
(this)?
this->Handle returns me an object of type System::IntPtr

How can I convert (if possible) IntPtr to HWND in
(managed) c++?

The IntPtr returned should be equal to the HWND you want. IntPtr is a hold
all for pointers and handles because its size is determined by the system
you are executing on(4 bytes for 32bit, 8bytes for 64bit). Without testing,
HWND m_HWND = this->Handle; should work.
 

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