Save as boxes
Hey, how do I make it so when a save as box open there will be a file already in the edit box? I've got the default path but I can't get the song name to show up.
So to set the defualt path I've done:
ofn.lpstrInitialDir = "c:\\Folder";
but when I go
ofn.lpstrFileTitle = "File";
it doesn't work. I think this is the right member but I'm not sure. Can someone tell me what I'm doing wrong?
Looking at VC++ help-file, I gather you should use lpstrFile, not lpstrFileTitle. lpstrFileTitle
is used to receive the file that they selected.
Points to a buffer that contains a filename used to initialize the File Name edit control. The first character of this buffer must be NULL if initialization is not necessary. When the GetOpenFileName or GetSaveFileName function returns, this buffer contains the drive designator, path, filename, and extension of the selected file.
If the buffer is too small, the dialog box procedure copies the required size into this member.
Points to a buffer that receives the title of the selected file. For Windows versions 3.0 and 3.1, this buffer receives the filename and extension without path information. The application should use this string to display the file title. If this member is NULL, the function does not copy the file title. "
Well when i use lpstrFile the program crashes and szFileName is what recieves the file the user selected.
lpstrFile is a pointer, so when you write to it you'll crash your program.
szFileName is what receives the file name... but how about you do what most programmers do and experiment with it. What i'm saying is that it is also a way for you to write data to the edit box in the save dialog.