本文整理汇总了C++中SetActiveWindow函数的典型用法代码示例。如果您正苦于以下问题:C++ SetActiveWindow函数的具体用法?C++ SetActiveWindow怎么用?C++ SetActiveWindow使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetActiveWindow函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetActiveWindow
void CToolDlg::OnNcRButtonDown(UINT nHitTest, CPoint point)
{
SetActiveWindow(); // base class doesn't activate us, though it should
UpdateWindow(); // else client area doesn't fully paint until button up
if (m_IsNonBlocking) {
// If you right-click in the caption bar, the message loop is blocked until
// you release the mouse button. This is unacceptable in a timer-driven app.
switch (nHitTest) {
case HTCAPTION:
break; // don't call base class, display context menu in OnNcRButtonUp
default:
CPersistDlg::OnNcRButtonDown(nHitTest, point);
}
} else // default behavior
CPersistDlg::OnNcRButtonDown(nHitTest, point);
}
示例2: GetActiveWindow
void dd_Window::setPosition(int x, int y)
{
//SetWindowPos(hwnd,0,x,y,0,0,SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE);
HWND hw = GetActiveWindow();
WINDOWPLACEMENT wp;
wp.length = sizeof(WINDOWPLACEMENT);
GetWindowPlacement(hwnd,&wp);
int w = wp.rcNormalPosition.right - wp.rcNormalPosition.left;
int h = wp.rcNormalPosition.bottom - wp.rcNormalPosition.top;
wp.rcNormalPosition.left = x;
wp.rcNormalPosition.top = y;
wp.rcNormalPosition.right = wp.rcNormalPosition.left + w;
wp.rcNormalPosition.bottom = wp.rcNormalPosition.top + h;
SetWindowPlacement(hwnd,&wp);
SetActiveWindow(hw);
}
示例3: ShowProperties
static void ShowProperties(HWND parent, Controller *ctrl, bool extended=false)
{
PropertiesLayout *layoutData = FindPropertyWindowByParent(parent);
if (layoutData) {
SetActiveWindow(layoutData->hwnd);
return;
}
if (!ctrl)
return;
layoutData = new PropertiesLayout();
gPropertiesWindows.Append(layoutData);
GetProps(ctrl, layoutData, extended);
if (!CreatePropertiesWindow(parent, layoutData))
delete layoutData;
}
示例4: GetInstance
void App::ShowProperties()
{
hInstance = GetInstance();
if (!hPropDialog) {
hPropDialog = CreateDialogParam(
GetInstance(),
MAKEINTRESOURCE(IDD_SHOW_PROPERTIES),
GetHWnd(),
(DLGPROC)PropDlgProc,
(LPARAM)this);
}
else {
SetActiveWindow(hPropDialog);
GetProperties();
}
}
示例5: WndProc
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
static HBITMAP hBit;
PAINTSTRUCT ps;
HGDIOBJ hOld;
HDC hMemDC;
RECT rt;
switch (iMsg)
{
case WM_CREATE:
hBit = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(101));
ShowCursor(FALSE);
SetFullScreen(hWnd);
return 0;
case WM_PAINT:
BeginPaint(hWnd, &ps);
GetClientRect(hWnd, &rt);
hMemDC = CreateCompatibleDC(ps.hdc);
hOld = SelectObject(hMemDC, hBit);
StretchBlt(ps.hdc, 0, 0, rt.right, rt.bottom, hMemDC, 0, 0, 640, 480, SRCCOPY);
SelectObject(hMemDC, hOld);
DeleteDC(hMemDC);
EndPaint(hWnd, &ps);
return 0;
#ifdef TEST
case WM_RBUTTONDOWN:
DestroyWindow(hWnd);
return 0;
#endif
case WM_SYSKEYDOWN:
case WM_SYSKEYUP:
case WM_SYSCOMMAND:
return 0;
case WM_ACTIVATE:
if (LOWORD(wParam) == WA_INACTIVE)
SetActiveWindow(hWnd);
return 0;
case WM_DESTROY:
DeleteObject(hBit);
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hWnd, iMsg, wParam, lParam);
}
示例6: clickChildButton
void clickChildButton (HWND dialog, const char *caption) {
HWND dialogItem = NULL;
while (1) {
dialogItem = FindWindowEx(dialog, dialogItem, NULL, NULL);
if (dialogItem == NULL) {
break;
}
char windowText[255];
GetWindowText(dialogItem, windowText, 255);
printf("found subitem: %s\n", windowText);
if (strcmp(windowText, caption) == 0) {
SetActiveWindow(dialog);
SendMessage(dialogItem, BM_CLICK, NULL, NULL);
break;
}
}
}
示例7: Create
void CDlgAddTask::PopupDlg(BOOL bBlank)
{
if (IsDlgPopedUp())
return;
m_uAddState = 2; // Added by Soar Chin 09/06/2007
Create(CDlgAddTask::IDD);
ShowWindow(SW_SHOW);
SetForegroundWindow();
SetWindowPos(&CWnd::wndTopMost, 0, 0, 0, 0,SWP_NOMOVE|SWP_NOSIZE);
SetActiveWindow();
SetFocus();
if (!bBlank)
GetDlgItem(IDOK)->SetFocus();
}
示例8: RestoreWndFromTray
void RestoreWndFromTray(HWND hWnd)
{
if(IsWindowVisible(hWnd))
return;
if(GetDoAnimateMinimize())
{
RECT rcFrom,rcTo;
GetTrayWndRect(&rcFrom);
GetWindowRect(hWnd,&rcTo);
DrawAnimatedRects(hWnd,IDANI_CAPTION,&rcFrom,&rcTo);
}
ShowWindow(hWnd,SW_SHOW);
SetActiveWindow(hWnd);
SetForegroundWindow(hWnd);
}
示例9: khm_activate_main_window
void
khm_activate_main_window(void) {
if (!SetForegroundWindow(khm_hwnd_main)) {
FLASHWINFO finfo;
SetActiveWindow(khm_hwnd_main);
ZeroMemory(&finfo, sizeof(finfo));
finfo.cbSize = sizeof(finfo);
finfo.hwnd = khm_hwnd_main;
finfo.dwFlags = FLASHW_ALL;
finfo.uCount = 3;
finfo.dwTimeout = 0;
FlashWindowEx(&finfo);
}
}
示例10: WinLuaOnStop
void WinLuaOnStop()
{
HWND hDlg = hLuaDlg;
//LuaPerWindowInfo& info = LuaWindowInfo[hDlg];
HWND prevWindow = GetActiveWindow();
SetActiveWindow(hDlg); // bring to front among other script/secondary windows, since a stopped script will have some message for the user that would be easier to miss otherwise
//if (prevWindow == AfxGetMainWnd()->GetSafeHwnd()) SetActiveWindow(prevWindow);
//info.started = false;
EnableWindow(GetDlgItem(hDlg, IDC_BUTTON_LUABROWSE), true);
EnableWindow(GetDlgItem(hDlg, IDC_BUTTON_LUASTOP), false);
SetWindowText(GetDlgItem(hDlg, IDC_BUTTON_LUARUN), "Run");
// if(statusOK)
// Show_Genesis_Screen(MainWindow->getHWnd()); // otherwise we might never show the last thing the script draws
//if(info.closeOnStop)
// PostMessage(hDlg, WM_CLOSE, 0, 0);
}
示例11: PopupHistoryShow
void PopupHistoryShow()
{
if (!PopupOptions.EnableHistory) {
MessageBox(NULL, TranslateT("Popup History is disabled"), TranslateT("Popup History message"), MB_OK);
return;
}
if (hwndHistory) {
ShowWindow(hwndHistory, SW_SHOW);
SetForegroundWindow(hwndHistory);
SetFocus(hwndHistory);
SetActiveWindow(hwndHistory);
}
else {
hwndHistory = CreateDialog(hInst, MAKEINTRESOURCE(IDD_HISTORY), NULL, HistoryDlgProc);
SetWindowText(hwndHistory, TranslateT("Popup History"));
}
}
示例12: HelperProc
LRESULT CALLBACK HelperProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_ACTIVATE:
if (LOWORD(wParam) != WA_INACTIVE) // Helper window got activated
SetActiveWindow(hMirandaWnd);
break;
case WM_DESTROY:
if (hWnd == hHelperWnd)
hHelperWnd = NULL;
else
hDummyWnd = NULL;
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
示例13: SetMinSize
void FCodecNotFoundDlg::OnCreated()
{
SetMinSize(640, 480);
SetIcon(LoadIcon(_Module.get_m_hInst(), MAKEINTRESOURCE(IDI_MAIN)));
FString Str;
GetWindowText(Str);
SetWindowText(LTV_APP_NAME": Codec not found");
if (FAILED(m_pW.Navigate(g_AppSettings.AppDir(Str))))
{
MessageBox("Cannot load error file.", "Error loading dialog", MB_OK | MB_ICONERROR);
DestroyWindow();
}
SetFocus();
SetActiveWindow();
}
示例14: winPopupDialog
static int winPopupDialog(Ihandle* n, int x, int y)
{
HWND last_hwnd;
HWND popup_hwnd;
Ihandle* parent = IupGetAttributeHandle(n, IUP_PARENTDIALOG);
if (parent && handle(parent))
last_hwnd = handle(parent);
else
last_hwnd = GetActiveWindow();
winShowXY(n, x, y);
if (iupGetEnv(n, "_IUPWIN_POPUP"))
return IUP_ERROR;
popup_hwnd = (HWND)handle(n);
/* disable all visible dialogs, and mark popup level */
/* will be enable by IupHide */
winDisableVisible(n);
iupSetEnv(n, "_IUPWIN_POPUP", "1"); /* mark window as popup so IupHide can also detect it */
/* interrupt processing here */
IupMainLoop();
/* if window is still valid (IupDestroy not called) */
if (IsWindow(popup_hwnd))
{
iupSetEnv(n, "_IUPWIN_POPUP", "2");
IupHide(n); /* hide the popup to update the disabled windows */
/* but do not call IupExitLoop again */
iupSetEnv(n, "_IUPWIN_POPUP", NULL); /* unmark the window */
}
/* activate the previous active window */
if (last_hwnd)
SetActiveWindow(last_hwnd);
return IUP_NOERROR;
}
示例15: SetActiveWindow
void CMainFrame::OnDropFiles(HDROP hDropInfo)
{
SetActiveWindow(); // activate us first !
UINT nFiles = ::DragQueryFile(hDropInfo, (UINT)-1, NULL, 0);
if (nFiles == 1)
{
//if only 1 file with .zpk extension, open it as a package
TCHAR szFileName[_MAX_PATH];
::DragQueryFile(hDropInfo, 0, szFileName, _MAX_PATH);
zp::String filename = szFileName;
size_t length = filename.length();
zp::String lowerExt;
if (length >= 4)
{
zp::String temp = filename.substr(length - 4, 4);
stringToLower(lowerExt, temp);
}
if (lowerExt == _T(".zpk"))
{
CWinApp* pApp = AfxGetApp();
pApp->OpenDocumentFile(szFileName);
return;
}
}
//more than 1 file, try to add to package
std::vector<zp::String> filenames(nFiles);
for (UINT i = 0; i < nFiles; i++)
{
TCHAR szFileName[_MAX_PATH];
::DragQueryFile(hDropInfo, i, szFileName, _MAX_PATH);
filenames[i] = szFileName;
}
CzpEditorDoc* doc = (CzpEditorDoc*)GetActiveDocument();
if (doc != NULL)
{
doc->addFilesToPackage(filenames);
}
::DragFinish(hDropInfo);
//CFrameWndEx::OnDropFiles(hDropInfo);
}