FindWindow
-
Hi, I want to get handle of an already opened window. For this I can not use FindWindow() API as Window's title is not known. And also, I can not use Class name as it is not a registered class. Can anybody tell me how to solve this issue? Thanks in advance. Regards MSR
-
Hi, I want to get handle of an already opened window. For this I can not use FindWindow() API as Window's title is not known. And also, I can not use Class name as it is not a registered class. Can anybody tell me how to solve this issue? Thanks in advance. Regards MSR
As far as I know, every window must belong to a registered class.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
As far as I know, every window must belong to a registered class.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]Hi, thanks for the reply. But here we are not regidtering class explicitly. This is the code
CDlg* pDlg = new CDlg;
DialogBoxParam(hInt, MAKEINTRESOURCE(IDD_DLG),
hWnd, (DLGPROC)(*pDlg ).WindowMapProc, (LPARAM)pDlg);I have tried using
FindWindow("CDlg", NULL);
But it is not working. Now , how to go forward to find IDD_DLG. Regards MSR
-
Hi, thanks for the reply. But here we are not regidtering class explicitly. This is the code
CDlg* pDlg = new CDlg;
DialogBoxParam(hInt, MAKEINTRESOURCE(IDD_DLG),
hWnd, (DLGPROC)(*pDlg ).WindowMapProc, (LPARAM)pDlg);I have tried using
FindWindow("CDlg", NULL);
But it is not working. Now , how to go forward to find IDD_DLG. Regards MSR
Your windows is child of the
hWnd
one and as such must be searched for.If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Hi, thanks for the reply. But here we are not regidtering class explicitly. This is the code
CDlg* pDlg = new CDlg;
DialogBoxParam(hInt, MAKEINTRESOURCE(IDD_DLG),
hWnd, (DLGPROC)(*pDlg ).WindowMapProc, (LPARAM)pDlg);I have tried using
FindWindow("CDlg", NULL);
But it is not working. Now , how to go forward to find IDD_DLG. Regards MSR
CDlg
is the class which creates the dialog window and must use some Windows classname, either one of the predefined classes, or a new one registered before creation. What is the base ofCDlg
? [edit]It is also likely that the dialog will contain a title that you can search for.[/edit]Unrequited desire is character building. OriginalGriff
-
Hi, I want to get handle of an already opened window. For this I can not use FindWindow() API as Window's title is not known. And also, I can not use Class name as it is not a registered class. Can anybody tell me how to solve this issue? Thanks in advance. Regards MSR
Use WindowFromPoint Api if you know approx location in x,y cords this returns handle e.g.
[DllImport("user32.dll")]
static extern IntPtr WindowFromPoint(POINT Point);The trick is making sure unknown application starts in a known place. Regards David Rathbone
-
CDlg
is the class which creates the dialog window and must use some Windows classname, either one of the predefined classes, or a new one registered before creation. What is the base ofCDlg
? [edit]It is also likely that the dialog will contain a title that you can search for.[/edit]Unrequited desire is character building. OriginalGriff
The
DialogBoxParam
function automatically assigns the predefined class name "#32770"
(i.e. dialog box, see here[^]) to the newly created dialog.If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Use WindowFromPoint Api if you know approx location in x,y cords this returns handle e.g.
[DllImport("user32.dll")]
static extern IntPtr WindowFromPoint(POINT Point);The trick is making sure unknown application starts in a known place. Regards David Rathbone
Not to mention it musn't be covered by any other window...i doubt this method would be reliable.
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > If it doesn't matter, it's antimatter.<
-
The
DialogBoxParam
function automatically assigns the predefined class name "#32770"
(i.e. dialog box, see here[^]) to the newly created dialog.If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]I think the OP would like to know this. ;)
Unrequited desire is character building. OriginalGriff
-
I think the OP would like to know this. ;)
Unrequited desire is character building. OriginalGriff
So let he/she know. :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
CDlg
is the class which creates the dialog window and must use some Windows classname, either one of the predefined classes, or a new one registered before creation. What is the base ofCDlg
? [edit]It is also likely that the dialog will contain a title that you can search for.[/edit]Unrequited desire is character building. OriginalGriff
Hi, CDlg is derived from CDlgSlct. I have tried using the base class also. But of no use. Regards MSR
-
Hi, CDlg is derived from CDlgSlct. I have tried using the base class also. But of no use. Regards MSR
And what is
CDlgSlct
derived from? You should know and understand your inheritance tree. In either case see the message from CPallini which tells you what identifier to use for the Dialog windows class.Unrequited desire is character building. OriginalGriff
-
Hi, CDlg is derived from CDlgSlct. I have tried using the base class also. But of no use. Regards MSR
Just to be clear, a C++ class should not be confused with a windows class. Use Spy++, it will tell you the (windows) class name of any window you care to query. Do this to a dialog, and you'll see the name that cPallini provided - the same class-name that you should use with FindWindow. To that end, which C++ class you inherit from is somewhat irrelevant. You just need the windows class name for a dialog box.
-
Your windows is child of the
hWnd
one and as such must be searched for.If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]Use EnumWindows EnumChildWindows and look for #32778 class name use the SPY++ to test it Mithrill :-\