本文整理汇总了C++中SetClassLongPtr函数的典型用法代码示例。如果您正苦于以下问题:C++ SetClassLongPtr函数的具体用法?C++ SetClassLongPtr怎么用?C++ SetClassLongPtr使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetClassLongPtr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateCursor
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 );
}
}
示例2: GetMetrics
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;
}
示例3: ASSERT
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;
}
示例4: ASSERT
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;
}
示例5: swap_icons
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;
}
示例6: winDestroyFreeWindowClass
/********************************************************************
** 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);
}
示例7: DeleteObject
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));
}
}
示例8: GetVersion
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();
}
示例9: set_settings
/*------------------------------------------------------------------------------------------------------------------
-- 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);
}
示例10: client_connect
/*------------------------------------------------------------------------------------------------------------------
-- 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;
}
示例11: EndTrayNotify
/*--------------------------------------------------
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;
}
示例12: window
explicit window(HWND hwnd)
: _hwnd(hwnd)
, _hook(true)
{
_org_wproc = (WNDPROC)GetClassLongPtr(hwnd, GCLP_WNDPROC);
SetClassLongPtr(hwnd, GCLP_WNDPROC, (LONG_PTR)hook_winproc);
}
示例13: LoadCoreModule
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();
}
示例14: LoadIcon
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;
}
示例15: setWindowIcon
/**
* 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
}