Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to jump to a certain key in Regedit Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
24-Feb-03
Category
Win API
Language
Delphi 6.x
Views
105
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Lou Adler 

How to jump to a certain key in Regedit?

Answer:

1   unit Unit1;
2   
3   interface
4   
5   uses
6     Windows, Messages, Classes, Controls, Forms, StdCtrls;
7   
8   type
9     TForm1 = class(TForm)
10      Button1: TButton;
11      procedure Button1Click(Sender: TObject);
12      procedure JumpToKey(Key: string);
13    private
14      { Private declarations }
15    public
16      { Public declarations }
17    end;
18  
19  var
20    Form1: TForm1;
21  
22  implementation
23  
24  {$R *.dfm}
25  
26  uses
27    ShellAPI;
28  
29  procedure TForm1.JumpToKey(Key: string);
30  var
31    i, n: Integer;
32    hWin: HWND;
33    ExecInfo: ShellExecuteInfoA;
34  begin
35    hWin := FindWindowA(PChar('RegEdit_RegEdit'), nil);
36    if hWin = 0 then
37      {if Regedit doesn't run then we launch it}
38    begin
39      FillChar(ExecInfo, 60, #0);
40      with ExecInfo do
41      begin
42        cbSize := 60;
43        fMask := SEE_MASK_NOCLOSEPROCESS;
44        lpVerb := PChar('open');
45        lpFile := PChar('regedit.exe');
46        nShow := 1;
47      end;
48      ShellExecuteExA(@ExecInfo);
49      WaitForInputIdle(ExecInfo.hProcess, 200);
50      hWin := FindWindowA(PChar('RegEdit_RegEdit'), nil);
51    end;
52    ShowWindow(hWin, SW_SHOWNORMAL);
53    hWin := FindWindowExA(hWin, 0, PChar('SysTreeView32'), nil);
54    SetForegroundWindow(hWin);
55    i := 30;
56    repeat
57      SendMessageA(hWin, WM_KEYDOWN, VK_LEFT, 0);
58      Dec(i);
59    until i = 0;
60    Sleep(500);
61    SendMessageA(hWin, WM_KEYDOWN, VK_RIGHT, 0);
62    Sleep(500);
63    i := 1;
64    n := Length(Key);
65    repeat
66      if Key[i] = '\' then
67      begin
68        SendMessageA(hWin, WM_KEYDOWN, VK_RIGHT, 0);
69        Sleep(500);
70      end
71      else
72        SendMessageA(hWin, WM_CHAR, Integer(Key[i]), 0);
73      i := i + 1;
74    until i = n;
75  end;
76  
77  procedure TForm1.Button1Click(Sender: TObject);
78  begin
79    JumpToKey('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer');
80  end;
81  
82  end.



			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC