Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
EditParent.OpenDlg.InitialDir := EditParent.FDefaultDir;
 EditParent.OpenDlg.FileName := EditParent.FFileName;

  EditParent.OpenDlg.Execute

This is my code to open file dialog in delphi. problem is window is open but it is at background of other windows of my application itself. I am new in delphi Please help which property should i use. Delphi version 5

What I have tried:

<pre> EditParent.OpenDlg.InitialDir := EditParent.FDefaultDir;
  EditParent.OpenDlg.FileName := EditParent.FFileName;

   EditParent.OpenDlg.Execute 


I am using OpenDialog in Delphi 5. My problem is it opens at the back of My Application forms. I set My application form at the TOP using following code
if UpperCase(SmSession.ApplicationName) = 'MYAPP' then
begin
  Params.ExStyle := Params.ExStyle or WS_EX_TOPMOST;
  exit;
end
, so the windows dialog box might be at the back. How can I take it to front without changing my application forms code ?

This is my code to openDialog:

EditParent.OpenDlg.InitialDir := EditParent.FDefaultDir;
EditParent.OpenDlg.FileName := EditParent.FFileName;

if EditParent.OpenDlg.Execute then
Begin
  SplitFileDir(EditParent.OpenDlg.FileName, TmpDir, TmpFile);
  if EditParent.ShowOnlyFileName then
    EditParent.FileName := TmpFile
  else
    EditParent.FileName := EditParent.OpenDlg.FileName;
  EditParent.Directory := TmpDir;
  EditParent.SetPeerDirectoryBrowser;
End;
EditParent.OpenDlg.Free;
inherited Click;
end;
Posted
Updated 16-Jan-17 1:53am
v4
Comments
Kishor-KW 15-Jan-17 23:05pm    
Please Answer.. If question is not proper then plz ask.
JonPoley3 16-Jan-17 7:06am    
Hi,

do you have any other modal windows open? Or is a window set to stay on top?

Jon
Kishor-KW 16-Jan-17 7:49am    
yes my application window is set to top using following code:

if UpperCase(SmSession.ApplicationName) = 'MYAPP' then
begin
Params.ExStyle := Params.ExStyle or WS_EX_TOPMOST;
exit;
end
Kishor-KW 16-Jan-17 22:54pm    
SetWindowPos(EditParent.OpenDlg.Handle,HWND_TOPMOST,0,0,0,0,SWP_NOZORDER); I tried this one but it is not working
Kishor-KW 18-Jan-17 7:37am    
I have applied Params.ExStyle := Params.ExStyle or WS_EX_TOPMOST; WS_EX_TOPMOST style to form at the of Form creation. I want to change it,after creation to set it at background. is there any way for this. –

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900