Standard Load/Save Window.

Standard Load/Save Window.

GetOpenFileName,GetSaveFileName

See version :

Pas de dépendances

Download :

#include <windows.h>
#include <tchar.h>
#include <stdio.h>

void convert_multiple(TCHAR* buf)
{
    int i;
    for(i=0;;i++)
    {
        if (buf[i]=='\0')
        {
            buf[i] = '\n';
            if (buf[i+1]=='\0')
                break;
        }
    }
}

int main()
{
    int res;
    OPENFILENAME ofn;
    TCHAR tmp[1024] ;
    tmp[0]= '\0' ;
    ZeroMemory ( &ofn , sizeof ( OPENFILENAMEW ) );
    ofn.lStructSize = sizeof ( OPENFILENAMEW );
    ofn.lpstrFile = tmp;
    ofn.nMaxFile = 1024;
    ofn.lpstrTitle = _T("Le titre");
    ofn.lpstrFilter = _T("Tous (*.*)\0*.*\0Textes (*.txt)\0*.TXT\0");
    ofn.Flags = OFN_LONGNAMES | OFN_EXPLORER; // | OFN_ALLOWMULTISELECT  ;
    res = GetOpenFileName(&ofn); 
    //int res = GetSaveFileName(&ofn); 
    printf("Code de sortie : %d\n",res);
    //convert_multiple(ofn.lpstrFile);
    _tprintf(_T("Buffer de sortie : %s\n"),ofn.lpstrFile);
    return 0;
}



Explanations

	No explanations yet.