Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi FindWindowEx (https://www.delphipraxis.net/119083-findwindowex.html)

stOrM 20. Aug 2008 20:27


FindWindowEx
 
Hallo, ich hab grad ein komisches Problem mit FindWindowEx...

Mittels dem schönen Tool EnDisable wird mir angezeigt, das es sich in Firefox, sowie auch im IE im "Bild speichern Dialog", da wo der Filename drin steht, es sich um eine Combobox handelt.

Demnach versuche ich gerade den Text daraus zu kopieren:

Delphi-Quellcode:
 var
   wndApp, wndCombo1, wndCombo2, WndCombo3, wndEdit: HWND;
   FPath,
   FFilename : array [0..255] of char;
begin
 wndApp := FindWindow(nil, 'Grafik speichern');
 wndCombo1 := FindWindowEx(wndapp, 0, 'Combobox', nil);
 wndCombo2 := FindWindowEx(wndapp, wndCombo1, 'Combobox', nil);
 WndCombo3 := FindWindowEx(wndapp, wndCombo2, 'Combobox', nil);   // Filename ???????

  SendMessage(WndCombo3, WM_GETTEXT,
               SizeOf(FPath), integer(@FPath)) ;
  ShowMessage(FPath);
Seltsam ist, es wird nie der Filename zurückgegeben wasn hier jetzt falsch? Ich seh ma wieder den Wald vor lauter Bäumen nich :-(

Viele Grüße
s!

taaktaak 20. Aug 2008 20:35

Re: FindWindowEx
 
[OT]
Man möge es mir verzeihen, aber ...
Der Dativ ist dem Genitiv sein Tod!
[/OT]

toms 20. Aug 2008 20:46

Re: FindWindowEx
 
Hallo

Die ComboBox besitzt ein Edit Feld als Childwindow welches auch den Text enthält.

Habe mit WinSpy diesen Code erzeugen lassen (IE8)


Delphi-Quellcode:
var
  wndMain, wndChild: HWND;
begin
  wndMain := FindWindow('#32770','Save Picture');
  if wndMain <> 0 then
  begin
    wndChild := FindWindowEx(wndMain, 0, 'ComboBoxEx32', nil);
    wndChild := FindWindowEx(wndChild, 0, 'ComboBox', nil);
    wndChild := FindWindowEx(wndChild, 0, 'Edit', nil);
    if wndChild <> 0 then
    begin
      // Text auslesen..
    end;
  end;
end;

stOrM 20. Aug 2008 20:54

Re: FindWindowEx
 
Optimal funzt!

Öhm wegen dat Dativ, iss der verziehen :-)

taaktaak 20. Aug 2008 21:08

Re: FindWindowEx
 
Na logisch!
Das sieht so lustig aus, da musste ich das einfach mal 'rauslassen
- sorry :hi:


Alle Zeitangaben in WEZ +1. Es ist jetzt 15:35 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz