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 Launch a Windows open file dialog without using the standard Delphi dialo 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
10-Oct-02
Category
Dialogs
Language
Delphi 2.x
Views
89
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius

Is there an API call or other to launch a Windows open file dialog without using 
the standard delphi dialog component? I call a function "Hooklock1" from:
1   
2   keyHook := SetWindowsHookEx(WH_KEYBOARD, HookLock1, HInstance, 0);

In this function no references to delphi global variables or components seem to 
work, I need to call an open dialog box to specify a filename. Any ideas?

Answer:
3   
4   procedure TForm1.OpenApiClick(Sender: TObject);
5   var
6     OpenFile: TOpenFileName;
7   begin
8     with OpenFile do
9     begin
10      lStructSize := SizeOf(TOpenFilename);
11      hInstance := SysInit.HInstance;
12      hWndOwner := {Application.} Handle;
13      lpstrFilter := 'Text Files (*.txt)' + Chr(0) + '*.txt' + Chr(0) + 
14  		'All Files (*.*)' + Chr(0) + '*.*' + Chr(0);
15      nFilterIndex := 1;
16      {create a buffer for the file}
17      nMaxFile := 255;
18      lpstrFile := PChar(StringOfChar(' ', nMaxFile - 1));
19      {create a buffer for the file title}
20      nMaxFileTitle := 255;
21      lpstrFileTitle := PChar(StringOfChar(' ', nMaxFileTitle - 1));
22      {set the initial directory}
23      lpstrInitialDir := 'C:\';
24      lpstrTitle := 'Open a file, please';
25      Flags := OFN_EXPLORER;
26    end;
27    if not GetOpenFileName(OpenFile) then
28      Exit;
29  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