AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Win32/Win64 API (native code) Delphi Change text of other App Edit Control
Thema durchsuchen
Ansicht
Themen-Optionen

Change text of other App Edit Control

Ein Thema von Razor · begonnen am 4. Okt 2009 · letzter Beitrag vom 4. Okt 2009
Thema geschlossen
Razor
(Gast)

n/a Beiträge
 
#1

Re: Change text of other App Edit Control

  Alt 4. Okt 2009, 13:37
Question is: Why dosen't this work under win 7/vista?Please someone test it!
It only opens the dialog i knew how to do that on my own.So nothing new.

Delphi-Quellcode:
uses
  ShellAPI,ddeman;

 
procedure WindowsSuchenDialog(Verzeichnis, Suchstring: string);
var
  hOtherWin, hFocusWin: HWND;
  OtherThreadID, iTimeOut: Integer;
  aDwordVar: DWORD;
  buf: array [0..40] of Char;
  sVerz: string;
begin
  // ShellExecute(application.handle, 'find', 'c:\', nil, nil, SW_SHOWNORMAL);
  // oder mit TDDEClientConv
  with TDDEClientConv.Create(nil) do
  begin
    ConnectMode := ddeManual;
    ServiceApplication := 'explorer.exe';
    SetLink('Folders', 'AppProperties');
    OpenLink;
    sVerz := IncludeTrailingBackslash(Verzeichnis);
    ExecuteMacro(PChar('[FindFolder(, '+ sVerz +')]'), False);
    CloseLink;
    Free;
  end;
  iTimeOut := 0;
  repeat
    { Warten, bis der Such Dialog erscheint. 
      Unter Win95/98/NT4 hat der Suchdilaog die Klasse #32770. 
      Unter ME/2000/XP ist die Suche in den Explorer integriert, 
      darum auf CabinetWClass warten}
   
    Sleep(100);
    hOtherWin := GetForegroundWindow;
    buf[0] := #0;
    GetClassName(hOtherWin, buf, 60);
    inc(iTimeOut);
  until (StrComp(buf, '#32770') = 0) or (StrComp(buf, 'CabinetWClass') = 0) or (iTimeOut > 20);
  if iTimeOut > 20 then Exit;
  repeat
    { Wait until it is visible }   
    { Warten, bis das Fenster erscheint }   
    Sleep(100);
  until IsWindowVisible(hOtherWin);

 
  { Handle vom Control finden, welches den Fokus besitzt }   
  OtherThreadID := GetWindowThreadProcessID(hOtherWin, @aDwordvar);
  if AttachThreadInput(GetCurrentThreadID, OtherThreadID, True) then
  begin
    hFocusWin := GetFocus;
    if hFocusWin <> 0 then
      try
        SendMessage(hFocusWin, WM_SETTEXT, 0, Longint(PChar(Suchstring)));
      finally
        AttachThreadInput(GetCurrentThreadID, OtherThreadID, False);
      end;
  end;
end;

 
procedure TForm1.Button1Click(Sender: TObject);
begin
  WindowsSuchenDialog('c:\temp','test.txt');
end;

Offtopic comment:@ DeddyH and others > Delphipraxis will be delphipraxis unique in its own weird bizzaree way.
 
Thema geschlossen


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:32 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz