Please don't laugh... how to get the HWND handle of...

Discussion in 'PC Hardware, Software and Displays' started by zsouthboy, Oct 9, 2003.

  1. zsouthboy

    Regular

    Joined:
    Aug 1, 2003
    Messages:
    563
    Likes Received:
    9
    Location:
    Derry, NH
    My OWN FRICKING DIALOG BOX?

    Used MFC to create a dialog application.

    Need an HWND handle to modify something(transparency)...

    Cannot, for the life of me, figure out how to get it. Checked google, checked books.. none of them cover it. Its something really simple, right? I just overlooked it, right?

    ARGH.

    Even tried looking for source of dialog applications that somewhere use their own hWnd.. nothing.

    :(
     
  2. Saem

    Veteran

    Joined:
    Feb 7, 2002
    Messages:
    1,532
    Likes Received:
    6
    If you're using MFC, just check out methods inherited from CDialog. I think there is a set transparency in there. Additionally, for getting the handle, isn't there a Get method of some sort? If you're using Visual C++ just use the autocompletion to rapidly browse through the methods.
     
  3. zsouthboy

    Regular

    Joined:
    Aug 1, 2003
    Messages:
    563
    Likes Received:
    9
    Location:
    Derry, NH
    I've played with the Get methods in CDialog, all of them return a Cwnd

    : cannot convert from 'class CWnd *' to 'struct HWND__ *'

    I'll look for the set transparency thing.
     
  4. zsouthboy

    Regular

    Joined:
    Aug 1, 2003
    Messages:
    563
    Likes Received:
    9
    Location:
    Derry, NH
    CDialog::GetDescendantWindow is supposed to return an hwnd (says so in the autocomplete) but it returns a cwnd also.

    :(
     
  5. RussSchultz

    RussSchultz Professional Malcontent
    Veteran

    Joined:
    Feb 6, 2002
    Messages:
    2,855
    Likes Received:
    55
    Location:
    HTTP 404
    CDialog->GetSafeHwnd(), if you want to be a good boy.

    CDialog->m_hWnd, if you want to live dangerously.
     
  6. zsouthboy

    Regular

    Joined:
    Aug 1, 2003
    Messages:
    563
    Likes Received:
    9
    Location:
    Derry, NH
    error C2819: type 'CDialog' does not have an overloaded member 'operator ->'
     
  7. RussSchultz

    RussSchultz Professional Malcontent
    Veteran

    Joined:
    Feb 6, 2002
    Messages:
    2,855
    Likes Received:
    55
    Location:
    HTTP 404
    Err....

    Try it without the CDialog-> part.
     
  8. zsouthboy

    Regular

    Joined:
    Aug 1, 2003
    Messages:
    563
    Likes Received:
    9
    Location:
    Derry, NH
    durr... i shoulda seen that.

    thanks! thats it!

    :)
     
  9. Tokelil

    Regular

    Joined:
    Mar 27, 2002
    Messages:
    329
    Likes Received:
    0
    Location:
    Denmark
    You can get the HWND from all CWnd classes from the m_hWnd member variable.
     
  10. SIMD

    Newcomer

    Joined:
    Oct 13, 2003
    Messages:
    2
    Likes Received:
    0
    ...MFC <shudder>

    If you're not writing something scientific switch to a RAD development IDE like Delphi or use .NET's form building tools
     
Loading...

Share This Page

  • About Us

    Beyond3D has been around for over a decade and prides itself on being the best place on the web for in-depth, technically-driven discussion and analysis of 3D graphics hardware. If you love pixels and transistors, you've come to the right place!

    Beyond3D is proudly published by GPU Tools Ltd.
Loading...