static void UpdateCursor( event_thread_t *p_event, bool b_show ) { if( p_event->is_cursor_hidden == !b_show ) return; p_event->is_cursor_hidden = !b_show; #if 1 HCURSOR cursor = b_show ? p_event->cursor_arrow : p_event->cursor_empty; if( p_event->hvideownd ) SetClassLongPtr( p_event->hvideownd, GCLP_HCURSOR, (LONG_PTR)cursor ); if( p_event->hwnd ) SetClassLongPtr( p_event->hwnd, GCLP_HCURSOR, (LONG_PTR)cursor ); #endif /* FIXME I failed to find a cleaner way to force a redraw of the cursor */ POINT p; GetCursorPos(&p); HWND hwnd = WindowFromPoint(p); if( hwnd == p_event->hvideownd || hwnd == p_event->hwnd ) { if( b_show ) SetCursor( cursor ); else SetCursorPos( p.x, p.y ); } }
BOOL CXTPSkinObjectToolBar::OnEraseBkgnd(CDC* pDC) { if (GetStyle() & (TBSTYLE_TRANSPARENT | TBSTYLE_CUSTOMERASE)) { return CXTPSkinObjectFrame::OnEraseBkgnd(pDC); } HBRUSH hbr = (HBRUSH)(DWORD_PTR)GetClassLongPtr(m_hWnd, GCLP_HBRBACKGROUND); BOOL bChanged = FALSE; if (hbr > 0 && (ULONG_PTR)hbr < (ULONG_PTR)XTP_SKINMETRICS_COLORTABLESIZE) { HBRUSH hbrTheme = GetMetrics()->m_brTheme[(ULONG_PTR)hbr - 1]; SetClassLongPtr(m_hWnd, GCLP_HBRBACKGROUND, (LONG_PTR)hbrTheme); bChanged = TRUE; } BOOL bResult = (BOOL)::DefWindowProc(m_hWnd, WM_ERASEBKGND, (WPARAM)pDC->GetSafeHdc(), 0); if (bChanged) { SetClassLongPtr(m_hWnd, GCLP_HBRBACKGROUND, (LONG_PTR)hbr); } return bResult; }
bool CAviSplitterSettingsWnd::OnActivate() { ASSERT(IPP_FONTSIZE == 13); DWORD dwStyle = WS_VISIBLE | WS_CHILD | WS_TABSTOP; CPoint p(10, 10); m_cbBadInterleavedSuport.Create (ResStr(IDS_AVISPLITTER_NON_INTERLEAVED), dwStyle|BS_AUTOCHECKBOX|BS_LEFTTEXT, CRect(p, CSize(IPP_SCALE(270), m_fontheight)), this, IDC_PP_INTERLEAVED_SUPPORT); p.y += IPP_SCALE(20); m_cbSetReindex.Create (ResStr(IDS_AVISPLITTER_REINDEX_BROKEN), dwStyle|BS_AUTOCHECKBOX|BS_LEFTTEXT, CRect(p, CSize(IPP_SCALE(270), m_fontheight)), this, IDC_PP_SET_REINDEX); if (m_pMSF) { m_cbBadInterleavedSuport.SetCheck(m_pMSF->GetBadInterleavedSuport()); m_cbSetReindex.SetCheck(m_pMSF->GetReindex()); } for (CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow()) { pWnd->SetFont(&m_font, FALSE); } SetClassLongPtr(m_hWnd, GCLP_HCURSOR, (long)AfxGetApp()->LoadStandardCursor(IDC_ARROW)); SetClassLongPtr(GetDlgItem(IDC_PP_INTERLEAVED_SUPPORT)->m_hWnd, GCLP_HCURSOR, (long)AfxGetApp()->LoadStandardCursor(IDC_HAND)); return true; }
bool CMpegSplitterSettingsWnd::OnActivate() { ASSERT(IPP_FONTSIZE == 13); const int h20 = IPP_SCALE(20); const int h25 = IPP_SCALE(25); const int h30 = IPP_SCALE(30); DWORD dwStyle = WS_VISIBLE | WS_CHILD | WS_TABSTOP; CPoint p(10, 10); m_cbForcedSub.Create(ResStr(IDS_MPEGSPLITTER_SUB_FORCING), dwStyle | BS_AUTOCHECKBOX | BS_LEFTTEXT, CRect(p, CSize(IPP_SCALE(305), m_fontheight)), this, IDC_PP_SUBTITLE_FORCED); p.y += h20; m_cbAlternativeDuration.Create(ResStr(IDS_MPEGSPLITTER_ALT_DUR_CALC), dwStyle | BS_AUTOCHECKBOX | BS_LEFTTEXT, CRect(p, CSize(IPP_SCALE(305), m_fontheight)), this, IDC_PP_ALTERNATIVE_DURATION); p.y += h20; m_cbSubEmptyPin.Create(ResStr(IDS_MPEGSPLITTER_SUB_EMPTY_PIN), dwStyle | BS_AUTOCHECKBOX | BS_LEFTTEXT, CRect(p, CSize(IPP_SCALE(305), m_fontheight)), this, IDC_PP_ENABLE_SUB_EMPTY_PIN); p.y += h25; #ifdef REGISTER_FILTER m_txtAudioLanguageOrder.Create(ResStr(IDS_MPEGSPLITTER_LANG_ORDER), WS_VISIBLE | WS_CHILD, CRect(p, CSize(IPP_SCALE(200), m_fontheight)), this, (UINT)IDC_STATIC); p.y += h20; m_edtAudioLanguageOrder.CreateEx(WS_EX_CLIENTEDGE, _T("EDIT"), _T(""), WS_CHILD | WS_VISIBLE | WS_TABSTOP, CRect(p, CSize(IPP_SCALE(305), m_fontheight + 6)), this, IDC_PP_AUDIO_LANGUAGE_ORDER); p.y += h25; m_txtSubtitlesLanguageOrder.Create(ResStr(IDS_MPEGSPLITTER_SUB_ORDER), WS_VISIBLE | WS_CHILD, CRect(p, CSize(IPP_SCALE(200), m_fontheight)), this, (UINT)IDC_STATIC); p.y += h20; m_edtSubtitlesLanguageOrder.CreateEx(WS_EX_CLIENTEDGE, _T("EDIT"), _T(""), WS_CHILD | WS_VISIBLE | WS_TABSTOP, CRect(p, CSize(IPP_SCALE(305), m_fontheight + 6)), this, IDC_PP_SUBTITLES_LANGUAGE_ORDER); p.y += h25; #endif m_grpTrueHD.Create(ResStr(IDS_MPEGSPLITTER_TRUEHD_OUTPUT), WS_VISIBLE | WS_CHILD | BS_GROUPBOX, CRect(p, CSize(IPP_SCALE(305), h20 + h20)), this, (UINT)IDC_STATIC); p.y += IPP_SCALE(15); p.x += IPP_SCALE(10); m_cbTrueHD.Create(_T("TrueHD"), dwStyle | BS_AUTORADIOBUTTON | BS_TOP | BS_MULTILINE | WS_GROUP, CRect(p, CSize(IPP_SCALE(60), m_fontheight + 2)), this, IDC_PP_TRUEHD); m_cbAC3Core.Create(_T("AC-3"), dwStyle | BS_AUTORADIOBUTTON | BS_TOP | BS_MULTILINE, CRect(p + CPoint(IPP_SCALE(160), 0), CSize(IPP_SCALE(60), m_fontheight + 2)), this, IDC_PP_AC3CORE); if (m_pMSF) { m_cbForcedSub.SetCheck(m_pMSF->GetForcedSub()); #ifdef REGISTER_FILTER m_edtAudioLanguageOrder.SetWindowText(m_pMSF->GetAudioLanguageOrder()); m_edtSubtitlesLanguageOrder.SetWindowText(m_pMSF->GetSubtitlesLanguageOrder()); #endif m_cbTrueHD.SetCheck(m_pMSF->GetTrueHD() == 0); m_cbAC3Core.SetCheck(!m_cbTrueHD.GetCheck()); m_cbAlternativeDuration.SetCheck(m_pMSF->GetAlternativeDuration()); m_cbSubEmptyPin.SetCheck(m_pMSF->GetSubEmptyPin()); } for (CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow()) { pWnd->SetFont(&m_font, FALSE); } SetClassLongPtr(m_hWnd, GCLP_HCURSOR, (long)AfxGetApp()->LoadStandardCursor(IDC_ARROW)); SetClassLongPtr(GetDlgItem(IDC_PP_SUBTITLE_FORCED)->m_hWnd, GCLP_HCURSOR, (long)AfxGetApp()->LoadStandardCursor(IDC_HAND)); SetDirty(false); return true; }
THREAD_ENTRY_DECLARE swap_icons(THREAD_ENTRY_PARAM param) { /****************************************************************************** * * S w a p I c o n s * ****************************************************************************** * * Description: Animates the icon if the server restarted *****************************************************************************/ Firebird::ContextPoolHolder threadContext(getDefaultMemoryPool()); HWND hWnd = static_cast<HWND>(param); HINSTANCE hInstance = (HINSTANCE) GetWindowLongPtr(hWnd, GWLP_HINSTANCE); HICON hIconNormal = (HICON) LoadImage(hInstance, MAKEINTRESOURCE(IDI_IBGUARD), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR); HICON hIconAlert = (HICON) LoadImage(hInstance, MAKEINTRESOURCE(IDI_IBGUARDALRT), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR); NOTIFYICONDATA nidNormal; nidNormal.cbSize = sizeof(NOTIFYICONDATA); nidNormal.hWnd = hWnd; nidNormal.uID = IDI_IBGUARD; nidNormal.uFlags = NIF_ICON; nidNormal.hIcon = hIconNormal; NOTIFYICONDATA nidAlert; nidAlert.cbSize = sizeof(NOTIFYICONDATA); nidAlert.hWnd = hWnd; nidAlert.uID = IDI_IBGUARD; nidAlert.uFlags = NIF_ICON; nidAlert.hIcon = hIconAlert; // Animate until the property sheet is displayed. Once the property sheet is // displayed, stop animating the icon while (!hPSDlg) { if (!Shell_NotifyIcon(NIM_MODIFY, &nidAlert)) SetClassLongPtr(hWnd, GCLP_HICON, (LONG_PTR) hIconAlert); Sleep(500); if (!Shell_NotifyIcon(NIM_MODIFY, &nidNormal)) SetClassLongPtr(hWnd, GCLP_HICON, (LONG_PTR) hIconNormal); Sleep(500); } // Make sure that the icon is normal if (!Shell_NotifyIcon(NIM_MODIFY, &nidNormal)) SetClassLongPtr(hWnd, GCLP_HICON, (LONG_PTR) hIconNormal); if (hIconNormal) DestroyIcon(hIconNormal); if (hIconAlert) DestroyIcon(hIconAlert); return 0; }
/******************************************************************** ** Frees window and class. Also destroys Ihandle information stored ** inside the window USERDATA atribute. ********************************************************************/ static void winDestroyFreeWindowClass(Ihandle *n) { char cname[255]; SetLastError(0); GetClassName(handle(n), cname, 255); assert(GetLastError() == 0); /* Ihandle will not be found when WM_DESTROY is called */ iupwinHandleRemove(n); if (iupCheck(n, "MDICLIENT")==YES) /* mdiclient class is not a IUP class */ { HWND hwndT; /* hide the MDI client window to avoid multiple repaints */ ShowWindow((HWND)handle(n), SW_HIDE); /* As long as the MDI client has a child, destroy it */ while (hwndT = GetWindow((HWND)handle(n), GW_CHILD)) { Ihandle* child; /* Skip the icon title windows */ while (hwndT && GetWindow (hwndT, GW_OWNER)) hwndT = GetWindow (hwndT, GW_HWNDNEXT); if (!hwndT) break; child = iupwinHandleGet(hwndT); if (child) IupDestroy(child); } return; } SetClassLongPtr((HWND)handle(n), GCLP_HBRBACKGROUND, 0); SetClassLongPtr((HWND)handle(n), GCLP_HCURSOR, 0); SetWindowLongPtr((HWND)handle(n), GWLP_WNDPROC, 0); /* Destroys window, so we can destroy the class */ SetLastError(0); if (iupCheck(n, "MDICHILD")==YES) { Ihandle* client = (Ihandle*)iupGetEnv(n, "_IUPWIN_MDICLIENT"); SendMessage((HWND)handle(client), WM_MDIDESTROY, (WPARAM)handle(n), 0); } else DestroyWindow(handle(n)); /* iupwinShowLastError(); */ SetLastError(0); UnregisterClass(cname, iupwin_hinstance); }
void BaseWindow::loadIcon(DWORD id) { if (m_hicon) { DeleteObject(m_hicon); m_hicon = 0; } if (IS_INTRESOURCE(id)) { m_hicon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(id)); SetClassLongPtr(m_hWnd, GCLP_HICON, reinterpret_cast<LONG_PTR>(m_hicon)); } else { SetClassLongPtr(m_hWnd, GCLP_HICON, static_cast<LONG_PTR>(id)); } }
void NMainWindow::updateFramelessShadow() { DWORD version = GetVersion(); DWORD major = (DWORD) (LOBYTE(LOWORD(version))); // major = 6 for vista/7/2008 if (_DwmIsCompositionEnabled() && m_framelessShadow && major == 6) SetClassLongPtr(winId(), GCL_STYLE, GetClassLongPtr(winId(), GCL_STYLE) | CS_DROPSHADOW); else SetClassLongPtr(winId(), GCL_STYLE, GetClassLongPtr(winId(), GCL_STYLE) & ~CS_DROPSHADOW); hide(); show(); }
/*------------------------------------------------------------------------------------------------------------------ -- FUNCTION: set_settings -- -- DATE: Febuary 6 2014 -- REVISIONS: none -- -- DESIGNER: Ramzi Chennafi -- PROGRAMMER: Ramzi Chennafi -- -- INTERFACE: void set_settings(HWND hwnd), takes the parent window HWND as an argument. -- -- RETURNS: void -- -- NOTES: -- Whenever the user hits "OK" on the settings dialog box, this function is called. The function will set the current -- value of the SETTINGS data in the Class Long Ptr to whatever is currently present in the settings dialog box. ----------------------------------------------------------------------------------------------------------------------*/ void set_settings(HWND hwnd){ char ** tempBuffers = (char**)malloc(sizeof(char*)* 4); for (int i = 0; i < 4; i++){ tempBuffers[i] = (char*) malloc(sizeof(char)* MAX_SIZE); } HWND hDlgPORT = GetDlgItem(hwnd, IDC_PORT); HWND hDlgIP = GetDlgItem(hwnd, IDC_IP); HWND hDlgSAVE = GetDlgItem(hwnd, IDC_SDISPLAY); HWND hDlgSPORT = GetDlgItem(hwnd, IDC_SPORT); HWND hDlgSPRTCL = GetDlgItem(hwnd, IDC_SPRTCL); HWND hDlgPCKT = GetDlgItem(hwnd, IDC_PACKETSIZE); HWND hDlgTTS = GetDlgItem(hwnd, IDC_TTS); SETTINGS * st = (SETTINGS*)GetClassLongPtr(GetParent(hwnd), 0); Edit_GetText(hDlgPORT, tempBuffers[0], MAX_SIZE); st->client_port = tempBuffers[0]; Edit_GetText(hDlgSPORT, tempBuffers[1], MAX_SIZE); st->server_port = tempBuffers[1]; Edit_GetText(hDlgIP, tempBuffers[2], MAX_SIZE); st->client_send_ip = tempBuffers[2]; Edit_GetText(hDlgTTS, tempBuffers[3], MAX_SIZE); st->times_to_send = tempBuffers[3]; st->packet_size = ComboBox_GetCurSel(hDlgPCKT); st->protocol = ComboBox_GetCurSel(hDlgSPRTCL); SetClassLongPtr(GetParent(hwnd), 0, (LONG)st); }
/*------------------------------------------------------------------------------------------------------------------ -- FUNCTION: client_connect -- -- DATE: Febuary 6 2014 -- REVISIONS: none -- -- DESIGNER: Ramzi Chennafi -- PROGRAMMER: Ramzi Chennafi -- -- INTERFACE: void client_connect(HWND hwnd), takes the parent window HWND as an argument. -- -- RETURNS: void -- -- NOTES: -- When the client is in TCP mode, will connect the client to the TCP server. Returns messages on failure. After -- performing a connect the client is ready to transfer files. ----------------------------------------------------------------------------------------------------------------------*/ void client_connect(HWND hwnd){ SOCKADDR_IN InternetAddr; hostent *hp; int iRc; SETTINGS * st = (SETTINGS*)GetClassLongPtr(hwnd, 0); memset((char *)&InternetAddr, 0, sizeof(SOCKADDR_IN)); InternetAddr.sin_family = AF_INET; InternetAddr.sin_port = htons(atoi(st->client_port)); if ((hp = gethostbyname(st->client_send_ip)) == NULL) { activity("Could not find the specified server address.\n", EB_STATUSBOX); return; } memcpy((char *)&InternetAddr.sin_addr, hp->h_addr, hp->h_length); iRc = connect(st->client_socket, (PSOCKADDR)&InternetAddr, sizeof(InternetAddr)); if (iRc != 0){ activity("Failed to connect to server.\n", EB_STATUSBOX); return; } setsockopt(st->client_socket, SOL_SOCKET, SO_REUSEADDR, 0, 0); SetClassLongPtr(hwnd, 0, (LONG)st); activity("Connected to server.\n", EB_STATUSBOX); return; }
/*-------------------------------------------------- undo ----------------------------------------------------*/ void EndTrayNotify(void) { if(bFillTray && hwndTrayNotify && IsWindow(hwndTrayNotify)) { SetWindowLongPtr(hwndTrayNotify, GWL_STYLE, oldStyleTrayNotify); if(oldWndProcTrayNotify) SubclassWindow(hwndTrayNotify, oldWndProcTrayNotify); SetClassLongPtr(hwndTrayNotify, GCL_STYLE, oldClassStyleTrayNotify); InvalidateRect(hwndTrayNotify, NULL, TRUE); SendMessage(hwndToolbar, WM_SYSCOLORCHANGE, 0, 0); InvalidateRect(hwndToolbar, NULL, TRUE); } if(bFlatTray && hwndTrayNotify && IsWindow(hwndTrayNotify)) { SetWindowLongPtr(hwndTrayNotify, GWL_EXSTYLE, oldExStyleTrayNotify); SetWindowPos(hwndTrayNotify, NULL, 0, 0, 0, 0, SWP_DRAWFRAME|SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER); } hwndTrayNotify = NULL; hwndToolbar = NULL; oldWndProcTrayNotify = NULL; bFillTray = bFlatTray = bSkinTray = FALSE; }
explicit window(HWND hwnd) : _hwnd(hwnd) , _hook(true) { _org_wproc = (WNDPROC)GetClassLongPtr(hwnd, GCLP_WNDPROC); SetClassLongPtr(hwnd, GCLP_WNDPROC, (LONG_PTR)hook_winproc); }
static void LoadCoreModule(void) { INITCOMMONCONTROLSEX icce = {0}; icce.dwSize = sizeof(icce); icce.dwICC = ICC_WIN95_CLASSES | ICC_USEREX_CLASSES; InitCommonControlsEx(&icce); hAPCWindow = CreateWindowEx(0, _T("ComboLBox"), NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL); SetClassLongPtr(hAPCWindow, GCL_STYLE, GetClassLongPtr(hAPCWindow, GCL_STYLE) | CS_DROPSHADOW); DestroyWindow(hAPCWindow); hAPCWindow = NULL; hAPCWindow = CreateWindowEx(0, _T("STATIC"), NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL); SetWindowLongPtr(hAPCWindow, GWLP_WNDPROC, (LONG_PTR)APCWndProc); SetTimer(hAPCWindow, 1, 1000, NULL); hStackMutex = CreateMutex(NULL, FALSE, NULL); hThreadQueueEmpty = CreateEvent(NULL, TRUE, TRUE, NULL); #ifdef _WIN64 HMODULE mirInst = GetModuleHandleA("miranda64.exe"); #else HMODULE mirInst = GetModuleHandleA("miranda32.exe"); #endif RecalculateTime = (void (*)()) GetProcAddress(mirInst, "RecalculateTime"); InitWinver(); InitPathUtils(); InitLogs(); InitialiseModularEngine(); InitProtocols(); InitMetaContacts(); }
INT_PTR CWildcardSelectDialog::OnInitDialog() { m_hDialogIcon = LoadIcon(GetModuleHandle(0),MAKEINTRESOURCE(IDI_MAIN_SMALL)); SetClassLongPtr(m_hDlg,GCLP_HICONSM,reinterpret_cast<LONG_PTR>(m_hDialogIcon)); HWND hComboBox = GetDlgItem(m_hDlg,IDC_SELECTGROUP_COMBOBOX); for each(auto strPattern in m_pwsdps->m_PatternList) { ComboBox_InsertString(hComboBox,-1,strPattern.c_str()); } ComboBox_SetText(hComboBox,m_pwsdps->m_szPattern); if(!m_bSelect) { TCHAR szTemp[64]; LoadString(GetInstance(),IDS_WILDCARDDESELECTION, szTemp,SIZEOF_ARRAY(szTemp)); SetWindowText(m_hDlg,szTemp); } SetFocus(hComboBox); m_pwsdps->RestoreDialogPosition(m_hDlg,true); return 0; }
/** * Sets the window titlebar icon. * For Windows, use the embedded resource icon. * For other systems, use a PNG icon. * @param winResource ID for Windows icon. * @param unixPath Path to PNG icon for Unix. */ void setWindowIcon(int winResource, const std::string &unixPath) { #ifdef _WIN32 HINSTANCE handle = GetModuleHandle(NULL); HICON icon = LoadIcon(handle, MAKEINTRESOURCE(winResource)); SDL_SysWMinfo wminfo; SDL_VERSION(&wminfo.version) if (SDL_GetWMInfo(&wminfo)) { HWND hwnd = wminfo.window; SetClassLongPtr(hwnd, GCLP_HICON, (LONG_PTR)icon); } #else // SDL only takes UTF-8 filenames // so here's an ugly hack to match this ugly reasoning std::string utf8 = Language::wstrToUtf8(Language::fsToWstr(unixPath)); SDL_Surface *icon = IMG_Load(utf8.c_str()); if (icon != 0) { SDL_WM_SetIcon(icon, NULL); SDL_FreeSurface(icon); } #endif }
static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpicture) { vout_display_sys_t *sys = vd->sys; assert(sys->display); /* Our surface can be lost so be sure to check this * and restore it if need be */ if (IDirectDrawSurface2_IsLost(sys->display) == DDERR_SURFACELOST) { if (IDirectDrawSurface2_Restore(sys->display) == DD_OK) { if (sys->use_overlay) DirectXUpdateOverlay(vd, NULL); } } if (sys->restore_overlay) DirectXUpdateOverlay(vd, NULL); /* */ DirectXUnlock(picture); if (sys->use_overlay) { /* Flip the overlay buffers if we are using back buffers */ if (picture->p_sys->surface != picture->p_sys->front_surface) { HRESULT hr = IDirectDrawSurface2_Flip(picture->p_sys->front_surface, NULL, DDFLIP_WAIT); if (hr != DD_OK) msg_Warn(vd, "could not flip overlay (error %li)", hr); } } else { /* Blit video surface to display with the NOTEARING option */ DDBLTFX ddbltfx; ZeroMemory(&ddbltfx, sizeof(ddbltfx)); ddbltfx.dwSize = sizeof(ddbltfx); ddbltfx.dwDDFX = DDBLTFX_NOTEARING; HRESULT hr = IDirectDrawSurface2_Blt(sys->display, &sys->rect_dest_clipped, picture->p_sys->surface, &sys->rect_src_clipped, DDBLT_ASYNC, &ddbltfx); if (hr != DD_OK) msg_Warn(vd, "could not blit surface (error %li)", hr); } DirectXLock(picture); if (sys->is_first_display) { IDirectDraw_WaitForVerticalBlank(sys->ddobject, DDWAITVB_BLOCKBEGIN, NULL); if (sys->use_overlay) { HBRUSH brush = CreateSolidBrush(sys->i_rgb_colorkey); /* set the colorkey as the backgound brush for the video window */ SetClassLongPtr(sys->hvideownd, GCLP_HBRBACKGROUND, (LONG_PTR)brush); } } CommonDisplay(vd); picture_Release(picture); VLC_UNUSED(subpicture); }
INT_PTR CALLBACK DialogProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: { HICON hIcon=(HICON)LoadImage(hInst,MAKEINTRESOURCE(IDI_SETTINGSTOOL),IMAGE_ICON,32,32,LR_SHARED); //SetIcon(hWnd,hIcon,TRUE); SetClassLongPtr(hWnd,GCLP_HICON,(LONG_PTR)hIcon); hIcon=(HICON)LoadImage(hInst,MAKEINTRESOURCE(IDI_SETTINGSTOOL),IMAGE_ICON,16,16,LR_SHARED); //SetIcon(hWnd,hIcon,FALSE); SetClassLongPtr(hWnd,GCLP_HICONSM,(LONG_PTR)hIcon); break; } case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: break; case IDCANCEL: EndDialog(hWnd,0); break; case IDC_SAVESETTINGS: SaveSettings(hWnd); break; case IDC_RESTORESETTINGS: RestoreSettings(hWnd); break; case IDC_REMOVESETTINGS: RemoveSettings(hWnd); break; default: return DefDlgProc(hWnd, message, wParam, lParam); } break; case WM_CLOSE: EndDialog(hWnd,0); break; case WM_DESTROY: PostQuitMessage(0); break; //default: //return DefDlgProc(hWnd, message, wParam, lParam); } return 0; }
BackgroundWindow::BackgroundWindow(HWND hwnd) : super(hwnd) { // set background brush for the short moment of displaying the // background color while moving foreground windows SetClassLongPtr(hwnd, GCL_HBRBACKGROUND, COLOR_BACKGROUND+1); _display_version = RegGetDWORDValue(HKEY_CURRENT_USER, TEXT("Control Panel\\Desktop"), TEXT("PaintDesktopVersion"), 1); }
INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { char error[1000]; static bool pause = false; switch (uMsg) { case WM_INITDIALOG: // Set Class icon SetClassLongPtr(hDlg, GCL_HICON, (LONG_PTR)LoadIcon(g_instance, MAKEINTRESOURCE(IDI_ICON))); SetTimer(hDlg, 1, 500, NULL); return TRUE; // return FALSE if modeless and SetFocus is called case WM_DROPFILES: DragQueryFile((HDROP)wParam, 0, filename, MAX_PATH); DragFinish((HDROP)wParam); g_new = true; return TRUE; case WM_TIMER: if (!pause) { LoadFile(hDlg, filename, error, &g_ftLastWriteTime, g_new); g_new = false; if (*error) { pause = true; *filename = 0; MessageBox(hDlg, error, "Error", MB_OK); SetWindowText(hDlg, "Tail"); pause = false; } } return TRUE; case WM_SIZE: MoveWindow(GetDlgItem(hDlg, IDC_TEXT), 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE); return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: return TRUE; case IDCANCEL: // Quit program... EndDialog(hDlg, wParam); // Close dialogwindow return TRUE; } } return FALSE; }
void PointerManager::setPointerHandle(size_t _id) { SetClassLongPtr((HWND)mHwnd, GCLP_HCURSOR, (LONG_PTR)_id); if ((GetCapture() == (HWND)mHwnd) || isMouseInClient()) { ::SetCursor((HCURSOR)_id); } }
void gui_SubClassInit( PA_PluginParameters params ) { LONG_PTR returnValue = 0, action = 0; //WNDCLASSEX wndClassEx; //LPWNDCLASSEX lpWndClassEx = &wndClassEx; //char className[] = "ProToolsSubMDIWndClass"; //HINSTANCE hInst; // Put NDEBUF flag back into Preprocessor definitions action = PA_GetLongParameter( params, 1); toolBarRestrictions.toolBarOnDeck = 0; // added for gui_RespectToolBar 01/16/03 if (action != RW_RELEASE) { if (processHandles.wpProToolsOrigProc == NULL) { processHandles.wpProToolsOrigProc = (WNDPROC) SetClassLongPtr(windowHandles.MDIs_4DhWnd, GCLP_WNDPROC, (LONG_PTR)ProToolsProc); returnValue = (LONG_PTR) processHandles.wpProToolsOrigProc; /* //hInst = (HINSTANCE) PA_Get4DHInstance(); // this doesn't work for 4D 6.5 hInst = (HINSTANCE) GetWindowLong(windowHandles.fourDhWnd, GWL_HINSTANCE); // 09/10/02 //hInst = (HINSTANCE)GetWindowLongPtr(windowHandles.MDIhWnd, GWL_HINSTANCE); wndClassEx.cbSize = sizeof(WNDCLASSEX); if (GetClassInfoEx(hInst, className, lpWndClassEx)) { wndClassEx.lpfnWndProc = &ProToolsProc; processHandles.wpProToolsOrigProc = (WNDPROC) SetClassLongPtr(windowHandles.MDIs_4DhWnd, GCLP_WNDPROC, (LONG_PTR)ProToolsProc); returnValue = (LONG_PTR) processHandles.wpProToolsOrigProc; } */ } } else { if (processHandles.wpProToolsOrigProc != NULL) { //SetClassLongPtr(windowHandles.fourDhWnd, GCLP_WNDPROC, (LONG_PTR)processHandles.wpProToolsOrigProc); SetClassLongPtr(windowHandles.MDIs_4DhWnd, GCLP_WNDPROC, (LONG_PTR)processHandles.wpProToolsOrigProc); processHandles.wpProToolsOrigProc = NULL; returnValue = 1; } clear_list(&startOfList); } PA_ReturnLong( params, returnValue ); }
// call this with the resource names you compiled the icons with // (16x16 and 48x48 pixel) // void boinc_set_windows_icon(const char* icon16, const char* icon48) { LONGLONG ic; HWND hWnd = FindWindow("BOINC_app",NULL); if (ic = (LONGLONG)LoadIcon(hInstance, icon48)) { #ifdef _WIN64 SetClassLongPtr(hWnd, GCLP_HICON, (LONG_PTR)ic); #else SetClassLongPtr(hWnd, GCLP_HICON, (LONG)ic); #endif } if (ic = (LONGLONG)LoadImage(hInstance, icon16, IMAGE_ICON, 16, 16, 0)) { #ifdef _WIN64 SetClassLongPtr(hWnd, GCLP_HICONSM, (LONG_PTR)ic); #else SetClassLongPtr(hWnd, GCLP_HICONSM, (LONG)ic); #endif } }
inline LONG_PTR setClassPtr(HWND hwnd, int index, LONG_PTR newPtr) { #ifndef __REXX64__ #pragma warning(disable:4244) #endif return SetClassLongPtr(hwnd, index, newPtr); #ifndef __REXX64__ #pragma warning(default:4244) #endif }
//---- -------------------------------------------------------------------------------------------------------- // Function: EAEUpdateGUI // Requires: HWND hwnd - window handle // bool shadow - window shadow indicator // std::wstring zposition - z-order setting for window // Returns: bool // Purpose: Set the window shadow and z-order //---- -------------------------------------------------------------------------------------------------------- HWND EAEUpdateGUI(HWND hwnd, bool shadow, std::wstring zposition) { if (shadow) { SetClassLongPtr(hwnd, GCL_STYLE, GetClassLongPtr(hwnd, GCL_STYLE) | CS_DROPSHADOW); } else { SetClassLongPtr(hwnd, GCL_STYLE, GetClassLongPtr(hwnd, GCL_STYLE) & ~CS_DROPSHADOW); } // Set window z-order if (ELToLower(zposition) == ELToLower(TEXT("Top"))) { return HWND_TOPMOST; } return HWND_NOTOPMOST; }
//----------------------------------------------------------------------------- // Name: OneTimeSceneInit() // Desc: Called during initial app startup, this function performs all the // permanent initialization. //----------------------------------------------------------------------------- HRESULT CMyD3DApplication::OneTimeSceneInit() { // Set cursor to indicate that user can move the object with the mouse #ifdef _WIN64 SetClassLongPtr( m_hWnd, GCLP_HCURSOR, (LONG_PTR)LoadCursor( NULL, IDC_SIZEALL ) ); #else SetClassLong( m_hWnd, GCL_HCURSOR, (LONG)LoadCursor( NULL, IDC_SIZEALL ) ); #endif return S_OK; }
int CView::OnCreate(LPCREATESTRUCT pcs) { // Set the window background to black m_Brush.CreateSolidBrush(RGB(0,0,0)); SetClassLongPtr(GCLP_HBRBACKGROUND, (LONG_PTR)m_Brush.GetHandle()); // Support Drag and Drop on this window DragAcceptFiles(TRUE); return CWnd::OnCreate(pcs); }
/* * FindDlgCreate * * Purpose: * * Create and initialize Find Dialog. * */ VOID FindDlgCreate( _In_ HWND hwndParent ) { LVCOLUMN col; HICON hIcon; //do not allow second copy if (g_wobjDialogs[WOBJ_FINDDLG_IDX]) { SetActiveWindow(g_wobjDialogs[WOBJ_FINDDLG_IDX]); return; } FindDialog = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_DIALOG_SEARCH), hwndParent, &FindDlgProc, 0); if (FindDialog == NULL) { return; } g_wobjDialogs[WOBJ_FINDDLG_IDX] = FindDialog; FindDlgGrip = supCreateSzGripWindow(FindDialog); //set dialog icon, because we use shared dlg template this icon must be //removed after use, see aboutDlg/propDlg. hIcon = LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_ICON_MAIN), IMAGE_ICON, 0, 0, LR_SHARED); if (hIcon) { SetClassLongPtr(g_wobjDialogs[WOBJ_FINDDLG_IDX], GCLP_HICON, (LONG_PTR)hIcon); DestroyIcon(hIcon); } FindDlgList = GetDlgItem(FindDialog, ID_SEARCH_LIST); if (FindDlgList) { bFindDlgSortInverse = FALSE; ListView_SetImageList(FindDlgList, ListViewImages, LVSIL_SMALL); ListView_SetExtendedListViewStyle(FindDlgList, LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER | LVS_EX_GRIDLINES | LVS_EX_LABELTIP); RtlSecureZeroMemory(&col, sizeof(col)); col.mask = LVCF_TEXT | LVCF_SUBITEM | LVCF_FMT | LVCF_WIDTH | LVCF_ORDER | LVCF_IMAGE; col.iSubItem = 1; col.pszText = TEXT("Name"); col.fmt = LVCFMT_LEFT | LVCFMT_BITMAP_ON_RIGHT; col.iOrder = 0; col.iImage = ImageList_GetImageCount(ListViewImages) - 1; col.cx = 300; ListView_InsertColumn(FindDlgList, 1, &col); col.iSubItem = 2; col.pszText = TEXT("Type"); col.iOrder = 1; col.iImage = -1; col.cx = 100; ListView_InsertColumn(FindDlgList, 2, &col); } FindDlgAddTypes(FindDialog); }
BOOL CXTPSkinObjectFrame::OnEraseBkgnd(CDC* pDC) { HBRUSH hbr = (HBRUSH)(DWORD_PTR)GetClassLongPtr(m_hWnd, GCLP_HBRBACKGROUND); BOOL bChanged = FALSE; if (hbr > 0 && (ULONG_PTR)hbr < (ULONG_PTR)XTP_SKINMETRICS_COLORTABLESIZE) { HBRUSH hbrTheme = GetMetrics()->m_brTheme[(ULONG_PTR)hbr - 1]; SetClassLongPtr(m_hWnd, GCLP_HBRBACKGROUND, (LONG_PTR)hbrTheme); bChanged = TRUE; } BOOL bResult = CXTPSkinObject::OnEraseBkgnd(pDC); if (bChanged) { SetClassLongPtr(m_hWnd, GCLP_HBRBACKGROUND, (LONG_PTR)hbr); } return bResult; }
static void set_app_cursor(bool use_app_mouse) { static bool app_mouse = -1; if (use_app_mouse != app_mouse) { HCURSOR cursor = LoadCursor(null, use_app_mouse ? IDC_ARROW : IDC_IBEAM); SetClassLongPtr(wnd, GCLP_HCURSOR, (LONG_PTR)cursor); SetCursor(cursor); app_mouse = use_app_mouse; } }
void CAddBookmarkDialog::SetDialogIcon() { HIMAGELIST himl = ImageList_Create(16,16,ILC_COLOR32|ILC_MASK,0,48); HBITMAP hBitmap = LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_SHELLIMAGES)); ImageList_Add(himl,hBitmap,NULL); m_hDialogIcon = ImageList_GetIcon(himl,SHELLIMAGES_ADDFAV,ILD_NORMAL); SetClassLongPtr(m_hDlg,GCLP_HICONSM,reinterpret_cast<LONG_PTR>(m_hDialogIcon)); DeleteObject(hBitmap); ImageList_Destroy(himl); }