Im coding in CodeBlocks with the help of ResEdit for the GUI. I dont know why it doesnt open the Open File Dialog Box when pressing the IDC_FILEEXE.
Anyone can give me a tip?
Thanks
CODE
Code:
#include <windows.h>#include <commctrl.h>
#include <stdio.h>
#include "resource.h"
HINSTANCE hInst;
void open_file(HWND hWnd){
OPENFILENAME ofn;
char file_name[100];
ZeroMemory(&ofn, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME)l
ofn.hwndOwner = hWnd;
ofn.lpstrFile = file_name;
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = 100;
ofn.lpstrFilter = L"EXE file\0*.exe\0";
ofn.nFilterIndex = 1;
GetOpenFileName(&ofn);
}
BOOL CALLBACK DlgMain(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_INITDIALOG:
{
}
return TRUE;
case WM_CLOSE:
{
EndDialog(hwndDlg, 0);
}
return TRUE;
case WM_COMMAND:
{
switch(wParam)
{
case ID_EXIT: EndDialog(hwndDlg,0);
case ID_FINDEXE:{
open_file(hWnd);
break;
}
}
}
return TRUE;
}
return FALSE;
}
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
hInst=hInstance;
InitCommonControls();
return DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG1), HWND_DESKTOP, (DLGPROC)DlgMain);
}