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

zsouthboy

Regular
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.

:(
 
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.
 
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.
 
CDialog::GetDescendantWindow is supposed to return an hwnd (says so in the autocomplete) but it returns a cwnd also.

:(
 
CDialog->GetSafeHwnd(), if you want to be a good boy.

CDialog->m_hWnd, if you want to live dangerously.
 
RussSchultz said:
CDialog->GetSafeHwnd(), if you want to be a good boy.

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

error C2819: type 'CDialog' does not have an overloaded member 'operator ->'
 
...MFC <shudder>

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