Results 1 to 3 of 3

Thread: GetOpenFileName

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2001
    Location
    Québec, Canada
    Posts
    131

    GetOpenFileName

    Hello,
    I have a program that use GetOpenFileName API to play a song. It works well until the user try to open a second song, the program bug. I run my program in debugger mode and figure out that it bug when he gets to GetOpenFileName.

    Here's my code:
    PHP Code:
    OPENFILENAME ofn;
    char szFileName[MAX_PATH] = "";

    ZeroMemory(&ofnsizeof(ofn));

    ofn.lStructSize sizeof(ofn);
    ofn.hwndOwner hWnd;
    ofn.lpstrFilter "Text Files (*.wav)\0*.wav\0All Files (*.*)\0*.*\0";
    ofn.lpstrFile szFileName;
    ofn.nMaxFile MAX_PATH;
    ofn.Flags EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY;


    GetOpenFileName(&ofn); 
    Does someone knows why it bugs?
    Khavoerm Irithyl

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    I see some typos, but I don't see any failure that would cause it to crash the second time it runs... Maybe if you submit the whole thing...
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3
    Addicted Member
    Join Date
    Nov 2001
    Posts
    163
    dim pOpenfilename as OPENFILENAME
    const MAX_BUFFER_LENGTH=256


    WITH pOpenfilename
    .hwndOwner=hwnd
    .hInstance=App.hInstance
    .lpstrFile=String(MAX_BUFFER_LENGTH,0)
    .nMaxFile=MAX_BUFFER_LENGTH-1
    .nMaxFileTitle=MAX_BUFFER_LENGTH-1
    .lstructSize=len(pOpenfilename)
    end with


    I think it will work
    Purushottam

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width