[WinApi] Błędy przy tworzeniu okienka wyboru pliku
Ostatnio zmodyfikowano 2014-04-27 15:42
Tumeg Temat założony przez niniejszego użytkownika |
[WinApi] Błędy przy tworzeniu okienka wyboru pliku » 2014-04-26 21:49:06 Witam, podczas tworzenia okna dialogowego do wyboru plików, napotkałem na takie błędy: C:\Documents and Settings\USER\Pulpit\plik.cpp||In function 'LRESULT WndProc(HWND__*, UINT, WPARAM, LPARAM)':| C:\Documents and Settings\USER\Pulpit\plik.cpp|112|error: 'OPENFILENAME' was not declared in this scope| C:\Documents and Settings\USER\Pulpit\plik.cpp|112|error: expected ';' before 'ofn'| C:\Documents and Settings\USER\Pulpit\plik.cpp|114|error: 'ofn' was not declared in this scope| C:\Documents and Settings\USER\Pulpit\plik.cpp|120|error: 'OFN_FILEMUSTEXIST' was not declared in this scope| C:\Documents and Settings\USER\Pulpit\plik.cpp|120|error: 'OFN_HIDEREADONLY' was not declared in this scope| C:\Documents and Settings\USER\Pulpit\plik.cpp|121|error: 'GetOpenFileName' was not declared in this scope| ||=== Build finished: 6 errors, 0 warnings ===|
A kod tutaj: OPENFILENAME ofn; char sNazwaPliku[ MAX_PATH ] = ""; ZeroMemory( & ofn, sizeof( ofn ) ); ofn.lStructSize = sizeof( ofn ); ofn.lpstrFilter = "Pliki tekstowe (*.txt)\0*.txt\0Wszystkie pliki\0*.*\0"; ofn.nMaxFile = MAX_PATH; ofn.lpstrFile = sNazwaPliku; ofn.lpstrDefExt = "txt"; ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; if( GetOpenFileName( & ofn ) ) { MessageBox( hwnd, "Wybrano plik!", "Komunikat", MB_ICONINFORMATION ); wczytany = true; }
Oczywiście nagłówek: #include <windows.h> jest, więc o co chodzi ? Całego kodu nie wklejałem, bo nie starczyłoby tu miejsca :D, ale po wyrzuceniu powyższego fragmentu wszystko gra. |
|
Monika90 |
» 2014-04-27 10:26:04 Prawdopodobnie masz zdefiniowane makro WIN32_LEAN_AND_MEAN (a może NOGDI), usuń te definicje, albo dołącz commdlg.h ręcznie. |
|
Tumeg Temat założony przez niniejszego użytkownika |
» 2014-04-27 15:42:30 Dziękuję, działa. Żeby nie zakładać już nowego tematu to zapytam tu: << removed - załóż nowy temat >> |
|
« 1 » |