You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
Set ofn.InitialDir to the address of any fixed length string that contains a valid directory path, and that will be where the Open File Dialog Box opens...
Local szBuffer As Asciiz*256
szBuffer="C:\Documents And Settings\User\MyDocuments"
ofn.InitialDir=Varptr(szBuffer)
etc.
There are equates for the length of the buffer that can be used such as %MAX_PATH. Here is a tutorial on the open file dialog box...
Bernard, can you expand on what you meant by "WorkPlace"? (Do you mean the current working folder? and NOT what M$ thinks is "CurDir"???) sort of thing.??
Engineer's Motto: If it aint broke take it apart and fix it
"If at 1st you don't succeed... call it version 1.0"
"Half of Programming is coding"....."The other 90% is DEBUGGING"
"Document my code????" .... "WHYYY??? do you think they call it CODE? "
szBuffer="C:\Documents And Settings\User\MyDocuments"
RIGHT:
Code:
LOCAL szBuffer AS ASCIIZ * %MAX_PATH, iret AS LONG
iRet = getSpecialFolderLocation BYVAL %NULL, %CSIDL_PERSONAL, BYVAL %NULL, %SHGFP_TYPE_CURRENT, szBuffer
IF iRet = %S_OK THEN
szBUffer contains path for this user's "My Documents" folder
ELSE
error handler...
My point was you should not hard-code a literal value for these special folders, since A) the name varies based on the user's language and B) they are moveable.
Moot if this application (not described) runs only on specific computers, but still a good habit to acquire.
Here's a little program that dumps all the environment variables. Some of them contain useful 'informationen uber den arbeitsplatz'!
Code:
#Compile Exe
#Dim All
Function PBMain () As Long
Local strData As String
Register i As Long
Console Set Screen 80,200
Do
Incr i
strData=Environ$(i)
Print Left$(strData,200)
Loop While Len(strData)
Waitkey$
PBMain=0
End Function
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment