a question about types

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • GAEL

    #1

    a question about types

    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_strW indowTitle,
    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++?
  • Daniel O'Connell

    #2
    Re: a question about types


    "GAEL" <anonymous@disc ussions.microso ft.com> wrote in message
    news:09c101c3c9 be$2a69c590$a00 1280a@phx.gbl.. .[color=blue]
    > 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_strW indowTitle,
    > 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++?[/color]

    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.


    Comment

    Working...