LRESULT CALLBACK About (HWND, UINT, WPARAM, LPARAM);
HWND CreateRpCommandBar(HWND);
-\r
+
#pragma warning(disable: 4100 4710 4189; error: 4701)
/* who cares?!
4100: whining about parameters not being used.
4189: initialized but not used. make that an error: later.
4701: usage w/o initialization.
*/
-\r
+
int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
return RegisterClass(&wc);
}
-\r
-HANDLE OpenCOM1() {\r
-\r
- static HANDLE COM1handle = INVALID_HANDLE_VALUE;\r
- const char msg[] = "\r\n--------linexec--------\r\n";\r
- unsigned long wrote;\r
- int speed = CBR_115200;\r
- HANDLE h;\r
-\r
- if (COM1handle != INVALID_HANDLE_VALUE)\r
- return (COM1handle);\r
-\r
- h = CreateFile(TEXT("COM1:"),\r
- GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0,\r
- NULL);\r
- if (h == INVALID_HANDLE_VALUE)\r
- return (h);\r
-\r
- DCB dcb;\r
- if (!GetCommState(h, &dcb))\r
- goto bad;\r
-\r
- dcb.BaudRate = speed;\r
- if (!SetCommState(h, &dcb))\r
- goto bad;\r
-\r
- // Print banner on serial console.\r
- WriteFile(h, msg, sizeof msg, &wrote, 0);\r
-\r
- COM1handle = h;\r
-\r
- return (h);\r
- bad:\r
- CloseHandle(h);\r
- return (INVALID_HANDLE_VALUE);\r
-}\r
+
+HANDLE OpenCOM1() {
+
+ static HANDLE COM1handle = INVALID_HANDLE_VALUE;
+ const char msg[] = "\r\n--------linexec--------\r\n";
+ unsigned long wrote;
+ int speed = CBR_115200;
+ HANDLE h;
+
+ if (COM1handle != INVALID_HANDLE_VALUE)
+ return (COM1handle);
+
+ h = CreateFile(TEXT("COM1:"),
+ GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0,
+ NULL);
+ if (h == INVALID_HANDLE_VALUE)
+ return (h);
+
+ DCB dcb;
+ if (!GetCommState(h, &dcb))
+ goto bad;
+
+ dcb.BaudRate = speed;
+ if (!SetCommState(h, &dcb))
+ goto bad;
+
+ // Print banner on serial console.
+ WriteFile(h, msg, sizeof msg, &wrote, 0);
+
+ COM1handle = h;
+
+ return (h);
+ bad:
+ CloseHandle(h);
+ return (INVALID_HANDLE_VALUE);
+}
//
// FUNCTION: InitInstance(HANDLE, int)
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
- HWND hWnd = NULL;\r
- TCHAR szTitle[MAX_LOADSTRING]; // The title bar text\r
+ HWND hWnd = NULL;
+ TCHAR szTitle[MAX_LOADSTRING]; // The title bar text
TCHAR szWindowClass[MAX_LOADSTRING]; // The window class name
-\r
- hInst = hInstance; // Store instance handle in our global variable\r
- // Initialize global string\r
- LoadString(hInstance, IDC_TESTER1, szWindowClass, MAX_LOADSTRING);\r
+
+ hInst = hInstance; // Store instance handle in our global variable
+ // Initialize global string
+ LoadString(hInstance, IDC_TESTER1, szWindowClass, MAX_LOADSTRING);
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
-\r
+
//If it is already running, then focus on the window
hWnd = FindWindow(szWindowClass, szTitle);
if (hWnd)
RECT rect;
GetClientRect(hWnd, &rect);
-\r
+
OpenCOM1();
load_boot("\\My Documents\\params.txt");
load_boot("\\Storage Card\\params.txt");
- load_boot("\\ÒÓØ ¶°ÄÞ\\params.txt");\r
+ load_boot("\\Speicherkarte\\params.txt");
+ load_boot("\\Carte de stockage\\params.txt");
+ load_boot("\\Mes documents\\params.txt");
+ load_boot("\\ÒÓØ ¶°ÄÞ\\params.txt");
hWnd = CreateWindow(szWindowClass, szTitle, WS_VISIBLE,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
-\r
+
HDC hdc;
-\r
+
int wmId, wmEvent;
-\r
+
PAINTSTRUCT ps;
-\r
+
TCHAR szHello[MAX_LOADSTRING];
-\r
-\r
+
+
switch (message)
-\r
+
{
-\r
+
case WM_COMMAND:
-\r
+
wmId = LOWORD(wParam);
-\r
+
wmEvent = HIWORD(wParam);
-\r
+
// Parse the menu selections:
-\r
+
switch (wmId)
-\r
+
{
-\r
+
case IDM_HELP_ABOUT:
-\r
+
DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
-\r
+
break;
-\r
+
case IDOK:
-\r
+
SendMessage(hWnd, WM_ACTIVATE, MAKEWPARAM(WA_INACTIVE, 0), (LPARAM)hWnd);
-\r
+
SendMessage (hWnd, WM_CLOSE, 0, 0);
-\r
+
break;
-\r
+
default:
-\r
+
return DefWindowProc(hWnd, message, wParam, lParam);
-\r
+
}
-\r
+
break;
-\r
+
case WM_CREATE:
-\r
+
hwndCB = CreateRpCommandBar(hWnd);
-\r
+
break;
-\r
+
case WM_PAINT:
-\r
+
RECT rt;
-\r
+
hdc = BeginPaint(hWnd, &ps);
-\r
+
GetClientRect(hWnd, &rt);
-\r
+
LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING);
-\r
+
DrawText(hdc, szHello, _tcslen(szHello), &rt,
-\r
+
DT_SINGLELINE | DT_VCENTER | DT_CENTER);
-\r
+
EndPaint(hWnd, &ps);
-\r
+
break;
-\r
+
case WM_DESTROY:
-\r
+
CommandBar_Destroy(hwndCB);
-\r
+
PostQuitMessage(0);
-\r
+
break;
-\r
+
case WM_SETTINGCHANGE:
-\r
+
// SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai);
-\r
+
break;
-\r
+
default:
-\r
+
return DefWindowProc(hWnd, message, wParam, lParam);
-\r
+
}
-\r
+
return 0;
-\r
+
}
-\r
-\r
+
+
HWND CreateRpCommandBar(HWND hwnd)
-\r
+
{
-/*\r
+/*
SHMENUBARINFO mbi;
-\r
-\r
+
+
memset(&mbi, 0, sizeof(SHMENUBARINFO));
-\r
+
mbi.cbSize = sizeof(SHMENUBARINFO);
-\r
+
mbi.hwndParent = hwnd;
-\r
+
mbi.nToolBarId = IDM_MENU;
-\r
+
mbi.hInstRes = hInst;
-\r
+
mbi.nBmpId = 0;
-\r
+
mbi.cBmpImages = 0;
-\r
-\r
+
+
if (!SHCreateMenuBar(&mbi))
-\r
+
return NULL;
-\r
-\r
+
+
return mbi.hwndMB;
-*/\r
- return NULL;\r
+*/
+ return NULL;
}
-\r
-\r
+
+
// Mesage handler for the About box.
-\r
+
LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
-\r
+
{
-\r
+
// SHINITDLGINFO shidi;
-\r
-\r
+
+
switch (message)
-\r
+
{
-\r
+
case WM_INITDIALOG:
-\r
+
// Create a Done button and size it.
-\r
+
// shidi.dwMask = SHIDIM_FLAGS;
-\r
+
// shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN | SHIDIF_SIZEDLGFULLSCREEN;
-\r
+
// shidi.hDlg = hDlg;
-\r
+
// SHInitDialog(&shidi);
-\r
+
return TRUE;
-\r
-\r
+
+
case WM_COMMAND:
-\r
+
if (LOWORD(wParam) == IDOK) {
-\r
+
EndDialog(hDlg, LOWORD(wParam));
-\r
+
return TRUE;
-\r
+
}
-\r
+
break;
-\r
+
}
-\r
+
return FALSE;
-\r
+
}
-\r
+