FindWindow

hello,
i would to retreive the handel of window of ACROBAT for a PDF document and i don't know how to use FindWindow("?","?").
can you help me....
[159 byte] By [aguess] at [2007-11-18 1:48:25]
# 1 Re: FindWindow
this looks like a doozy.....

HWND hwndAdobe = FindWindow("Afx:400000:8:10011:0:1160325", "Acrobat Reader - [TIC2Vone.pdf]");

the second parameter you should probably set to NULL and use just the class name. i say it's a doozy because look at that class name, how odd. that's on my xp machine and acrobat reader 5.0 i dont know if that will still be the same class you obtain if you're using a different adobe version. use spy++ to find out
filthy_mcnasty at 2007-11-10 8:54:45 >
# 2 Re: FindWindow
how i must declared hwndAcrobat (long or DWORD)?because i have this message error whene i declared it as CString:

C:\New Folder\MSDev98\MyProjects\findwindo\findwindoDlg.cpp(100) : error C2440: 'initializing' : cannot convert from 'class CWnd *' to 'struct HWND__ *'
aguess at 2007-11-10 8:55:44 >
# 3 Re: FindWindow
Originally posted by aguess
how i must declared hwndAcrobat (long or DWORD)?because i have this message error whene i declared it as CString:


:confused: You have to declare it as 'HWND' as shown in the example...
Andreas Masur at 2007-11-10 8:56:41 >
# 4 Re: FindWindow
On line 100, try this:

CWnd *hwndAdobe = FindWindow("Afx:400000:8:10011:0:1160325", "Acrobat Reader");
if (!*hwndAdbobe){
MessageBox("Cannot find window!","Error!", MB_OK);
}
else{
MessageBox("Window Found!","YES!", MB_OK);
}
fritzy at 2007-11-10 8:57:46 >
# 5 Re: FindWindow
You will not be able to find acrobat window using FindWindow with class name, nor will you be able to find it using windows text unless Acrobat does not have open document.

Window class name is changing since is assigned on the fly by framework. Chances that you will get the same class for new Acrobat instance are close to none.

Windows title changes with open document, so you would have to compare only a beginning of windows title (two words). Then your chances that you find window are better.

The best but most time consuming would be using EnumWindows and WnumChildWindows to find if main window contains any child with AVL_AVView class. Acrobat has plenty of AVL_AVView class windows.
JohnCz at 2007-11-10 8:58:44 >