delphi - GetDir in Delphi2010 not working under Windows 7? -
i have following sequence of commands in delphi2010:
  var netdir:string;   ....   opendialog1.initialdir:=netdir;   ....   opendialog1.execute...   ....   getdir(0,netdir);   ....   after executing opendialog should have in string netdir directory finished opendialog.execute. , in next opendialog.execute should start directory. works fine on xp, not on windows 7? starts directory program installed.
any idea might wrong?
thanks.
your question cannot answered stands, because lacks several crucial details.
- is 
netdirglobal constant, or go out of scope every , then? - do set 
netdirprioropendialog1.execute? - is question directory 
getdirreturn (as title suggests), or how make open dialog remember last visited directory (as body matter suggests)? 
i assume 1) netdir global constant, 2) not set initially, , 3) want open dialog remember last visited folder. have like
unit unit3;  interface  uses   windows, messages, sysutils, variants, classes, graphics, controls, forms,   dialogs;  type   tform3 = class(tform)     opendialog1: topendialog;     procedure formclick(sender: tobject);   private     { private declarations }   public     { public declarations }   end;  var   form3: tform3;  var   netdir: string;  implementation  {$r *.dfm}  procedure tform3.formclick(sender: tobject); begin   opendialog1.initialdir := netdir;   opendialog1.execute;   getdir(0, netdir); end;  end.   then solution let windows remember directory you, is, do
procedure tform3.formclick(sender: tobject); begin   opendialog1.execute; end;   alone! why doesn't method work? well, getdir doesn't return want. if need explicit control, do
procedure tform3.formclick(sender: tobject); begin   opendialog1.initialdir := netdir;   opendialog1.execute;   netdir := extractfilepath(opendialog1.filename) end;      
Comments
Post a Comment