ouverture de fichier avec evc4.0
Bonjour j'aimerais utiliser cette fonction pour repondre a l'ouverture d'un fichier par une boite de dialogue mais je ne vois pas comment l'appeler a partir de ma fonction de réponse a un onglet du menu
Code:
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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
| LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
{
LRESULT lResult = TRUE;
TCHAR szFile[MAX_PATH] = TEXT("\0");
OPENFILENAME ofn;
memset( &(ofn), 0, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwnd;
ofn.lpstrFile = szFile;
ofn.nMaxFile = MAX_PATH;
switch(msg)
{
case WM_COMMAND:
switch (GET_WM_COMMAND_ID(wp,lp))
{
case IDM_OPENPRJ:
ofn.lpstrTitle = TEXT("Open Folder");
//Open project dialog for Pocket PC.
ofn.Flags = OFN_PROJECT
if (GetOpenFileName(&ofn))
MessageBox(NULL, ofn.lpstrFile, TEXT("Info"), MB_OK)
//Add the opening project code here.
break;
case IDM_OPENFILE:
ofn.lpstrFilter = TEXT("All (*.*)\0*.*\0");
ofn.lpstrTitle = TEXT("Open File");
ofn.Flags = OFN_EXPLORER;
if (GetOpenFileName(&ofn))
MessageBox(NULL, ofn.lpstrFile, TEXT("Info"), MB_OK)
//Add the opening file code here.
break;
case IDM_SAVEFILE:
ofn.lpstrFilter = TEXT("Text (*.txt)\0*.txt\0");
ofn.lpstrTitle = TEXT("Save File As");
ofn.Flags = OFN_HIDEREADONLY;
ofn.lpstrDefExt = TEXT("txt");
if (GetSaveFileName(&ofn))
MessageBox(NULL, ofn.lpstrFile, TEXT("Info"), MB_OK)
//Add saving file code here.
break;
case IDM_PROPERTY:
//Use GetOpenFileName to choose a file and then use
//GetSaveFileName to display its properties
ofn.lpstrFilter = TEXT("All (*.*)\0*.*\0");
ofn.lpstrTitle = TEXT("File Property");
ofn.Flags = OFN_EXPLORER;
if (GetOpenFileName(&ofn)) {
ofn.lpstrTitle = TEXT("Property");
//Open property dialog for Pocket PC.
ofn.Flags = OFN_PROPERTY;
GetSaveFileName(&ofn);
}
break;
default:
return DefWindowProc(hwnd, msg, wp, lp);
}
break; |
merci