LB Booster
General >> General Board >> Help needed with "..\"
http://lbb.conforums.com/index.cgi?board=general&action=display&num=1434096272

Help needed with "..\"
Post by SarmedNafi on Jun 12th, 2015, 08:04am

Dear Richard,

Help please,
In the following code:

Code:

[new] 'Creates a new data base
    'create a One level up directory called Blue_Mountain_Accounts 
    result = mkdir( "..\Blue_Mountain_Accounts\")   '...up level Dir works under LBB and LB
    filedialog "Choose A Place To Save A New DataBase ",_
     "..\Blue_Mountain_Accounts\*.dta", pathdbname$  '...up level Dir not work under LBB but works under LB
    if pathdbname$ = "" then Goto wait
wait

 


The up level directory works with "mkdir" under both LBB and LB
But it dose not work under LBB with file dialog.
How could I solve this problem?

Regards
Sarmed

Re: Help needed with "..\"
Post by Richard Russell on Jun 12th, 2015, 10:08am

on Jun 12th, 2015, 08:04am, SarmedNafi wrote:
How could I solve this problem?

I'm not sure that this 'problem' is the fault of LBB. In recent versions of Windows Microsoft has changed the rules governing which directory is initially displayed in a file dialog. Look at this MSDN page and read the section entitled lpstrInitialDir:

https://msdn.microsoft.com/en-us/library/windows/desktop/ms646839.aspx

Now scroll down to the Community Additions section of the page and read the first comment, which begins "This is ridiculous"!

This is the only straightforward workaround I can offer:

Code:
    result = mkdir( "..\Blue_Mountain_Accounts\")
    template$ = space$(_MAX_PATH)
    calldll #kernel32, "GetFullPathNameA", _
      "..\Blue_Mountain_Accounts\*.dta" as ptr, _MAX_PATH as long, _
      template$ as ptr, _NULL as long, ret as long 
    filedialog "Choose A Place To Save A New DataBase ",_
      template$, pathdbname$
    wait 

Richard.
Re: Help needed with "..\"
Post by SarmedNafi on Jun 12th, 2015, 10:47am

Thank you Richard,

Your help is great, you know? I was going to write a function to do that.
Because in what I am doing I got a "One ticket to the moon". I got no way to go back!
However this must be added to LBB help file, actually this con forum is an extension to LBB help file.

All the best to you,
Sarmed