本文整理汇总了C++中IsIconic函数的典型用法代码示例。如果您正苦于以下问题:C++ IsIconic函数的具体用法?C++ IsIconic怎么用?C++ IsIconic使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsIconic函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: directx_wnd_proc
/* directx_wnd_proc:
* Window procedure for the Allegro window class.
*/
static LRESULT CALLBACK directx_wnd_proc(HWND wnd, UINT message, WPARAM wparam, LPARAM lparam)
{
PAINTSTRUCT ps;
if (message == msg_call_proc)
return ((int (*)(void))wparam) ();
if (message == msg_suicide) {
DestroyWindow(wnd);
return 0;
}
/* See get_reverse_mapping() in wkeybd.c to see what this is for. */
if (FALSE && (message == WM_KEYDOWN || message == WM_SYSKEYDOWN)) {
static char name[256];
TCHAR str[256];
WCHAR wstr[256];
GetKeyNameText(lparam, str, sizeof str);
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, str, -1, wstr, sizeof wstr);
uconvert((char *)wstr, U_UNICODE, name, U_CURRENT, sizeof name);
_TRACE(PREFIX_I" key[%s] = 0x%08lx;\n", name, lparam & 0x1ff0000);
}
switch (message) {
case WM_CREATE:
if (!user_wnd_proc)
allegro_wnd = wnd;
break;
case WM_DESTROY:
if (user_wnd_proc) {
exit_window_modules(NULL);
_win_reset_switch_mode();
}
else {
PostQuitMessage(0);
}
allegro_wnd = NULL;
break;
case WM_SETCURSOR:
if (!user_wnd_proc || _mouse_installed) {
mouse_set_syscursor();
return 1; /* not TRUE */
}
break;
case WM_ACTIVATE:
if (LOWORD(wparam) == WA_INACTIVE) {
_win_switch_out();
}
else {
/* Ignore the WM_ACTIVATE event if the window is minimized. */
if (HIWORD(wparam))
break;
if (gfx_driver && !gfx_driver->windowed) {
/* 1.2s delay to let Windows complete the switch in fullscreen mode */
SetTimer(allegro_wnd, SWITCH_TIMER, 1200, NULL);
}
else {
/* no delay in windowed mode */
_win_switch_in();
}
}
break;
case WM_TIMER:
if (wparam == SWITCH_TIMER) {
KillTimer(allegro_wnd, SWITCH_TIMER);
_win_switch_in();
return 0;
}
break;
case WM_ENTERSIZEMOVE:
if (win_gfx_driver && win_gfx_driver->enter_sysmode)
win_gfx_driver->enter_sysmode();
break;
case WM_EXITSIZEMOVE:
if (win_gfx_driver && win_gfx_driver->exit_sysmode)
win_gfx_driver->exit_sysmode();
break;
case WM_MOVE:
if (GetActiveWindow() == allegro_wnd) {
if (!IsIconic(allegro_wnd)) {
wnd_x = (short) LOWORD(lparam);
wnd_y = (short) HIWORD(lparam);
if (win_gfx_driver && win_gfx_driver->move)
win_gfx_driver->move(wnd_x, wnd_y, wnd_width, wnd_height);
}
//.........这里部分代码省略.........
示例2: UpdaterWndProc
INT_PTR CALLBACK UpdaterWndProc(
__in HWND hwndDlg,
__in UINT uMsg,
__in WPARAM wParam,
__in LPARAM lParam
)
{
switch (uMsg)
{
case WM_INITDIALOG:
{
LOGFONT lHeaderFont = { 0 };
// load the PH main icon using the 'magic' resource id.
HANDLE hPhIcon = LoadImage(
GetModuleHandle(NULL),
MAKEINTRESOURCE(PHAPP_IDI_PROCESSHACKER),
IMAGE_ICON,
GetSystemMetrics(SM_CXICON),
GetSystemMetrics(SM_CYICON),
LR_SHARED
);
// Set our initial state as download
PhUpdaterState = Download;
// Set the window icon.
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hPhIcon);
lHeaderFont.lfHeight = -15;
lHeaderFont.lfWeight = FW_MEDIUM;
lHeaderFont.lfQuality = CLEARTYPE_QUALITY | ANTIALIASED_QUALITY;
// We don't check if Segoe exists, CreateFontIndirect does this for us.
wcscpy_s(
lHeaderFont.lfFaceName,
_countof(lHeaderFont.lfFaceName),
L"Segoe UI"
);
// Create the font handle.
FontHandle = CreateFontIndirectW(&lHeaderFont);
// Set the header font.
SendMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), WM_SETFONT, (WPARAM)FontHandle, FALSE);
// Center the update window on PH if visible and not mimimized else center on desktop.
PhCenterWindow(hwndDlg, (IsWindowVisible(GetParent(hwndDlg)) && !IsIconic(GetParent(hwndDlg))) ? GetParent(hwndDlg) : NULL);
// Create our update check thread.
UpdateCheckThreadHandle = PhCreateThread(0, (PUSER_THREAD_START_ROUTINE)CheckUpdateThreadStart, hwndDlg);
}
break;
case WM_SHOWDIALOG:
{
if (IsIconic(hwndDlg))
ShowWindow(hwndDlg, SW_RESTORE);
else
ShowWindow(hwndDlg, SW_SHOW);
SetForegroundWindow(hwndDlg);
}
break;
case WM_CTLCOLORBTN:
case WM_CTLCOLORDLG:
case WM_CTLCOLORSTATIC:
{
HDC hDC = (HDC)wParam;
HWND hwndChild = (HWND)lParam;
// Check for our static label and change the color.
if (GetDlgCtrlID(hwndChild) == IDC_MESSAGE)
{
SetTextColor(hDC, RGB(19, 112, 171));
}
// Set a transparent background for the control backcolor.
SetBkMode(hDC, TRANSPARENT);
// set window background color.
return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);
}
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case IDCANCEL:
case IDOK:
{
PostQuitMessage(0);
}
break;
case IDC_DOWNLOAD:
{
switch (PhUpdaterState)
{
case Download:
{
if (PhInstalledUsingSetup())
{
//.........这里部分代码省略.........
示例3: set_active_window
/*******************************************************************
* set_active_window
*/
static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
{
HWND previous = GetActiveWindow();
BOOL ret;
DWORD old_thread, new_thread;
CBTACTIVATESTRUCT cbt;
if (previous == hwnd)
{
if (prev) *prev = hwnd;
return TRUE;
}
/* call CBT hook chain */
cbt.fMouse = mouse;
cbt.hWndActive = previous;
if (HOOK_CallHooks( WH_CBT, HCBT_ACTIVATE, (WPARAM)hwnd, (LPARAM)&cbt, TRUE )) return FALSE;
if (IsWindow(previous))
{
SendMessageW( previous, WM_NCACTIVATE, FALSE, (LPARAM)hwnd );
SendMessageW( previous, WM_ACTIVATE,
MAKEWPARAM( WA_INACTIVE, IsIconic(previous) ), (LPARAM)hwnd );
}
SERVER_START_REQ( set_active_window )
{
req->handle = wine_server_user_handle( hwnd );
if ((ret = !wine_server_call_err( req )))
previous = wine_server_ptr_handle( reply->previous );
}
SERVER_END_REQ;
if (!ret) return FALSE;
if (prev) *prev = previous;
if (previous == hwnd) return TRUE;
if (hwnd)
{
/* send palette messages */
if (SendMessageW( hwnd, WM_QUERYNEWPALETTE, 0, 0 ))
SendMessageTimeoutW( HWND_BROADCAST, WM_PALETTEISCHANGING, (WPARAM)hwnd, 0,
SMTO_ABORTIFHUNG, 2000, NULL );
if (!IsWindow(hwnd)) return FALSE;
}
old_thread = previous ? GetWindowThreadProcessId( previous, NULL ) : 0;
new_thread = hwnd ? GetWindowThreadProcessId( hwnd, NULL ) : 0;
if (old_thread != new_thread)
{
HWND *list, *phwnd;
if ((list = WIN_ListChildren( GetDesktopWindow() )))
{
if (old_thread)
{
for (phwnd = list; *phwnd; phwnd++)
{
if (GetWindowThreadProcessId( *phwnd, NULL ) == old_thread)
SendMessageW( *phwnd, WM_ACTIVATEAPP, 0, new_thread );
}
}
if (new_thread)
{
for (phwnd = list; *phwnd; phwnd++)
{
if (GetWindowThreadProcessId( *phwnd, NULL ) == new_thread)
SendMessageW( *phwnd, WM_ACTIVATEAPP, 1, old_thread );
}
}
HeapFree( GetProcessHeap(), 0, list );
}
}
if (IsWindow(hwnd))
{
SendMessageW( hwnd, WM_NCACTIVATE, (hwnd == GetForegroundWindow()), (LPARAM)previous );
SendMessageW( hwnd, WM_ACTIVATE,
MAKEWPARAM( mouse ? WA_CLICKACTIVE : WA_ACTIVE, IsIconic(hwnd) ),
(LPARAM)previous );
if (GetAncestor( hwnd, GA_PARENT ) == GetDesktopWindow())
PostMessageW( GetDesktopWindow(), WM_PARENTNOTIFY, WM_NCACTIVATE, (LPARAM)hwnd );
if (hwnd == GetForegroundWindow() && !IsIconic( hwnd ))
USER_Driver->pSetActiveWindow( hwnd );
}
/* now change focus if necessary */
if (focus)
{
GUITHREADINFO info;
info.cbSize = sizeof(info);
GetGUIThreadInfo( GetCurrentThreadId(), &info );
/* Do not change focus if the window is no more active */
if (hwnd == info.hwndActive)
{
//.........这里部分代码省略.........
示例4: d3d_frame
static bool d3d_frame(void *data, const void *frame,
unsigned width, unsigned height, unsigned pitch,
const char *msg)
{
d3d_video_t *d3d = (d3d_video_t*)data;
if (!frame)
return true;
RARCH_PERFORMANCE_INIT(d3d_frame);
RARCH_PERFORMANCE_START(d3d_frame);
// We cannot recover in fullscreen.
if (d3d->needs_restore && IsIconic(d3d->hWnd))
return true;
if (d3d->needs_restore && !d3d_restore(d3d))
{
RARCH_ERR("[D3D]: Failed to restore.\n");
return false;
}
if (d3d->should_resize)
{
d3d_calculate_rect(d3d, d3d->screen_width, d3d->screen_height, d3d->video_info.force_aspect, g_extern.system.aspect_ratio);
renderchain_set_final_viewport(d3d->chain, &d3d->final_viewport);
d3d_recompute_pass_sizes(d3d);
d3d->should_resize = false;
}
// render_chain() only clears out viewport, clear out everything.
D3DVIEWPORT screen_vp;
screen_vp.X = 0;
screen_vp.Y = 0;
screen_vp.MinZ = 0;
screen_vp.MaxZ = 1;
screen_vp.Width = d3d->screen_width;
screen_vp.Height = d3d->screen_height;
d3d->dev->SetViewport(&screen_vp);
d3d->dev->Clear(0, 0, D3DCLEAR_TARGET, 0, 1, 0);
// Insert black frame first, so we can screenshot, etc.
if (g_settings.video.black_frame_insertion)
{
if (d3d->dev->Present(NULL, NULL, NULL, NULL) != D3D_OK)
{
RARCH_ERR("[D3D]: Present() failed.\n");
d3d->needs_restore = true;
return true;
}
d3d->dev->Clear(0, 0, D3DCLEAR_TARGET, 0, 1, 0);
}
if (!renderchain_render(d3d->chain, frame, width, height, pitch, d3d->dev_rotation))
{
RARCH_ERR("[D3D]: Failed to render scene.\n");
return false;
}
if (d3d->font_ctx && d3d->font_ctx->render_msg)
{
font_params_t font_parms = {0};
#ifdef _XBOX
#if defined(_XBOX1)
float msg_width = 60;
float msg_height = 365;
#elif defined(_XBOX360)
float msg_width = (g_extern.lifecycle_state & (1ULL << MODE_MENU_HD)) ? 160 : 100;
float msg_height = 120;
#endif
font_parms.x = msg_width;
font_parms.y = msg_height;
font_parms.scale = 21;
#endif
d3d->font_ctx->render_msg(d3d, msg, &font_parms);
}
#ifdef HAVE_MENU
if (d3d->rgui && d3d->rgui->enabled)
d3d_overlay_render(d3d, d3d->rgui);
#endif
#ifdef HAVE_OVERLAY
if (d3d->overlays_enabled)
{
for (unsigned i = 0; i < d3d->overlays.size(); i++)
d3d_overlay_render(d3d, &d3d->overlays[i]);
}
#endif
RARCH_PERFORMANCE_STOP(d3d_frame);
#ifdef HAVE_MENU
if (g_extern.lifecycle_state & (1ULL << MODE_MENU) && driver.menu_ctx && driver.menu_ctx->frame)
driver.menu_ctx->frame(d3d);
#endif
if (d3d && d3d->ctx_driver && d3d->ctx_driver->update_window_title)
d3d->ctx_driver->update_window_title(d3d);
//.........这里部分代码省略.........
示例5: WindowProc
LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if ( wmode )
{
// Perform W-Mode only functionality
switch ( uMsg )
{
case WM_SIZING:
{
SIZE border;
GetBorderSize(hWnd, &border);
RECT *rct = (RECT*)lParam;
SIZE ws = { rct->right - rct->left - border.cx, rct->bottom - rct->top - border.cy };
if ( ws.cx < WMODE_MIN_WIDTH )
{
ws.cx = WMODE_MIN_WIDTH;
CorrectWindowWidth(wParam, &ws, rct, &border);
}
if ( ws.cy < WMODE_MIN_HEIGHT )
{
ws.cy = WMODE_MIN_HEIGHT;
CorrectWindowHeight(wParam, &ws, rct, &border);
}
if ( GetKeyState(VK_CONTROL) & 0x8000 && ws.cy != ws.cx * 3 / 4 )
{
if ( wParam == WMSZ_TOP || wParam == WMSZ_BOTTOM )
{
ws.cx = ws.cy * 4 / 3;
CorrectWindowWidth(WMSZ_RIGHT, &ws, rct, &border);
}
else
{
ws.cy = ws.cx * 3 / 4;
CorrectWindowHeight( (wParam == WMSZ_RIGHT || wParam == WMSZ_LEFT) ? WMSZ_BOTTOM : wParam, &ws, rct, &border);
}
}
if ( isCorrectVersion ) // must be correct version to reference BWDATA
{
if ( ws.cx >= BW::BWDATA::GameScreenBuffer.width() - WMODE_SNAP_RANGE &&
ws.cx <= BW::BWDATA::GameScreenBuffer.width() + WMODE_SNAP_RANGE )
{
ws.cx = BW::BWDATA::GameScreenBuffer.width();
CorrectWindowWidth( (wParam == WMSZ_TOP || wParam == WMSZ_BOTTOM) ? WMSZ_RIGHT : wParam, &ws, rct, &border);
}
if ( ws.cy >= BW::BWDATA::GameScreenBuffer.height() - WMODE_SNAP_RANGE &&
ws.cy <= BW::BWDATA::GameScreenBuffer.height() + WMODE_SNAP_RANGE )
{
ws.cy = BW::BWDATA::GameScreenBuffer.height();
CorrectWindowHeight( (wParam == WMSZ_RIGHT || wParam == WMSZ_LEFT) ? WMSZ_BOTTOM : wParam, &ws, rct, &border);
}
}
break;
} // case WM_SIZING
case WM_SIZE:
{
switch ( wParam )
{
case SIZE_RESTORED:
{
RECT tempRect;
GetClientRect(hWnd, &tempRect);
windowRect.right = tempRect.right;
windowRect.bottom = tempRect.bottom;
WriteConfig("window", "width", tempRect.right);
WriteConfig("window", "height", tempRect.bottom);
break;
}
}// wParam switch
break;
} // case WM_SIZE
case WM_MOVE:
{
RECT tempRect;
GetWindowRect(hWnd, &tempRect);
if ( tempRect.right > 0 &&
tempRect.bottom > 0 &&
tempRect.left < GetSystemMetrics(SM_CXFULLSCREEN) &&
tempRect.top < GetSystemMetrics(SM_CYFULLSCREEN) )
{
windowRect.left = tempRect.left;
windowRect.top = tempRect.top;
WriteConfig("window", "left", tempRect.left);
WriteConfig("window", "top", tempRect.top);
}
break;
} // case WM_MOVE
case WM_PAINT:
if ( gbWantUpdate && pBits)
{
static DWORD dwLastUpdate = 0;
DWORD dwNewTick = GetTickCount();
if ( dwLastUpdate + (IsIconic(hWnd) ? 200 : 20) > dwNewTick )
break;
dwLastUpdate = dwNewTick;
gbWantUpdate = false;
// begin paint
//.........这里部分代码省略.........
示例6: update_subwindow
static int update_subwindow(void)
{
int x,y;
RECT rd;
WINDOWPOS wp;
if(!sub_window)
{
WinID = -1;
if(IsWindowVisible(mygui->subwindow) && guiInfo.sh_video && guiInfo.Playing)
{
ShowWindow(mygui->subwindow, SW_HIDE);
return 0;
}
else if(!guiInfo.VideoWindow)
return 0;
else ShowWindow(mygui->subwindow, SW_SHOW);
}
/* we've come out of fullscreen at the end of file */
if((!IsWindowVisible(mygui->subwindow) || IsIconic(mygui->subwindow)) && guiInfo.VideoWindow)
ShowWindow(mygui->subwindow, SW_SHOWNORMAL);
/* get our current window coordinates */
GetWindowRect(mygui->subwindow, &rd);
x = rd.left;
y = rd.top;
/* restore sub window position when coming out of fullscreen */
if(x <= 0) x = old_rect.left;
if(y <= 0) y = old_rect.top;
if(!guiInfo.Playing)
{
window *desc = NULL;
int i;
for (i=0; i<mygui->skin->windowcount; i++)
if(mygui->skin->windows[i]->type == wiSub)
desc = mygui->skin->windows[i];
rd.right = rd.left+desc->base->bitmap[0]->width;
rd.bottom = rd.top+desc->base->bitmap[0]->height;
sub_aspect = (float)(rd.right-rd.left)/(rd.bottom-rd.top);
}
else
{
rd.right = rd.left+guiInfo.VideoWidth;
rd.bottom = rd.top+guiInfo.VideoHeight;
if (movie_aspect > 0.0) // forced aspect from the cmdline
sub_aspect = movie_aspect;
}
AdjustWindowRect(&rd, WS_OVERLAPPEDWINDOW | WS_SIZEBOX, 0);
SetWindowPos(mygui->subwindow, 0, x, y, rd.right-rd.left, rd.bottom-rd.top, SWP_NOOWNERZORDER);
wp.hwnd = mygui->subwindow;
wp.x = rd.left;
wp.y = rd.top;
wp.cx = rd.right-rd.left;
wp.cy = rd.bottom-rd.top;
wp.flags = SWP_NOOWNERZORDER | SWP_SHOWWINDOW;
/* erase the bitmap image if there's video */
if(guiInfo.Playing != GUI_STOP && guiInfo.sh_video)
SendMessage(mygui->subwindow, WM_ERASEBKGND, (WPARAM)GetDC(mygui->subwindow), 0);
/* reset the window aspect */
SendMessage(mygui->subwindow, WM_WINDOWPOSCHANGED, 0, (LPARAM)&wp);
return 0;
}
示例7: return
//---------------------------------------------------------------------
bool D3D10RenderWindow::isVisible() const
{
return (mHWnd && !IsIconic(mHWnd));
}
示例8: HostWndProcW
//.........这里部分代码省略.........
case WM_MOUSEMOVE:
recordMouseEvent(lastMessage);
break;
case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN:
case WM_MBUTTONDOWN:
if(GetFocus() != hwnd) SetFocus(hwnd);
SetCapture(hwnd); /* capture mouse input */
recordMouseEvent(lastMessage);
break;
case WM_LBUTTONUP:
case WM_RBUTTONUP:
case WM_MBUTTONUP:
if(GetFocus() != hwnd) SetFocus(hwnd);
ReleaseCapture(); /* release mouse capture */
recordMouseEvent(lastMessage);
break;
/*keyboard events*/
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
case WM_KEYUP:
case WM_SYSKEYUP:
case WM_CHAR:
case WM_SYSCHAR:
recordKeyboardEvent(lastMessage);
break;
/*window events*/
case WM_MOVE:
case WM_SIZE:
if ((GetWindowRect(hwnd, &boundingRect)) != 0){
sqWindowEvent *windowevent = (sqWindowEvent*) sqNextEventPut();
windowevent->type = EventTypeWindow;
windowevent->timeStamp = lastMessage ? lastMessage->time : GetTickCount();
windowevent->action = WindowEventMetricChange;
windowevent->value1 = boundingRect.left ;
windowevent->value2 = boundingRect.top;
windowevent->value3 = boundingRect.right;
windowevent->value4 = boundingRect.bottom;
windowevent->windowIndex =(int) hwnd;
}
break;
case WM_PAINT:
if ((GetWindowRect(hwnd, &boundingRect)) != 0){
sqWindowEvent *windowevent = (sqWindowEvent*) sqNextEventPut();
windowevent->type = EventTypeWindow;
windowevent->timeStamp = lastMessage ? lastMessage->time : GetTickCount();
windowevent->action = WindowEventPaint;
windowevent->value1 = boundingRect.left ;
windowevent->value2 = boundingRect.top;
windowevent->value3 = boundingRect.right;
windowevent->value4 = boundingRect.bottom;
windowevent->windowIndex =(int) hwnd;
}
break;
case WM_CLOSE:
{
sqWindowEvent *windowevent = (sqWindowEvent*) sqNextEventPut();
windowevent->type = EventTypeWindow;
windowevent->timeStamp = lastMessage ? lastMessage->time : GetTickCount();
windowevent->action = WindowEventClose;
windowevent->windowIndex =(int) hwnd;
}
break;
case WM_ACTIVATE:
{
sqWindowEvent *windowevent = (sqWindowEvent*) sqNextEventPut();
windowevent->type = EventTypeWindow;
windowevent->timeStamp = lastMessage ? lastMessage->time : GetTickCount();
if (wParam == WA_INACTIVE) windowevent->action = WindowEventIconise;
else windowevent->action = WindowEventActivated;
windowevent->windowIndex =(int) hwnd;
}
break;
case WM_GETMINMAXINFO:
{
sqWindowEvent *windowevent = (sqWindowEvent*) sqNextEventPut();
windowevent->type = EventTypeWindow;
windowevent->timeStamp = lastMessage ? lastMessage->time : GetTickCount();
if (IsIconic(hwnd) != 0)windowevent->action = WindowEventIconise;
else windowevent->action = WindowEventActivated;
windowevent->windowIndex =(int) hwnd;
}
break;
}
return DefWindowProcW(hwnd,message,wParam,lParam);
}
示例9: switch
LRESULT CALLBACK Explorerplusplus::TabProxyWndProc(HWND hwnd,UINT Msg,WPARAM wParam,LPARAM lParam,int iTabId)
{
switch(Msg)
{
case WM_ACTIVATE:
/* Restore the main window if necessary, and switch
to the actual tab. */
if(IsIconic(m_hContainer))
{
ShowWindow(m_hContainer,SW_RESTORE);
}
OnSelectTab(iTabId,FALSE);
return 0;
break;
case WM_SETFOCUS:
SetFocus(m_hListView[iTabId]);
break;
case WM_SYSCOMMAND:
switch(wParam)
{
case SC_CLOSE:
break;
default:
SendMessage(m_hListView[iTabId],WM_SYSCOMMAND,wParam,lParam);
break;
}
break;
/* Generate a thumbnail of the current tab. Basic procedure:
1. Generate a full-scale bitmap of the main window.
2. Overlay a bitmap of the specified tab onto the main
window bitmap.
3. Shrink the resulting bitmap down to the correct thumbnail size.
A thumbnail will be dynamically generated, provided the main window
is not currently minimized (as we won't be able to grap a screenshot
of it). If the main window is minimized, we'll use a cached screenshot
of the tab (taken before the main window was minimized). */
case WM_DWMSENDICONICTHUMBNAIL:
{
HDC hdc;
HDC hdcSrc;
HBITMAP hbmTab = NULL;
HBITMAP hPrevBitmap;
Gdiplus::Color color(0,0,0);
HRESULT hr;
int iBitmapWidth;
int iBitmapHeight;
int iWidth;
int iHeight;
int iMaxWidth;
int iMaxHeight;
iMaxWidth = HIWORD(lParam);
iMaxHeight = LOWORD(lParam);
/* If the main window is minimized, it won't be possible
to generate a thumbnail for any of the tabs. In that
case, use a static 'No Preview Available' bitmap. */
if(IsIconic(m_hContainer))
{
hbmTab = (HBITMAP)LoadImage(GetModuleHandle(0),MAKEINTRESOURCE(IDB_NOPREVIEWAVAILABLE),IMAGE_BITMAP,0,0,0);
SetBitmapDimensionEx(hbmTab,223,130,NULL);
}
else
{
hbmTab = CaptureTabScreenshot(iTabId);
}
SIZE sz;
GetBitmapDimensionEx(hbmTab,&sz);
iBitmapWidth = sz.cx;
iBitmapHeight = sz.cy;
/* Shrink the bitmap. */
HDC hdcThumbnailSrc;
HBITMAP hbmThumbnail;
POINT pt;
hdc = GetDC(m_hContainer);
hdcSrc = CreateCompatibleDC(hdc);
SelectObject(hdcSrc,hbmTab);
hdcThumbnailSrc = CreateCompatibleDC(hdc);
/* If the current height of the main window
is less than the width, we'll create a thumbnail
of maximum width; else maximum height. */
if((iBitmapWidth / iMaxWidth) > (iBitmapHeight / iMaxHeight))
{
iWidth = iMaxWidth;
//.........这里部分代码省略.........
示例10: MainWindowProc
/*
* MainWindowProc - procedure for main (root) window
*/
WINEXPORT LRESULT CALLBACK MainWindowProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
RECT rect;
vi_rc rc;
HANDLE hfileinfo;
int cnt, i;
char *buff;
switch( msg ) {
case WM_CREATE:
root_window_id = hwnd;
GetClientRect( hwnd, &rect );
edit_container_id = CreateContainerWindow( &rect );
InitWindows();
DragAcceptFiles( hwnd, TRUE );
timerID = SetTimer( hwnd, TIMER_ID, 60L * 1000L, NULL );
break;
case WM_DROPFILES:
hfileinfo = (HANDLE) wparam;
cnt = DragQueryFile( hfileinfo, (UINT)-1, NULL, 0 );
buff = alloca( FILENAME_MAX + 2 ); /* we add a " at the beginning and at the end so we can handle path- and filenames with spaces */
if( buff != NULL ) {
buff[0] = '"'; /* one " at the beginning of the filename */
for( i = 0; i < cnt; i++ ) {
if( DragQueryFile( hfileinfo, i, buff + 1, FILENAME_MAX ) == (UINT)-1 ) {
break;
}
strcat( buff, SingleQuote );
rc = EditFile( buff, false );
if( rc > ERR_NO_ERR ) {
Error( GetErrorMsg( rc ) );
}
}
}
DragFinish( hfileinfo );
break;
case WM_TIMER:
UpdateStatusWindow();
break;
case WM_KEYDOWN:
if( WindowsKeyPush( wparam, HIWORD( lparam ) ) ) {
return( 0 );
}
break;
case WM_SIZE:
DefFrameProc( hwnd, edit_container_id, msg, wparam, lparam );
RootState = wparam;
if( wparam != SIZE_MINIMIZED ) {
ResizeRoot();
GetWindowRect( hwnd, &RootRect );
if( wparam != SIZE_MAXIMIZED ) {
RootState = 0;
}
}
return( 0 );
case WM_MOVE:
DefFrameProc( hwnd, edit_container_id, msg, wparam, lparam );
if( RootState != SIZE_MINIMIZED ) {
GetWindowRect( hwnd, &RootRect );
}
return( 0 );
case WM_ACTIVATEAPP:
if( BAD_ID( current_window_id ) ) {
break;
}
SetFocus( root_window_id );
#if 0
if( !wparam ) {
InactiveWindow( current_window_id );
} else {
SendMessage( edit_container_id, WM_MDIACTIVATE, (WPARAM)current_window_id, 0L );
}
#endif
if( wparam ) {
ResetEditWindowCursor( current_window_id );
} else {
GoodbyeCursor( current_window_id );
}
break;
case WM_MOUSEACTIVATE:
SetFocus( hwnd );
return( MA_ACTIVATE );
case WM_SETFOCUS:
if( BAD_ID( current_window_id ) ) {
break;
}
if( !IsIconic( current_window_id ) ) {
SendMessage( edit_container_id, WM_MDIACTIVATE, (WPARAM)current_window_id, 0L );
DCUpdate();
SetWindowCursor();
SetWindowCursorForReal();
return( 0 );
}
break;
case WM_NCLBUTTONDBLCLK:
break;
case WM_COMMAND:
//.........这里部分代码省略.........
示例11: winMWExtWMWindowProc
//.........这里部分代码省略.........
&& winIsInternalWMRunning(pScreenInfo)) {
#if CYGMULTIWINDOW_DEBUG
winDebug("\twindow z order was changed\n");
#endif
if (pWinPos->hwndInsertAfter == HWND_TOP
|| pWinPos->hwndInsertAfter == HWND_TOPMOST
|| pWinPos->hwndInsertAfter == HWND_NOTOPMOST) {
#if CYGMULTIWINDOW_DEBUG
winDebug("\traise to top\n");
#endif
/* Raise the window to the top in Z order */
wmMsg.msg = WM_WM_RAISE;
if (fWMMsgInitialized)
winSendMessageToWM(pScreenPriv->pWMInfo, &wmMsg);
}
#if 1
else if (pWinPos->hwndInsertAfter == HWND_BOTTOM) {
}
else {
/* Check if this window is top of X windows. */
HWND hWndAbove = NULL;
DWORD dwCurrentProcessID = GetCurrentProcessId();
DWORD dwWindowProcessID = 0;
for (hWndAbove = pWinPos->hwndInsertAfter;
hWndAbove != NULL;
hWndAbove = GetNextWindow(hWndAbove, GW_HWNDPREV)) {
/* Ignore other XWin process's window */
GetWindowThreadProcessId(hWndAbove, &dwWindowProcessID);
if ((dwWindowProcessID == dwCurrentProcessID)
&& GetProp(hWndAbove, WIN_WINDOW_PROP)
&& !IsWindowVisible(hWndAbove)
&& !IsIconic(hWndAbove)) /* ignore minimized windows */
break;
}
/* If this is top of X windows in Windows stack,
raise it in X stack. */
if (hWndAbove == NULL) {
#if CYGMULTIWINDOW_DEBUG
winDebug("\traise to top\n");
#endif
/* Raise the window to the top in Z order */
wmMsg.msg = WM_WM_RAISE;
if (fWMMsgInitialized)
winSendMessageToWM(pScreenPriv->pWMInfo, &wmMsg);
}
}
#endif
}
if (!(pWinPos->flags & SWP_NOSIZE)) {
if (IsIconic(hwnd)) {
#if CYGMULTIWINDOW_DEBUG
winDebug("\tIconic -> MINIMIZED\n");
#endif
if (winIsInternalWMRunning(pScreenInfo)) {
/* Raise the window to the top in Z order */
wmMsg.msg = WM_WM_LOWER;
if (fWMMsgInitialized)
winSendMessageToWM(pScreenPriv->pWMInfo, &wmMsg);
}
winWindowsWMSendEvent(WindowsWMControllerNotify,
WindowsWMControllerNotifyMask,
1,
WindowsWMMinimizeWindow,
示例12: dc
void CTwoOptDlg::OnPaint()
{
// device context for painting
//CDC memDC ; // buffer context
CPaintDC dc(this);
if (IsIconic())
{
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
if ( CoordsMatrix_.size() < 1 ) return;
// device context for painting
CPen penDot(PS_DOT,1,RGB(255,0,0));
CPen penblack(PS_SOLID,3,RGB(0,0,0));
CRect rect;
GetClientRect(&rect);
int rectx1 = rect.left + 20;
int rectx2 = rect.right - 170;
int recty1 = rect.top + 25;
int recty2 = rect.bottom - bottom_limit;
dc.Rectangle(rectx1-5,recty1-5,rectx2+5,recty2+5);
// Plot each node
size_t tour_size = CoordsMatrix_.size();
for ( count = 0; count < tour_size; count++ )
{
Coords mat = CoordsMatrix_[count];
xc1 =static_cast<int>(mat.GetX());
yc1 = static_cast<int>(mat.GetY());
xn1 = (float) ( xc1 - MinX ) / (float) ( MaxX - MinX );
yn1 = (float) ( yc1 - MinY ) / (float) ( MaxY - MinY );
xcoord1 = rectx1 + (int) (float) ( xn1 * abs( rectx1 - rectx2 ) );
ycoord1 = recty2 - (int) (float) ( yn1 * abs( recty1 - recty2 ) );
dc.SelectObject(&penblack);
dc.Ellipse( xcoord1 - 2, ycoord1 - 2, xcoord1 + 2, ycoord1 + 2 );
//draw lines
dc.SelectObject(&penDot);
//draw last tour
if ( hasRun && count < tour_size - 1 && m_lasttour.Tour.size())
{
m_lasttour.Tour[count];
cc1 = static_cast<int>(m_lasttour.Tour[count]);
cc2 = static_cast<int>(m_lasttour.Tour[count +1]);
DrawNodes(cc1 , cc2, rectx1, rectx2, recty2, recty1, dc);
}
dc.SelectObject(&penblack);
if ( hasRun && count < tour_size - 1 && m_besttour.Tour.size())
{
cc1 = static_cast<int>(m_besttour.Tour[count]);
cc2 = static_cast<int>(m_besttour.Tour[count +1]);
DrawNodes(cc1 , cc2, rectx1, rectx2, recty2, recty1, dc);
}
}
// Draw final link
if ( hasRun )
{
if(m_lasttour.Tour.size())
{
cc1 = static_cast<int>(m_lasttour.Tour[tour_size-1]);
cc2 = static_cast<int>( m_lasttour.Tour[0]);
dc.SelectObject(&penDot);
DrawNodes(cc1 , cc2, rectx1, rectx2, recty2, recty1, dc);
}
if(m_besttour.Tour.size())
{
dc.SelectObject(&penblack);
cc1 = static_cast<int>(m_besttour.Tour[tour_size-1]);
cc2 = static_cast<int>(m_besttour.Tour[0]);
DrawNodes(cc1 , cc2, rectx1, rectx2, recty2, recty1, dc);
}
//.........这里部分代码省略.........
示例13: TWIN_DriverMessage
BOOL
TWIN_DriverMessage(LPMSG lpMsg, HWND hWnd,
UINT uMin, UINT uMax,UINT uFlg,BOOL bNoWait)
{
DWORD dwerv;
HANDLE hTask;
LPQUEUE lpQueue;
if (hWnd && !IsWindow(hWnd))
hWnd = 0;
if (hWnd)
hTask = GetWindowTask(hWnd);
else
hTask = GetCurrentTask();
lpQueue = QueueGetPtr(hTask);
/******************************************/
/* what is this? it is not called... */
/*hFocusTask = GetWindowTask(GetFocus()); */
/******************************************/
lpMsg->hwnd = 0;
labLoop:
while(1) {
while (lpSendMessageStack &&
lpSendMessageStack->hReceivingTask == GetCurrentTask() &&
!lpSendMessageStack->bSendReceived)
{
TWIN_ReceiveMessage(FALSE);
}
/* try for a message from application queue */
if (QueueGetMsg(lpQueue, lpMsg, hWnd, uMin, uMax, uFlg)) {
break;
}
/* try for a message from system queue */
if (QueueGetMsg(0,lpMsg,hWnd,uMin,uMax,uFlg)) {
break;
}
if (uMin <= WM_PAINT && (!uMax || uMax >= WM_PAINT)) {
/* finally, check if the window needs a paint message */
if(lpQueue->wQueueFlags & QFPAINT) {
labTryNext:
if((lpMsg->hwnd = InternalUpdateWindows())) {
if (TestWF(lpMsg->hwnd, WFNCDIRTY)) {
if (NonEmptyNCRect(lpMsg->hwnd)) {
lpMsg->message = WM_NCPAINT;
lpMsg->wParam = 0;
lpMsg->lParam = 0L;
break;
}
else {
ClearWF(lpMsg->hwnd, WFNCDIRTY);
}
}
if (TestWF(lpMsg->hwnd, WFDIRTY)) {
if (IsIconic(lpMsg->hwnd) &&
GetClassIcon(lpMsg->hwnd)) {
lpMsg->message = WM_PAINTICON;
lpMsg->wParam = 1;
}
else {
lpMsg->message = WM_PAINT;
lpMsg->wParam = 0;
}
lpMsg->lParam = 0L;
break;
}
else
goto labTryNext;
}
lpQueue->wQueueFlags &= ~QFPAINT;
}
}
if ((uMin <= WM_TIMER && (!uMax || uMax >= WM_TIMER)) ||
(uMin <= WM_SYSTIMER && (!uMax || uMax >= WM_SYSTIMER))) {
if(lpQueue->wQueueFlags & QFTIMER) {
if (TWIN_GetTimerMsg(hWnd,hTask,lpMsg,uFlg)) {
break;
}
}
}
/* none of the above, so see if system is ready. */
if (!TWIN_InDriverWait)
{
TWIN_InDriverWait = TRUE;
dwerv = DriverWaitEvent(TRUE);
TWIN_InDriverWait = FALSE;
if (!dwerv && !bNoWait)
{
/*
* The code here used to call ReadyTask(GetCurrentTask())
* before calling InternalYield(), but that results in
//.........这里部分代码省略.........
示例14: OnSize
void CImageWnd::OnSize(BOOL refreshNow)
{
if (m_pAppWnd == NULL)
return;
// If application window is being iconified, hide the current view
if (IsIconic(m_pAppWnd->m_hWnd))
{
if (m_pView)
m_pView->Hide();
return;
}
// Get application rectangle
CRect appRect;
m_pAppWnd->GetClientRect(appRect);
// Get view rectangle
CRect viewRect;
if (m_pViewWnd != NULL)
{
m_pViewWnd->GetWindowRect(viewRect);
m_pAppWnd->ScreenToClient(viewRect);
}
else
{
viewRect = appRect;
}
if (m_pViewWnd != NULL && m_pHorzScr != NULL && m_pVertScr != NULL)
{
// Get scroll bars rectangles
CRect horzRect, vertRect;
m_pHorzScr->GetWindowRect(horzRect);
m_pVertScr->GetWindowRect(vertRect);
m_pAppWnd->ScreenToClient(horzRect);
m_pAppWnd->ScreenToClient(vertRect);
// Adjust windows' position
viewRect.right = appRect.right - 5 - vertRect.Width();
viewRect.bottom = appRect.bottom - 5 - horzRect.Height();
m_pViewWnd->MoveWindow(viewRect.left, viewRect.top, viewRect.Width(), viewRect.Height(), TRUE);
horzRect.top = viewRect.bottom;
horzRect.right = viewRect.right;
horzRect.bottom = appRect.bottom - 5;
m_pHorzScr->MoveWindow(horzRect.left, horzRect.top, horzRect.Width(), horzRect.Height(), TRUE);
vertRect.left = viewRect.right;
vertRect.right = appRect.right - 5;
vertRect.bottom = viewRect.bottom;
m_pVertScr->MoveWindow(vertRect.left, vertRect.top, vertRect.Width(), vertRect.Height(), TRUE);
}
if (m_pView)
{
// Call corresponding handler
m_pView->OnSize(refreshNow);
// Update scroll bars' position and range
// Has to be called twice (JPC)
UpdateScrollBars();
UpdateScrollBars();
// Update view rectangle
m_ViewRect = viewRect;
m_ViewRect.left += m_pView->GetScaleParamsDst().Left();
m_ViewRect.top += m_pView->GetScaleParamsDst().Top();
m_ViewRect.right = m_ViewRect.left + m_pView->GetWidth();
m_ViewRect.bottom = m_ViewRect.top + m_pView->GetHeight();
// Update tracker limits
CRect limitRect;
limitRect.top = 0;
limitRect.left = 0;
limitRect.right = m_pView->GetWidth();
limitRect.bottom = m_pView->GetHeight();
m_RectTracker.SetLimitRect(&limitRect);
if (m_pViewWnd == NULL)
{
// Check if unused region of the AppWnd should be repainted
int viewWidth = m_pView->GetWidth();
int viewHeight = m_pView->GetHeight();
if (appRect.Width() > viewWidth)
{
CRect rect = appRect;
rect.left = viewWidth;
m_pAppWnd->InvalidateRect(rect, TRUE);
}
if (appRect.Height() > viewHeight)
{
CRect rect = appRect;
rect.top = viewHeight;
m_pAppWnd->InvalidateRect(rect, TRUE);
}
//.........这里部分代码省略.........
示例15: RedrawForce
/*
* Functions should call RedrawAll if they need the room to be redrawn.
* This sets a flag, and the next time an opportunity arises, the room
* is redrawn via a call to RedrawForce.
*/
void RedrawForce(void)
{
HDC hdc;
static DWORD lastEndFrame = 0;
DWORD endFrame, startFrame;
int totalFrameTime, oldMode;
char buffer[32];
if (GameGetState() == GAME_INVALID || /*!need_redraw ||*/ IsIconic(hMain) ||
view.cx == 0 || view.cy == 0 || current_room.rows == 0 || current_room.cols == 0)
{
need_redraw = False;
return;
}
timeBeginPeriod(1);
startFrame = timeGetTime();
/* REVIEW: Clearing flag before draw phase allows draw phase to set flag.
* This is useful in rare circumstances when an effect should
* last only one frame, even if animation is off.
*/
need_redraw = False;
hdc = GetDC(hMain);
DrawRoom(hdc, view.x, view.y, ¤t_room, map);
endFrame = timeGetTime();
msDrawFrame = (int)(endFrame - startFrame);
totalFrameTime = (int)(endFrame - lastEndFrame);
// if totalFrameTime is less than one, clamp to 1 so we don't divide by 0 or get negative fps
if (1 > totalFrameTime)
totalFrameTime = 1;
fps = 1000 / (int)totalFrameTime;
if (config.maxFPS)
{
if (fps > config.maxFPS)
{
int msSleep = (1000 / config.maxFPS) - totalFrameTime;
Sleep(msSleep);
}
}
lastEndFrame = endFrame;
timeEndPeriod(1);
if (config.showFPS)
{
RECT rc,lagBox;
wsprintf(buffer, "FPS=%d (%dms) ", fps, msDrawFrame);
ZeroMemory(&rc,sizeof(rc));
rc.bottom = DrawText(hdc,buffer,-1,&rc,DT_SINGLELINE|DT_CALCRECT);
Lagbox_GetRect(&lagBox);
OffsetRect(&rc,lagBox.right + TOOLBAR_SEPARATOR_WIDTH,lagBox.top);
DrawWindowBackground(hdc, &rc, rc.left, rc.top);
oldMode = SetBkMode(hdc,TRANSPARENT);
DrawText(hdc,buffer,-1,&rc,DT_SINGLELINE);
SetBkMode(hdc,oldMode);
GdiFlush();
}
ReleaseDC(hMain, hdc);
GameWindowSetCursor(); // We may have moved; reset cursor
}