Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1009
  • Last Modified:

Getting HWnd instance of Parent

Hi All,

I have HWND instance of a Dialog. Now I wanted to get the HWND instance of the parent. How can I get it??

Thanks
Sudhakar
0
sudhakar_koundinya
Asked:
sudhakar_koundinya
  • 2
  • 2
2 Solutions
 
AlexFMCommented:
HWND hParent = ::GetParent(hwnd);
0
 
sudhakar_koundinyaAuthor Commented:
Ok thanks

Just one more question

can I get Dlg Id like this??
GetDlgCtrlID(hDlg)
0
 
AlexFMCommented:
Using GetDlgCtrlID you can get dialog control ID and not dialog ID. Why do you need dialog ID? It is not used in any function.
Every MFC CDialog-derived class has dialog resource ID which looks this this:
enum { IDD = IDD_DIALOG1 };    // see this line in dialog h-file

You van use IDD to get dialog resource ID (though I don't know where it may be used).
0
 
sudhakar_koundinyaAuthor Commented:
Ok I am accessing the dialogs of Microsoft Outlook using my application.

Using FindWindow I can access the dialogs. But the problem is Main Window will be in hidden mode. So to Work with Window Messages on that Dialog, I am thinking that I need to have Parent Window Instance also. That is the reason I am asking this question

Thanks
Sudhakar
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now