Thread: Problems with open and save boxes

  1. #1
    Registered User
    Join Date
    Mar 2002

    Problems with open and save boxes

    I'm having some problems with open and save boxes. Every time I open the open box and click open my program goes all screwed up. After the first time a open box is opened I have problems with my directories.

    My code for the open box below opens a mp3
    	char szFileName[MAX_PATH] = "";
    	ZeroMemory(&ofn, sizeof(ofn));
    	ofn.lStructSize = sizeof(ofn);
    	ofn.hwndOwner = NULL;
    	ofn.lpstrFilter = "MP3 Files (*.mp3)\0*.mp3\0All Files (*.*)\0*.*\0";
    	ofn.lpstrFile = szFileName;
    	ofn.nMaxFile = MAX_PATH;
    	ofn.Flags = OFN_FILEMUSTEXIST;
    	ofn.lpstrDefExt = "mp3";
    	ofn.lpstrInitialDir = "Downloaded Music";
    		ShellExecute(hwnd, "open", ofn.lpstrFile, NULL, NULL, SW_MINIMIZE);
    I also have some code that opens the directory with all the mp3s but after I've opened the mp3 with the code above it won't work anymore. The code to open the folder is below.
    	ShellExecute(hwnd, "explore", "Downloaded Music", NULL, NULL, SW_MAXIMIZE);
    I don't know why its doing this but I know it messes up the directories, because other stuff also doesn't work properly after using the mp3 launcher.

  2. #2
    train spotter
    Join Date
    Aug 2001
    near a computer

    Passing in a valid HWND. I have had problems with modality if I use non valid HWND.

    Set the init folder to "." or".//Downloaded Music"

    Set the file name to "*.mp3"

    Terminate the filter with two end of lines ie\0\0

    Make sure your mp3 have an 'open' command (right click on one and see if 'open' is a choice. If not use 'play' (?)

    You are suppling the file name but not the correct folder to the ShellExecute() as the mp3 comes from the "./downloaded music" folder.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    Registered User
    Join Date
    Mar 2002
    hmm... I'll try all that stuff tommorow but I'm going to go to bed now. Thanks.

  4. #4
    Registered User
    Join Date
    Mar 2002
    Figured it out, never mind.
    Last edited by pinkcheese; 05-21-2002 at 07:09 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Open Save and Print (Windows Form)
    By MaGaIn in forum C# Programming
    Replies: 1
    Last Post: 02-24-2008, 07:05 AM
  2. save and save as functions
    By willc0de4food in forum Windows Programming
    Replies: 2
    Last Post: 06-29-2005, 02:49 AM
  3. Can't open save File!!
    By WackoWolf in forum C++ Programming
    Replies: 2
    Last Post: 11-14-2004, 10:39 AM
  4. Save as boxes
    By pinkcheese in forum Windows Programming
    Replies: 4
    Last Post: 04-10-2002, 11:16 PM
  5. Replies: 1
    Last Post: 11-23-2001, 10:01 AM