|
@@ -1,5 +1,6 @@
|
|
#include <windows.h>
|
|
#include <windows.h>
|
|
#include "resource.h"
|
|
#include "resource.h"
|
|
|
|
+#include "fileio.h"
|
|
|
|
|
|
// Necessary to get the styles
|
|
// Necessary to get the styles
|
|
|
|
|
|
@@ -44,9 +45,7 @@ void OpenFile(HWND hWnd)
|
|
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
|
|
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
|
|
ofn.lpstrDefExt = L"txt";
|
|
ofn.lpstrDefExt = L"txt";
|
|
if(GetOpenFileName(&ofn))
|
|
if(GetOpenFileName(&ofn))
|
|
- {
|
|
|
|
- // Do something usefull with the filename stored in szFileName
|
|
|
|
- }
|
|
|
|
|
|
+ LoadTextFileToEdit(GetDlgItem(hWnd, IDC_MAIN_EDIT), ofn.lpstrFile);
|
|
}
|
|
}
|
|
|
|
|
|
BOOL CALLBACK StringListDlgProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
|
BOOL CALLBACK StringListDlgProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
|
@@ -229,11 +228,16 @@ int WINAPI WinMain(
|
|
ShowWindow(hWnd, nCmdShow);
|
|
ShowWindow(hWnd, nCmdShow);
|
|
UpdateWindow(hWnd);
|
|
UpdateWindow(hWnd);
|
|
|
|
|
|
|
|
+ HACCEL hAccel = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDR_ACCELERATORS));
|
|
|
|
+
|
|
while(GetMessage(&msg, NULL, 0, 0) > 0)
|
|
while(GetMessage(&msg, NULL, 0, 0) > 0)
|
|
{
|
|
{
|
|
- // Without TranslateMessage the keyboard accelerator keys won't work
|
|
|
|
- TranslateMessage(&msg);
|
|
|
|
- DispatchMessage(&msg);
|
|
|
|
|
|
+ if (!TranslateAccelerator(hWnd, hAccel, &msg))
|
|
|
|
+ {
|
|
|
|
+ // Without TranslateMessage the Alt keys to access menus won't work
|
|
|
|
+ TranslateMessage(&msg);
|
|
|
|
+ DispatchMessage(&msg);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
return msg.wParam;
|
|
return msg.wParam;
|