本文整理汇总了C++中GetMenu函数的典型用法代码示例。如果您正苦于以下问题:C++ GetMenu函数的具体用法?C++ GetMenu怎么用?C++ GetMenu使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetMenu函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetMenu
BOOL CPrefabDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CMenu menu;
menu.LoadMenu(IDR_MENU2);
SetMenu(&menu);
menu.Detach();
if (g_editorMode == eMODE_PREFAB)
{
GetMenu()->EnableMenuItem(ID_PACKAGE_NEW, MF_ENABLED);
GetMenu()->EnableMenuItem(ID_PACKAGE_RENAMESELECTED, MF_ENABLED);
GetMenu()->EnableMenuItem(ID_PACKAGE_DELETESELECTED, MF_ENABLED);
GetMenu()->EnableMenuItem(ID_PREFAB_NEW, MF_ENABLED);
GetMenu()->EnableMenuItem(ID_PREFAB_OPENSELECTED, MF_ENABLED);
GetMenu()->EnableMenuItem(ID_PREFAB_RENAMESELECTED, MF_ENABLED);
GetMenu()->EnableMenuItem(ID_PREFAB_DELETESELECTED, MF_ENABLED);
m_btnInsertPrefab.SetWindowTextA("Open Prefab");
}
else
{
GetMenu()->EnableMenuItem(ID_PACKAGE_NEW, MF_DISABLED | MF_GRAYED);
GetMenu()->EnableMenuItem(ID_PACKAGE_RENAMESELECTED, MF_DISABLED | MF_GRAYED);
GetMenu()->EnableMenuItem(ID_PACKAGE_DELETESELECTED, MF_DISABLED | MF_GRAYED);
GetMenu()->EnableMenuItem(ID_PREFAB_NEW, MF_DISABLED | MF_GRAYED);
GetMenu()->EnableMenuItem(ID_PREFAB_OPENSELECTED, MF_DISABLED | MF_GRAYED);
GetMenu()->EnableMenuItem(ID_PREFAB_RENAMESELECTED, MF_DISABLED | MF_GRAYED);
GetMenu()->EnableMenuItem(ID_PREFAB_DELETESELECTED, MF_DISABLED | MF_GRAYED);
m_btnInsertPrefab.SetWindowTextA("Insert Prefab");
}
m_slideLod.SetRange(0, 2);
CBitmap cBmp;
CBitmap* cBmpMask = NULL;
m_packageListImage.Create(36, 36, ILC_COLOR24, 1, 1);
cBmp.LoadBitmap(IDB_BITMAP_DEFAULT_PACKAGE);
m_packageListImage.Add(&cBmp, cBmpMask);
cBmp.DeleteObject();
RECT tempRect;
m_listPrefabPackages.GetClientRect(&tempRect);
m_listPrefabPackages.SetImageList(&m_packageListImage, LVSIL_SMALL);
m_listPrefabPackages.InsertColumn(0, "Packages", LVCFMT_CENTER | LVS_SHOWSELALWAYS, (tempRect.right - tempRect.left) * 80 / 100);
m_listPrefabPackages.ShowWindow(SW_SHOW);
m_listPrefabPackages.UpdateWindow();
m_prefabListImage.Create(80, 80, ILC_COLOR24, 1, 1);
cBmp.LoadBitmap(IDB_BITMAP_DEFAULT_VPF);
m_prefabListImage.Add(&cBmp, cBmpMask);
cBmp.DeleteObject();
m_listPrefabs.SetImageList(&m_prefabListImage, LVSIL_NORMAL);
m_listPrefabs.GetClientRect(&tempRect);
m_listPrefabs.InsertColumn(0, "Prefabs", LVCFMT_LEFT | LVS_SHOWSELALWAYS, (tempRect.right - tempRect.left) * 80 / 100);
m_listPrefabs.ShowWindow(SW_SHOW);
m_listPrefabs.UpdateWindow();
//insert items
for (CUInt i = 0; i < g_prefabPackagesAndNames.size(); i++)
{
CChar str[MAX_NAME_SIZE];
Cpy(str, g_prefabPackagesAndNames[i].front().c_str());
if (!Cmp(str, "Vanda_Basics"))
InsertItemToPackageList(str);
}
RECT rect;
m_listPrefabProperties.GetClientRect(&rect);
m_listPrefabProperties.InsertColumn(0, "Parameters", LVCFMT_LEFT, rect.right - rect.left, 1);
m_listPrefabProperties.SetExtendedStyle(LVS_EX_INFOTIP | LVS_EX_ONECLICKACTIVATE | LVS_EX_LABELTIP);
InserItemToPropertiesList("Vertices");
InserItemToPropertiesList("Textures");
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例2: Toolbar_UpdateUI
void Toolbar_UpdateUI(
HWND hwnd)
{
HWND hwndFrame;
HMENU hmenu;
unsigned nCount;
/*=======================================*/
/* Get frame window (parent of toolbar). */
/*=======================================*/
hwndFrame = GetParent(hwnd);
ASSERT(NULL != hwndFrame);
/*===================================*/
/* Get the main frame window's menu. */
/*===================================*/
hmenu = GetMenu(hwndFrame);
//ASSERT (NULL != hmenu) ;
if (NULL == hmenu)
{ return; }
/*======================================*/
/* Get count of buttons on the toolbar. */
/*======================================*/
nCount = Toolbar_ButtonCount(hwnd);
/*===================================*/
/* For each button on the toolbar... */
/*===================================*/
while (nCount > 0)
{
BOOL bMenuEnabled, bButtonEnabled;
TBBUTTON tbb;
UINT uiState;
/*===================================*/
/* Get information about the button. */
/*===================================*/
VERIFY(Toolbar_GetButton(hwnd,--nCount,&tbb));
/*==========================================*/
/* If the button is a separator, ignore it. */
/*==========================================*/
if (tbb.fsStyle & TBSTYLE_SEP)
{ continue; }
/*=========================================*/
/* Get information about the corresponding */
/* menu item, if any. */
/*=========================================*/
uiState = GetMenuState(hmenu,(unsigned) tbb.idCommand,MF_BYCOMMAND);
if (0xFFFFFFFF == uiState)
{ bMenuEnabled = FALSE; }
else
{ bMenuEnabled = 0 == (uiState & (MF_DISABLED | MF_GRAYED)); }
bButtonEnabled = 0 != (tbb.fsState & TBSTATE_ENABLED);
/*===========================================*/
/* If button and menu are in the same state, */
/* we need do nothing for this button. */
/*===========================================*/
if (bMenuEnabled == bButtonEnabled)
{ continue; }
/*=====================================*/
/* Enable/Disable this toolbar button. */
/*=====================================*/
VERIFY(Toolbar_EnableButton(hwnd,tbb.idCommand,bMenuEnabled));
}
}
示例3: MainProc
//.........这里部分代码省略.........
msg = WM_MBUTTONDOWN;
}
TestBoard( hWnd, &board, (short)LOWORD(lParam), (short)HIWORD(lParam), msg );
return 0;
case WM_RBUTTONUP:
WINE_TRACE("WM_RBUTTONUP\n");
if( wParam & MK_LBUTTON )
msg = WM_MBUTTONUP;
TestBoard( hWnd, &board, (short)LOWORD(lParam), (short)HIWORD(lParam), msg );
return 0;
case WM_MBUTTONDOWN:
WINE_TRACE("WM_MBUTTONDOWN\n");
TestBoard( hWnd, &board, (short)LOWORD(lParam), (short)HIWORD(lParam), msg );
return 0;
case WM_MBUTTONUP:
WINE_TRACE("WM_MBUTTONUP\n");
TestBoard( hWnd, &board, (short)LOWORD(lParam), (short)HIWORD(lParam), msg );
return 0;
case WM_MOUSEMOVE:
{
if( ( wParam & MK_MBUTTON ) ||
( ( wParam & MK_LBUTTON ) && ( wParam & MK_RBUTTON ) ) ) {
msg = WM_MBUTTONDOWN;
}
else if( wParam & MK_LBUTTON ) {
msg = WM_LBUTTONDOWN;
}
else {
return 0;
}
TestBoard( hWnd, &board, (short)LOWORD(lParam), (short)HIWORD(lParam), msg );
return 0;
}
case WM_COMMAND:
switch(LOWORD(wParam)) {
case IDM_NEW:
CreateBoard( &board );
return 0;
case IDM_MARKQ:
hMenu = GetMenu( hWnd );
board.IsMarkQ = !board.IsMarkQ;
if( board.IsMarkQ )
CheckMenuItem( hMenu, IDM_MARKQ, MF_CHECKED );
else
CheckMenuItem( hMenu, IDM_MARKQ, MF_UNCHECKED );
return 0;
case IDM_BEGINNER:
SetDifficulty( &board, BEGINNER );
CreateBoard( &board );
return 0;
case IDM_ADVANCED:
SetDifficulty( &board, ADVANCED );
CreateBoard( &board );
return 0;
case IDM_EXPERT:
SetDifficulty( &board, EXPERT );
CreateBoard( &board );
return 0;
case IDM_CUSTOM:
SetDifficulty( &board, CUSTOM );
CreateBoard( &board );
return 0;
case IDM_EXIT:
SendMessageW( hWnd, WM_CLOSE, 0, 0);
return 0;
case IDM_TIMES:
DialogBoxParamW( board.hInst, MAKEINTRESOURCEW(DLG_TIMES), hWnd,
TimesDlgProc, (LPARAM) &board);
return 0;
case IDM_ABOUT:
{
WCHAR appname[256], other[256];
LoadStringW( board.hInst, IDS_APPNAME, appname, sizeof(appname)/sizeof(WCHAR) );
LoadStringW( board.hInst, IDS_ABOUT, other, sizeof(other)/sizeof(WCHAR) );
ShellAboutW( hWnd, appname, other,
LoadImageW(board.hInst, MAKEINTRESOURCEW(IDI_WINEMINE), IMAGE_ICON, 48, 48, LR_SHARED));
return 0;
}
default:
WINE_TRACE("Unknown WM_COMMAND command message received\n");
break;
}
}
return DefWindowProcW( hWnd, msg, wParam, lParam );
}
示例4: Show
BOOL Show(HINSTANCE hInstance, int nCmdShow)
{
hInst = hInstance; // Store instance handle in our global variable
int zoom = g_Config.iWindowZoom;
if (zoom < 1) zoom = 1;
if (zoom > 4) zoom = 4;
RECT rc, rcOrig;
GetWindowRectAtZoom(zoom, rcOrig, rc);
u32 style = WS_OVERLAPPEDWINDOW;
hwndMain = CreateWindowEx(0,szWindowClass, "", style,
rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, NULL, NULL, hInstance, NULL);
if (!hwndMain)
return FALSE;
hwndDisplay = CreateWindowEx(0, szDisplayClass, TEXT(""), WS_CHILD | WS_VISIBLE,
rcOrig.left, rcOrig.top, rcOrig.right - rcOrig.left, rcOrig.bottom - rcOrig.top, hwndMain, 0, hInstance, 0);
if (!hwndDisplay)
return FALSE;
menu = GetMenu(hwndMain);
#ifdef FINAL
RemoveMenu(menu,2,MF_BYPOSITION);
RemoveMenu(menu,2,MF_BYPOSITION);
#endif
MENUINFO info;
ZeroMemory(&info,sizeof(MENUINFO));
info.cbSize = sizeof(MENUINFO);
info.cyMax = 0;
info.dwStyle = MNS_CHECKORBMP;
info.fMask = MIM_STYLE;
for (int i = 0; i < GetMenuItemCount(menu); i++)
{
SetMenuInfo(GetSubMenu(menu,i),&info);
}
UpdateMenus();
//accept dragged files
DragAcceptFiles(hwndMain, TRUE);
hideCursor = true;
SetTimer(hwndMain, TIMER_CURSORUPDATE, CURSORUPDATE_INTERVAL_MS, 0);
Update();
SetPlaying(0);
ShowWindow(hwndMain, nCmdShow);
W32Util::MakeTopMost(hwndMain, g_Config.bTopMost);
#if ENABLE_TOUCH
RegisterTouchWindow(hwndDisplay, TWF_WANTPALM);
#endif
RAWINPUTDEVICE keyboard;
memset(&keyboard, 0, sizeof(keyboard));
keyboard.usUsagePage = 1;
keyboard.usUsage = 6;
keyboard.dwFlags = 0; // RIDEV_NOLEGACY | ;
RegisterRawInputDevices(&keyboard, 1, sizeof(RAWINPUTDEVICE));
SetFocus(hwndDisplay);
return TRUE;
}
示例5: CheckUndoMenu
void CheckUndoMenu(HWND hwnd, BOOL bEnable)
{
bUndo = bEnable;
EnableMenuItem(GetMenu(hwnd), IDM_UNDO, MF_BYCOMMAND | (bEnable ? MF_ENABLED : MF_GRAYED));
}
示例6: switch
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 回调函数
LRESULT CALLBACK CMainWnd::MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
CChildWnd *pWnd;
TCHAR tzTemp[MAX_PATH];
switch (uMsg)
{
case WM_CREATE:
// 窗口被创建
m_hWnd = hWnd;
m_hMenu = GetMenu(m_hWnd);
OnCreate();
break;
case WM_SIZE:
// 尺寸改变
OnSize(wParam, lParam);
return 0;
case WM_WINDOWPOSCHANGED:
// 位置改变
for (pWnd = CChildWnd::m_pHead; pWnd; pWnd = pWnd->m_pNext)
{
if (pWnd->m_hWnd)
{
pWnd->SetDrawRect();
}
}
break;
case WM_INITMENUPOPUP:
// 弹出菜单初始化
OnMenuPopup(wParam, lParam);
break;
case WM_MENUSELECT:
// 菜单项被选择
OnMenuSelect(LOWORD(wParam));
break;
case WM_EXITMENULOOP:
// 退出菜单循环
CClientWnd::SetStatusText(LNG_Ready);
break;
case WM_COMMAND:
// 命令处理
OnCommand(wParam, lParam);
break;
case WM_COPYDATA:
// 本程序的其它实例通知打开文件
if (((PCOPYDATASTRUCT) lParam)->dwData == IDM_File_Open)
{
static TCHAR s_tzFileName[MAX_PATH];
lstrcpyn(s_tzFileName, (PTSTR) ((PCOPYDATASTRUCT) lParam)->lpData, MAX_PATH);
PostMessage(m_hWnd, WM_COMMAND, IDM_File_Open, (LPARAM) s_tzFileName);
}
break;
case WM_HOTKEY:
// 热键消息
if ((m_hWnd != GetForegroundWindow()) && (wParam == IDC_TrayIcon))
{
OnTrayIcon(FALSE);
}
break;
case WM_DROPFILES:
// 拖动文件
DragQueryFile((HDROP) wParam, 0, tzTemp, MAX_PATH);
DragFinish((HDROP) wParam);
OnFileOpen(tzTemp);
break;
case WM_HELP:
// 帮助
OnCommand(IDM_Help_Content);
break;
case WM_DESTROY:
// 窗口被销毁
OnDestroy();
break;
}
return DefFrameProc(hWnd, CClientWnd::m_hWnd, uMsg, wParam, lParam);
}
示例7: UpdateMenu
void UpdateMenu(HWND hWnd)
{
HMENU hMenu = GetMenu(hWnd);
CheckMenuRadioItem(hMenu, IDM_VIEW_25, IDM_VIEW_400, IDM_VIEW_100 + iViewScale, MF_BYCOMMAND);
CheckMenuItem(hMenu, ID_VIEW_ANIMATE, bAnimate ? MF_CHECKED : MF_UNCHECKED);
}
示例8: MainWindowProc
//.........这里部分代码省略.........
case IDS_CAT_INTERNET:
UpdateApplicationsList(ENUM_CAT_INTERNET);
break;
case IDS_CAT_LIBS:
UpdateApplicationsList(ENUM_CAT_LIBS);
break;
case IDS_CAT_OFFICE:
UpdateApplicationsList(ENUM_CAT_OFFICE);
break;
case IDS_CAT_OTHER:
UpdateApplicationsList(ENUM_CAT_OTHER);
break;
case IDS_CAT_SCIENCE:
UpdateApplicationsList(ENUM_CAT_SCIENCE);
break;
case IDS_CAT_TOOLS:
UpdateApplicationsList(ENUM_CAT_TOOLS);
break;
case IDS_CAT_VIDEO:
UpdateApplicationsList(ENUM_CAT_VIDEO);
break;
}
}
/* Disable/enable items based on treeview selection */
if (IsSelectedNodeInstalled())
{
EnableMenuItem(GetMenu(hwnd), ID_REGREMOVE, MF_ENABLED);
EnableMenuItem(GetMenu(hwnd), ID_INSTALL, MF_GRAYED);
EnableMenuItem(GetMenu(hwnd), ID_UNINSTALL, MF_ENABLED);
EnableMenuItem(GetMenu(hwnd), ID_MODIFY, MF_ENABLED);
EnableMenuItem(GetMenu(hListView), ID_REGREMOVE, MF_ENABLED);
EnableMenuItem(GetMenu(hListView), ID_INSTALL, MF_GRAYED);
EnableMenuItem(GetMenu(hListView), ID_UNINSTALL, MF_ENABLED);
EnableMenuItem(GetMenu(hListView), ID_MODIFY, MF_ENABLED);
SendMessage(hToolBar, TB_ENABLEBUTTON, ID_REGREMOVE, TRUE);
SendMessage(hToolBar, TB_ENABLEBUTTON, ID_INSTALL, FALSE);
SendMessage(hToolBar, TB_ENABLEBUTTON, ID_UNINSTALL, TRUE);
SendMessage(hToolBar, TB_ENABLEBUTTON, ID_MODIFY, TRUE);
}
else
{
EnableMenuItem(GetMenu(hwnd), ID_REGREMOVE, MF_GRAYED);
EnableMenuItem(GetMenu(hwnd), ID_INSTALL, MF_ENABLED);
EnableMenuItem(GetMenu(hwnd), ID_UNINSTALL, MF_GRAYED);
EnableMenuItem(GetMenu(hwnd), ID_MODIFY, MF_GRAYED);
EnableMenuItem(GetMenu(hListView), ID_REGREMOVE, MF_GRAYED);
EnableMenuItem(GetMenu(hListView), ID_INSTALL, MF_ENABLED);
EnableMenuItem(GetMenu(hListView), ID_UNINSTALL, MF_GRAYED);
EnableMenuItem(GetMenu(hListView), ID_MODIFY, MF_GRAYED);
SendMessage(hToolBar, TB_ENABLEBUTTON, ID_REGREMOVE, FALSE);
SendMessage(hToolBar, TB_ENABLEBUTTON, ID_INSTALL, TRUE);
SendMessage(hToolBar, TB_ENABLEBUTTON, ID_UNINSTALL, FALSE);
SendMessage(hToolBar, TB_ENABLEBUTTON, ID_MODIFY, FALSE);
}
}
示例9: GetItem
PObjectBase MenuEditor::GetMenu(long& n, PObjectDatabase base, bool isSubMenu)
{
// Get item from list control
wxString label, shortcut, id, name, help, kind;
PObjectBase menu;
GetItem(n, label, shortcut, id, name, help, kind, &menu);
bool createNew = true;
if ( menu )
{
createNew = ( menu->GetClassName() != (isSubMenu ? wxT("submenu") : wxT("wxMenu")) );
}
// preserve original menu if the object types match
// this preserves properties that are not exposed in the menu editor - like C++ scope
if ( createNew )
{
PObjectInfo info = base->GetObjectInfo(isSubMenu ? wxT("submenu") : wxT("wxMenu") );
menu = base->NewObject(info);
}
label.Trim(true); label.Trim(false);
menu->GetProperty( wxT("label") )->SetValue(label);
menu->GetProperty( wxT("name") )->SetValue(name);
int ident = GetItemIdentation(n);
n++;
while (n < m_menuList->GetItemCount() && GetItemIdentation(n) > ident)
{
PObjectBase menuitem;
GetItem(n, label, shortcut, id, name, help, kind, &menuitem);
createNew = true;
label.Trim(true); label.Trim(false);
if (label == wxT("---"))
{
if ( menuitem )
{
createNew = ( menuitem->GetClassName() != wxT("separator") );
}
if ( createNew )
{
PObjectInfo info = base->GetObjectInfo( wxT("separator") );
menuitem = base->NewObject(info);
}
menu->AddChild(menuitem);
menuitem->SetParent(menu);
n++;
}
else if (HasChildren(n))
{
PObjectBase child = GetMenu(n, base);
menu->AddChild(child);
child->SetParent(menu);
}
else
{
if ( menuitem )
{
createNew = ( menuitem->GetClassName() != wxT("wxMenuItem") );
}
if ( createNew )
{
PObjectInfo info = base->GetObjectInfo( wxT("wxMenuItem") );
menuitem = base->NewObject(info);
}
menuitem->GetProperty( wxT("label") )->SetValue(label);
menuitem->GetProperty( wxT("shortcut") )->SetValue(shortcut);
menuitem->GetProperty( wxT("name") )->SetValue(name);
menuitem->GetProperty( wxT("help") )->SetValue(help);
menuitem->GetProperty( wxT("id") )->SetValue(id);
menuitem->GetProperty( wxT("kind") )->SetValue(kind);
menu->AddChild(menuitem);
menuitem->SetParent(menu);
n++;
}
}
return menu;
}
示例10: ChatPopDown
// front end
void ChatPopDown()
{
if(--chatCount <= 0)
CheckMenuItem(GetMenu(hwndMain), IDM_NewChat, MF_UNCHECKED);
}
示例11: init
void init()
{
RgnHandle tempRgn;
Rect BaseRect;
OSErr err;
long QDfeature/*, OSfeature*/;
GDHandle SaveGD;
CGrafPtr SavePort;
/* Initialize Managaer. */
//InitGraf(&qd.thePort);
//InitWindows();
//InitDialogs(nil);
InitCursor();
FlushEvents(everyEvent, 0);
/* Set up menus. */
mymenu0 = GetMenu(appleID);
//AppendResMenu(mymenu0, 'DRVR');
InsertMenu(mymenu0,0);
mymenu1 = GetMenu(fileID);
InsertMenu(mymenu1,0);
DrawMenuBar();
DoneFlag = false;
ThePict = GetPicture(PictID);
if (ThePict == nil)
DoneFlag = true;
/* Use Gestalt to find is QuickDraw is avaiable. */
/*if ((GetOSTrapAddress(Gestalttest) != GetOSTrapAddress(NoTrap))) {
err = Gestalt(gestaltQuickdrawVersion, &QDfeature);
if (err)
DoneFlag = true;
err = Gestalt(gestaltSystemVersion, &OSfeature);
if (err)
DoneFlag = true;
if (!DoneFlag && (QDfeature & 0x0f00) != 0x0200 && OSfeature < 0x0605)
DoneFlag = true;
}
else
DoneFlag = true;*/
err = Gestalt(gestaltQuickdrawVersion, &QDfeature);
if (err != noErr || QDfeature < gestalt32BitQD)
DoneFlag = true;
/* Set Rects. */
SetRect(&BaseRect, 40, 60, 472, 282);
SetRect(&WinMinusScroll, BaseRect.left-40, BaseRect.top-60, BaseRect.right-60,
BaseRect.bottom - 80);
SetRect(&InitWindowSize, WinMinusScroll.left, WinMinusScroll.top,
WinMinusScroll.right, WinMinusScroll.bottom);
tempRgn = GetGrayRgn();
HLock ((Handle) tempRgn);
//TotalRect = (**tempRgn).rgnBBox;
GetRegionBounds(tempRgn, &TotalRect);
/*SetRect(&minRect, 80, 80, (**tempRgn).rgnBBox.right - 40,
(**tempRgn).rgnBBox.bottom - 40);*/
SetRect(&minRect, 80, 80, TotalRect.right - 40, TotalRect.bottom - 40);
HUnlock ((Handle) tempRgn);
/* Open window and set up picture. */
GetGWorld (&SavePort, &SaveGD);
mycolors = GetCTable (clutID);
(*mycolors)->ctFlags |= 0x4000;
myWindow = NewCWindow(nil, &BaseRect, (ConstStr255Param)"", true, zoomDocProc,
(WindowPtr) -1, true, 150);
SetGWorld(GetWindowPort(myWindow), SaveGD);
DrawGrowIcon (myWindow);
srcPalette = NewPalette (((**mycolors).ctSize)+1, mycolors,
pmTolerant + pmExplicit + pmAnimated, 0);
SetPalette ((WindowPtr) myWindow, srcPalette, true);
GetGWorld (&SavePort, &SaveGD);
err = NewGWorld (&offscreenGWorld, 8, &InitWindowSize, mycolors, nil, 0);
if (err)
Debugger();
SetGWorld (offscreenGWorld, nil);
EraseRect (&InitWindowSize);
DrawPicture (ThePict, &InitWindowSize);
SetGWorld (SavePort, SaveGD);
}
示例12: SafeGetMenu
pascal MenuHandle SafeGetMenu(short resourceID)
{
StAcroResourceContext resContext;
return GetMenu(resourceID);
}
示例13: WndProc
//.........这里部分代码省略.........
distance_caption_handle = CreateWindowEx(WS_EX_TRANSPARENT, "STATIC", "Distance Thres:", WS_CHILD | WS_VISIBLE,
thirdcolPos + 10, horzSeparatorPos + 10, 110, 30, hWnd, (HMENU)IDC_STATIC_DISTANCE_THRES, GetModuleHandle(NULL), NULL);
distance_handle = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", std::to_string(DEFAULT_DISTANCE_THRES).c_str(), WS_CHILD | WS_VISIBLE,
thirdcolPos + 125, horzSeparatorPos + 10, 50, 30, hWnd, (HMENU)IDC_EDIT_DISTANCE_THRES, GetModuleHandle(NULL), NULL);
//base/match image selector
check_box_handles[0] = CreateWindowEx(WS_EX_STATICEDGE, "BUTTON", "Base Image", WS_CHILD | WS_VISIBLE | WS_GROUP | BS_AUTORADIOBUTTON,
vertSeparatorPos + 10, horzSeparatorPos + 50, 165, 30, hWnd, (HMENU)IDC_CHECK_BOX_BASE, GetModuleHandle(NULL), NULL);
check_box_handles[1] = CreateWindowEx(WS_EX_STATICEDGE, "BUTTON", "Match Image", WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,
vertSeparatorPos + 10, horzSeparatorPos + 90, 165, 30, hWnd, (HMENU)IDC_CHECK_BOX_MATCH, GetModuleHandle(NULL), NULL);
//merge checkbox
merge_checkbox_handle = CreateWindowEx(WS_EX_STATICEDGE, "BUTTON", "Merge Match to Base", WS_CHILD | BS_AUTOCHECKBOX,
thirdcolPos + 10, horzSeparatorPos + 50, 165, 30, hWnd, (HMENU)IDC_CHECK_BOX_MERGE, GetModuleHandle(NULL), NULL);
//base/match image selector
check_box_handles[2] = CreateWindowEx(WS_EX_STATICEDGE, "BUTTON", "Park", WS_CHILD | WS_VISIBLE | WS_GROUP | BS_AUTORADIOBUTTON,
thirdcolPos + 10, horzSeparatorPos + 50, 80, 30, hWnd, (HMENU)IDC_CHECK_BOX_PARK, GetModuleHandle(NULL), NULL);
check_box_handles[3] = CreateWindowEx(WS_EX_STATICEDGE, "BUTTON", "Leave", WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,
thirdcolPos + 95, horzSeparatorPos + 50, 80, 30, hWnd, (HMENU)IDC_CHECK_BOX_LEAVE, GetModuleHandle(NULL), NULL);
//change spot
CreateWindowEx(WS_EX_TRANSPARENT, "Static", "New Spot:", WS_CHILD | WS_VISIBLE,
thirdcolPos + 10, horzSeparatorPos + 90, 110, 30, hWnd, (HMENU)IDC_STATIC_SPOT, GetModuleHandle(NULL), NULL);
spot_handle = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "", WS_CHILD | WS_VISIBLE,
thirdcolPos + 125, horzSeparatorPos + 90, 50, 30, hWnd, (HMENU)IDC_EDIT_SPOT, GetModuleHandle(NULL), NULL);
//navigator
leftnavi_button_handle = CreateWindowEx(WS_EX_CLIENTEDGE, "BUTTON", "<---", WS_CHILD | WS_VISIBLE,
vertSeparatorPos + 100 - 80, horzSeparatorPos + 130, 80, 40, hWnd, (HMENU)IDC_BUTTON_LEFT, GetModuleHandle(NULL), NULL);
rightnavi_button_handle = CreateWindowEx(WS_EX_CLIENTEDGE, "BUTTON", "--->", WS_CHILD | WS_VISIBLE,
vertSeparatorPos + 185 - 80, horzSeparatorPos + 130, 80, 40, hWnd, (HMENU)IDC_BUTTON_RIGHT, GetModuleHandle(NULL), NULL);
//save review result
save_button_handle = CreateWindowEx(WS_EX_CLIENTEDGE, "BUTTON", "SAVE", WS_CHILD | WS_VISIBLE,
vertSeparatorPos + 275, horzSeparatorPos + 130, 80, 40, hWnd, (HMENU)IDC_BUTTON_SAVE, GetModuleHandle(NULL), NULL);
horzSeparatorPos += 175;
CreateWindowEx(WS_EX_CLIENTEDGE, "Static", "", SS_ETCHEDHORZ | WS_CHILD | WS_VISIBLE, 5, horzSeparatorPos, 535, 10, hWnd, NULL, GetModuleHandle(NULL), NULL);
CreateWindowEx(WS_EX_TRANSPARENT, "Static", "Latest Logs:", WS_CHILD | WS_VISIBLE,
10, horzSeparatorPos + 10, 515, 30, hWnd, (HMENU)IDC_STATIC_RESULT, GetModuleHandle(NULL), NULL);
result_handle = CreateWindowEx(WS_EX_TRANSPARENT, "STATIC", " Waiting for configurting the output file!", WS_CHILD | WS_VISIBLE,
10, horzSeparatorPos + 40, 515, 110, hWnd, (HMENU)IDC_EDIT_RESULT, GetModuleHandle(NULL), NULL);
EnableAllInteractions(false);
// Gets Menu Handle
menu_handle = GetMenu(hWnd);
CheckMenuItem(menu_handle, IDM_PLAY_MOV, MF_CHECKED);
}
break;
// press left mouse button somewhere in the main window to uncheck all radiobuttons (optionbuttons)
case WM_LBUTTONDOWN:
{
if (BST_CHECKED == SendMessage(check_box_handles[0], BM_GETCHECK, 0, 0)){
if (showClearTutorial){
int ret = MessageBox(hWnd, "Enable the function to clear park/leave radio when clicking the background or a non-active component?", "You just clicked the background or a non-active component", MB_YESNO);
showClearTutorial = false;
enableClear = (ret == IDYES);
}
}
if (enableClear){
SendMessage(check_box_handles[2], BM_SETCHECK, BST_UNCHECKED, 0);
SendMessage(check_box_handles[3], BM_SETCHECK, BST_UNCHECKED, 0);
}
}
break;
case WM_KEYDOWN:
{
int x = 0;
switch (wParam)
{
case VK_LEFT:
HandleMovement(-1);
break;
case VK_RIGHT:
HandleMovement(+1);
break;
}
}
break;
case WM_DESTROY:
vio->Stop_Video();
DestroyImage(BASE_TYPE);
DestroyImage(MATCH_TYPE);
closeOutputFile();
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
示例14: dc
void COpenCVInterfaceDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
//In variabila r1 pastrez dimensiunile ferestrei picture1
CRect r1;
GetClientRect(&r1);
int w,h;
if(mainImage.cols)
{
//aleg minimul dintre dimensiunile imag si ale ferestrei de afisare
if(mainImage.cols<r1.Width()) w=mainImage.cols;
else w=r1.Width();
if(mainImage.rows<r1.Height()) h=mainImage.rows;
else h=r1.Height();
//creez un dreptunghi cu dimensiunile minime si il umplu cu peria imagine
CRect r(0,0,w-1,h-1);
dc.FillRect(r,ImageBrush);
CMenu* mmenu =GetMenu();
CMenu* submenu =mmenu->GetSubMenu(1);
UINT state = submenu->GetMenuState(ID_TOOLS_GRAYLEVELROW,MF_BYCOMMAND);
UINT state1 = submenu->GetMenuState(ID_TOOLS_GRAYLEVELCOLUMN,MF_BYCOMMAND);
ASSERT(state != 0xFFFFFFFF);
ASSERT(state1 != 0xFFFFFFFF);
if(state & MF_CHECKED)
{
if(gr->GetY()<mainImage.rows)
{
gr->setGCheck(true);
CPen *pen = new CPen(PS_SOLID,1,RGB(255,0,0));
CPen *oldPen;
oldPen=(CPen*)dc.SelectObject(pen);
dc.MoveTo(0,gr->GetY());
dc.LineTo(mainImage.cols,gr->GetY());
dc.SelectObject(oldPen);
delete pen;
}
}
else
{
if(state1 & MF_CHECKED)
{
gr->setGCheck(false);
if(gr->GetX()<mainImage.cols)
{
CPen *pen = new CPen(PS_SOLID,1,RGB(255,0,0));
CPen *oldPen;
oldPen=(CPen*)dc.SelectObject(pen);
dc.MoveTo(gr->GetX(),0);
dc.LineTo(gr->GetX(),mainImage.rows);
dc.SelectObject(oldPen);
delete pen;
}
}
}
}
}
示例15: MainWindowProc
/*
* WindowProc - main window message handler
*/
LONG CALLBACK MainWindowProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
WORD cmd;
about_info ai;
HMENU mh;
CommunicationBuffer *dbginfo;
switch ( msg ) {
case WM_CREATE:
setupSystemMenu( hwnd );
MainLBox = CreateListBox( hwnd );
mh = GetMenu( hwnd );
if( ConfigData.auto_attatch ) {
CheckMenuItem( mh, MENU_AUTO_ATTATCH, MF_BYCOMMAND | MF_CHECKED );
}
if( ConfigData.continue_exception ) {
CheckMenuItem( mh, MENU_EXCEPTION_CONTINUE,
MF_BYCOMMAND | MF_CHECKED );
}
LBPrintf( MainLBox, STR_DRNT_STARTED, AppName );
break;
case WM_SIZE:
MoveListBox( MainLBox, 0, 0, LOWORD( lparam ), HIWORD( lparam ) );
ClearAlert();
break;
case WM_SYSCOMMAND:
switch( wparam ) {
case MENU_LOG_CURRENT_STATE:
case MENU_LOG_OPTIONS:
case MENU_TASK_CTL:
SendMessage( hwnd, WM_COMMAND, wparam, 0 );
break;
default:
return( DefWindowProc( hwnd, msg, wparam, lparam ) );
}
break;
case WM_COMMAND:
cmd = LOWORD( wparam );
switch( cmd ) {
case LISTBOX_1:
break;
case MENU_EXCEPTION_CONTINUE:
ConfigData.continue_exception = !ConfigData.continue_exception;
mh = GetMenu( hwnd );
if( ConfigData.continue_exception ) {
CheckMenuItem( mh, MENU_EXCEPTION_CONTINUE,
MF_BYCOMMAND | MF_CHECKED );
} else {
CheckMenuItem( mh, MENU_EXCEPTION_CONTINUE,
MF_BYCOMMAND | MF_UNCHECKED );
}
break;
case MENU_LOG_VIEW:
ViewLog();
break;
case MENU_NEW_TASK:
CallProcCtl( MENU_NEW_TASK, NULL, NULL );
break;
case MENU_AUTO_ATTATCH:
ConfigData.auto_attatch = ! ConfigData.auto_attatch;
mh = GetMenu( hwnd );
if( ConfigData.auto_attatch ) {
CheckMenuItem( mh, MENU_AUTO_ATTATCH,
MF_BYCOMMAND | MF_CHECKED );
} else {
CheckMenuItem( mh, MENU_AUTO_ATTATCH,
MF_BYCOMMAND | MF_UNCHECKED );
}
break;
case MENU_SHOW_DIP_STATUS:
ShowDIPStatus( hwnd );
break;
case MENU_CLEAR:
ClearListBox( MainLBox );
break;
case MENU_SAVE_AS:
SaveListBox( SLB_SAVE_AS, SaveExtra, "", AppName, hwnd,
GetListBoxHwnd( MainLBox ) );
break;
case MENU_SAVE:
SaveListBox( SLB_SAVE_TMP, SaveExtra, ".\\drwat.txt", AppName,
hwnd, GetListBoxHwnd( MainLBox ) );
break;
case MENU_FONT:
if( ChooseMonoFont( hwnd ) ) {
SetListBoxFont( MainLBox );
}
break;
case MENU_MARK:
ProcessMark( hwnd, Instance, MarkPrint );
break;
case MENU_ABOUT:
ai.owner = hwnd;
ai.inst = Instance;
ai.name = AllocRCString( STR_ABOUT_NAME );
ai.version = AllocRCString( STR_ABOUT_VERSION );
ai.first_cr_year = "1993";
//.........这里部分代码省略.........