1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
void SaveFile(char name[],const CHAR Filter[])
{
HWND cons;
char buf[30]={'\0'};
GetConsoleTitle(buf,30); // c'est ici que se situe le probléme !
if(buf[0]=='\0')
{
cons = FindWindow ("Type32_Main_Window",NULL);
}
else
cons = FindWindow (NULL,buf);
OPENFILENAME opensavefile;
CHAR szFile[MAX_PATH]={'\0'};
ZeroMemory(&opensavefile, sizeof(OPENFILENAME));
opensavefile.lStructSize = sizeof(OPENFILENAME);
opensavefile.hwndOwner = cons;
opensavefile.lpstrFile = szFile;
opensavefile.nMaxFile = MAX_PATH;
opensavefile.lpstrFilter =Filter;
opensavefile.nFilterIndex = 1;
opensavefile.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
if (GetSaveFileName(&opensavefile)==TRUE)
{
int y=0;
for(;szFile[y]!='\0';y++)
{
name[y]=szFile[y];
}
} |
Partager