Skocz do zawartości

GetSaveFileName problem


Parody

Recommended Posts

A wiec mam maly problem z GetSaveFileName dialog pokazuje sie ale przy nacisnieciu OK wyskakuje blad pamieci (pamiec nie moze byc read ... )

char saveFile[300];
OPENFILENAME save;
                        save.hInstance = hInstance;
                        save.Flags = OFN_LONGNAMES|OFN_OVERWRITEPROMPT;
                        save.hwndOwner = hWnd;
                        save.lCustData = NULL;
                        save.lpfnHook = NULL;
                        save.lpstrCustomFilter = NULL;
                        save.lpstrDefExt = "html";
                        save.lpstrFile = "strona.html";
                        save.lpstrFileTitle = saveFile;
                        save.lpstrFilter = NULL;
                        save.lpstrInitialDir = NULL;
                        save.lpstrTitle = "Zapisz jako ...";
                        save.lpTemplateName = NULL;
                        save.lStructSize = sizeof(save);
                        save.nFileExtension = NULL;
                        save.nFileOffset = NULL;
                        save.nFilterIndex = NULL;
                        save.nMaxCustFilter = 60;
                        save.nMaxFile = 300;
                        save.nMaxFileTitle = 300;
                        if((GetSaveFileName(&save))!=0)
                        {
                        //      MessageBox(hWnd,saveFile,"INFO",MB_OK);
                        }

Prosze o pomoc :) ewentualnie jakis maly przykladzik :)

Link do komentarza
Udostępnij na innych stronach

ofn.lStructSize = sizeof (OPENFILENAME) ;
ofn.hwndOwner = hwnd ;
ofn.hInstance = NULL ;
ofn.lpstrFilter = szFilter ;
ofn.lpstrCustomFilter = NULL ;
ofn.nMaxCustFilter = 0 ;
ofn.nFilterIndex = 0 ;
ofn.lpstrFile = "NazwaPliku";
ofn.nMaxFile = MAX_PATH ;
ofn.lpstrFileTitle = NULL ;
ofn.nMaxFileTitle = MAX_PATH ;
ofn.lpstrInitialDir = NULL ;
ofn.lpstrTitle = "jakiś tytuł";
ofn.Flags = OFN_OVERWRITEPROMPT;
ofn.nFileOffset = 0 ;
ofn.nFileExtension = 0 ;
ofn.lpstrDefExt = TEXT ("bmp") ;
ofn.lCustData = 0 ;
ofn.lpfnHook = NULL ;
ofn.lpTemplateName = NULL ;

GetSaveFileName (&ofn);

Tak dziadek Petzold tego używa. Nie sprawdzalem tego twojego, ale to napewno działa.

Link do komentarza
Udostępnij na innych stronach

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gość
Odpowiedz...

×   Wkleiłeś zawartość bez formatowania.   Usuń formatowanie

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Utwórz nowe...