Autor Beitrag
Hack Gott
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 409

Windows Vista
Delphi 2005 Personal, Delphi 7
BeitragVerfasst: Mo 14.02.05 15:20 
Ich wollte gerne aus einem Delphi programm raus die windows suche starten. dabei sollte diese auch gleich nach einem bestimmten begriff suchen, wo ist denn sie exe an die diese paramenter übergeben werden müssen und wie sehen die paramenter aus?
OneOfTen
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 14.02.05 15:33 
www.blenk-software.d...dialog_aufrufen.html

hab ich spontan gefunden, einen eigenen Parameter kann man aber nicht angeben
Hack Gott Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 409

Windows Vista
Delphi 2005 Personal, Delphi 7
BeitragVerfasst: Mo 14.02.05 15:41 
Titel: Möglichkeitsform
Es müsste dann aber doch auch noch möglich sein den Suchbegriff zu ermitteln. Schließlich kann man auch den Ordner angeben in dem gesucht werden soll.
Harry M.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 754

Win 2000, XP
D2005
BeitragVerfasst: Mo 14.02.05 16:17 
habe ich mal bei den schweitzern gefunden:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
uses 
  DDEMan; 

procedure SearchInFolder(Folder: string); 
begin 
  with TDDEClientConv.Create(Self) do 
  begin 
    ConnectMode        := ddeManual; 
    ServiceApplication := 'Explorer.exe'; 
    SetLink('Folders', 'AppProperties'); 
    OpenLink; 
    ExecuteMacro(PChar('[FindFolder(, ' + Folder + ')]'), False); 
    CloseLink; 
    Free; 
  end; 
end; 

procedure TForm1.Button1Click(Sender: TObject); 
begin 
  SearchInFolder('c:\Windows'); 
end; 

{************************************} 

// Or even easier with ShellExecute: 

ShellExecute(Handle, 'find', 'C:\Windows', nil, nil, SW_SHOW); 

{************************************} 

// Suchen-Dialog ausführen und einen Suchstring übergeben: 

uses 
  ShellAPI; 

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;
und liegt jetzt auf meiner platte deshalb kein direktlink und weiß auchnicht ob 100%ig geht

gruß

Moderiert von user profile iconGausi: Code- durch Delphi-Tags ersetzt.