added pppc-sample.ini, broke out menu item addition functionality to addMenuItem()
git-svn-id: http://apu.dw.local/svnusers/JoshHoltrop/pppc/trunk@41 8131a0b2-b21c-1c47-bd6a-f003126495bd
This commit is contained in:
parent
0e7265cfec
commit
94ea8c4aec
16
pppc-sample.ini
Normal file
16
pppc-sample.ini
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
port = LPT1
|
||||||
|
|
||||||
|
[Light]
|
||||||
|
pin = 7
|
||||||
|
on_start = on
|
||||||
|
on_exit = off
|
||||||
|
on_lock = off
|
||||||
|
on_unlock = on
|
||||||
|
|
||||||
|
[Fan]
|
||||||
|
pin = 6
|
||||||
|
on_start = off
|
||||||
|
on_exit = off
|
||||||
|
on_lock = off
|
||||||
|
on_unlock = previous
|
27
pppc.cc
27
pppc.cc
@ -11,6 +11,7 @@ using namespace std;
|
|||||||
#define WM_ICON_NOTIFY (WM_APP + 42)
|
#define WM_ICON_NOTIFY (WM_APP + 42)
|
||||||
|
|
||||||
LRESULT WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
LRESULT WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
|
void addMenuItem(HMENU hMenu, CHAR * itemstr, WORD id);
|
||||||
|
|
||||||
static HINSTANCE m_hInstance;
|
static HINSTANCE m_hInstance;
|
||||||
|
|
||||||
@ -150,17 +151,7 @@ LRESULT WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
if (LOWORD(lParam) == WM_RBUTTONUP)
|
if (LOWORD(lParam) == WM_RBUTTONUP)
|
||||||
{
|
{
|
||||||
HMENU hMenu = ::CreatePopupMenu();
|
HMENU hMenu = ::CreatePopupMenu();
|
||||||
MENUITEMINFO mii;
|
addMenuItem(hMenu, "E&xit", 0);
|
||||||
memset(&mii, 0, sizeof(mii));
|
|
||||||
mii.cbSize = sizeof(mii);
|
|
||||||
mii.fMask = MIIM_STRING | MIIM_ID;
|
|
||||||
mii.wID = 0;
|
|
||||||
mii.dwTypeData = "E&xit";
|
|
||||||
mii.cch = strlen(mii.dwTypeData);
|
|
||||||
if (::InsertMenuItem(hMenu, 0, TRUE, &mii) == 0)
|
|
||||||
{
|
|
||||||
cerr << "Warning: InsertMenuItem(): " << GetLastError() << endl;
|
|
||||||
}
|
|
||||||
POINT pos;
|
POINT pos;
|
||||||
GetCursorPos(&pos);
|
GetCursorPos(&pos);
|
||||||
::SetForegroundWindow(hWnd);
|
::SetForegroundWindow(hWnd);
|
||||||
@ -177,3 +168,17 @@ LRESULT WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void addMenuItem(HMENU hMenu, CHAR * itemstr, WORD id)
|
||||||
|
{
|
||||||
|
MENUITEMINFO mii;
|
||||||
|
memset(&mii, 0, sizeof(mii));
|
||||||
|
mii.cbSize = sizeof(mii);
|
||||||
|
mii.fMask = MIIM_STRING | MIIM_ID;
|
||||||
|
mii.wID = id;
|
||||||
|
mii.dwTypeData = itemstr;
|
||||||
|
mii.cch = strlen(mii.dwTypeData);
|
||||||
|
if (::InsertMenuItem(hMenu, 0, TRUE, &mii) == 0)
|
||||||
|
{
|
||||||
|
cerr << "Warning: InsertMenuItem(): " << GetLastError() << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user