file selector in windows application - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

file selector in windows application

Hi there!

After spending almost 2 hour browsing the net searching for
anything that wold solve my problem I decided to ask big
brains for help. ;o)

Anyone can help me with these windows dialogs? I need to put
a simple file requester into my program.

I believe it's easy. But I've just started. I will thankfuly
accept any ideas or suggestions.

Reunion


Comments

  • AsmGuru62AsmGuru62 Posts: 6,519Member
    : Hi there!
    :
    : After spending almost 2 hour browsing the net searching for
    : anything that wold solve my problem I decided to ask big
    : brains for help. ;o)
    :
    : Anyone can help me with these windows dialogs? I need to put
    : a simple file requester into my program.
    :
    : I believe it's easy. But I've just started. I will thankfuly
    : accept any ideas or suggestions.
    :
    : Reunion
    :
    :

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/hh/winui/commdlg3_3cbp.asp



  • SephirothSephiroth Fayetteville, NC, USAPosts: 1,035Member
    And if that doesn't help, try this code out:
    [code]
    char filebuffer[256];
    OPENFILENAME ofn;

    ofn.lStructSize = sizeof(OPENFILENAME);
    ofn.hwndOwner = ParenthWnd; //Parent window handle!
    ofn.lpstrFilter = "Text Files*.TXTAll Files*.*";
    ofn.nFilterIndex = 1;
    ofn.lpstrFile = filebuffer;
    ofn.nMaxFile = sizeof(filebuffer);
    ofn.lpstrInitialDir = "C:\Windows";
    ofn.lpstrTitle = "My Open Dialog!";
    ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_NOCHANGEDIR | OFN_NONETWORKBUTTON | OFN_PATHMUSTEXIST;

    if(GetOpenFileName(&ofn) == NULL)
    {
    //Handle CANCEL or errors here
    }

    //Now filbuffer contains the full drive, path, and filename of the file you selected!
    [/code]
    If you have any questions, feel free to ask.

    -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red]


  • reunionreunion Posts: 12Member
    Many thanks to both of you guys ;o)

    I finaly got IT!

    take care

    Reunion

Sign In or Register to comment.