本文整理汇总了C++中GetClassLong函数的典型用法代码示例。如果您正苦于以下问题:C++ GetClassLong函数的具体用法?C++ GetClassLong怎么用?C++ GetClassLong使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetClassLong函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_window_icon_big
HICON get_window_icon_big(HWND hwnd, bool allow_from_class)
{
HICON hIcon = 0;
SendMessageTimeout(hwnd, WM_GETICON, ICON_BIG, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&hIcon);
if (!hIcon)
SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL2, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&hIcon);
if (!hIcon)
SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&hIcon);
if (allow_from_class) {
if (!hIcon)
hIcon = (HICON)GetClassLong(hwnd, GCL_HICON);
if (!hIcon)
hIcon = (HICON)GetClassLong(hwnd, GCL_HICONSM);
}
if (!hIcon)
SendMessageTimeout(hwnd, WM_QUERYDRAGICON, 0, 0, 0, 1000, (LPDWORD)&hIcon);
return hIcon;
}
示例2: dc
void CSizingControlBar::OnNcPaint()
{
// get window DC that is clipped to the non-client area
CWindowDC dc(this);
CRect rcClient, rcBar;
GetClientRect(rcClient);
ClientToScreen(rcClient);
GetWindowRect(rcBar);
rcClient.OffsetRect(-rcBar.TopLeft());
rcBar.OffsetRect(-rcBar.TopLeft());
CDC mdc;
mdc.CreateCompatibleDC(&dc);
CBitmap bm;
bm.CreateCompatibleBitmap(&dc, rcBar.Width(), rcBar.Height());
CBitmap* pOldBm = mdc.SelectObject(&bm);
// draw borders in non-client area
CRect rcDraw = rcBar;
DrawBorders(&mdc, rcDraw);
// erase the NC background
#ifdef _WIN64
mdc.FillRect(rcDraw, CBrush::FromHandle(
(HBRUSH) GetClassLong(m_hWnd, GCLP_HBRBACKGROUND)));
#else
mdc.FillRect(rcDraw, CBrush::FromHandle(
(HBRUSH) GetClassLong(m_hWnd, GCL_HBRBACKGROUND)));
#endif
if (m_dwSCBStyle & SCBS_SHOWEDGES)
{
CRect rcEdge; // paint the sizing edges
for (int i = 0; i < 4; i++)
if (GetEdgeRect(rcBar, GetEdgeHTCode(i), rcEdge))
mdc.Draw3dRect(rcEdge, ::GetSysColor(COLOR_BTNHIGHLIGHT),
::GetSysColor(COLOR_BTNSHADOW));
}
NcPaintGripper(&mdc, rcClient);
// client area is not our bussiness :)
dc.IntersectClipRect(rcBar);
dc.ExcludeClipRect(rcClient);
dc.BitBlt(0, 0, rcBar.Width(), rcBar.Height(), &mdc, 0, 0, SRCCOPY);
ReleaseDC(&dc);
mdc.SelectObject(pOldBm);
bm.DeleteObject();
mdc.DeleteDC();
}
示例3: CImageList
void CTaskSwitcher32Dlg::FilterList()
{
m_windowList2.DeleteAllItems();
window_list *list = window_item::get_window_list();
CImageList *pImageList = new CImageList(); pImageList->Create( 16, 16, ILC_COLOR32 | ILC_MASK | ILC_PERITEMMIRROR, 0, 10);
m_windowList2.SetImageList( pImageList, LVSIL_SMALL);
int default_idx = pImageList->Add( m_hIcon );
for ( unsigned int i = 0; i < list->size(); i++ )
{
window_item *item = (*list)[i];
bool ok = true;
if ( this->search.length() > 0 )
{
int pos = item->get_lower_title().find( this->search ) ;
int pos2 = item->get_process_name().find( this->search );
if ( pos == std::string::npos && pos2 == std::string::npos )
ok = false;
}
if ( ok )
{
HWND hwnd = item->get_handle();
HICON hIcon = NULL;
SendMessageTimeout(hwnd, WM_GETICON, ICON_BIG, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&hIcon);
if (!hIcon) SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL2, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&hIcon);
if (!hIcon) SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&hIcon);
if (!hIcon) hIcon = (HICON)GetClassLong(hwnd, GCL_HICON);
if (!hIcon) hIcon = (HICON)GetClassLong(hwnd, GCL_HICONSM);
int imageidx = -1;
if ( hIcon != NULL )
{
HICON iconCopy = CopyIcon( hIcon );
imageidx = pImageList->Add( iconCopy );
DestroyIcon( iconCopy );
}
else
{
imageidx = 1;
}
int idx = m_windowList2.InsertItem( 0, item->get_title().c_str(), imageidx );
m_windowList2.SetItem( idx, 1, LVIF_TEXT | LVIF_IMAGE, item->get_process_name().c_str(), imageidx, 0, 0, 0 );
m_windowList2.SetItemData( idx, (DWORD_PTR) item );
}
}
m_windowList2.SetItemState( 0, LVIS_SELECTED, LVIS_SELECTED );
m_windowList2.SetSelectionMark( 0 );
}
示例4: SetWindowLongPtr
///////////////////////////////////////////////////////////////////////
/// Function: WindowClassProc
///
/// Author: $author$
/// Date: 4/6/2012
///////////////////////////////////////////////////////////////////////
static LRESULT CALLBACK WindowClassProc
(HWND hWnd,
UINT msg,
WPARAM wParam,
LPARAM lParam)
{
LRESULT lResult = 0;
XosWinWindow* target = 0;
WNDPROC windowSubclassProc = 0;
DWORD wndExtra;
DWORD wndIndex;
DWORD wndClassExtra;
DWORD wndClassIndex;
if (sizeof(XosWinWindow*) <= (wndExtra = GetClassLong(hWnd, GCL_CBWNDEXTRA)))
if (0 <= (wndIndex = wndExtra-sizeof(XosWinWindow*)))
if ((target = (XosWinWindow*)(GetWindowLongPtr(hWnd, wndIndex))))
{
lResult = target->OnWindowMessage(hWnd, msg, wParam, lParam);
return lResult;
}
else
if ((WM_NCCREATE == msg))
{
CREATESTRUCT* cs;
if ((cs = (CREATESTRUCT*)(lParam)))
if ((target = (XosWinWindow*)(cs->lpCreateParams)))
if (sizeof(windowSubclassProc) <= (wndClassExtra = GetClassLong(hWnd, GCL_CBCLSEXTRA)))
if (0 <= (wndClassIndex = wndClassExtra-sizeof(windowSubclassProc)))
if ((windowSubclassProc = (WNDPROC)(GetClassLongPtr(hWnd, wndClassIndex))))
{
SetWindowLongPtr(hWnd, wndIndex, (LONG_PTR)(target));
if (!(target->Attached())) target->Attach(hWnd);
lResult = target->OnWindowMessage(hWnd, msg, wParam, lParam);
return lResult;
}
}
if (sizeof(windowSubclassProc) <= (wndClassExtra = GetClassLong(hWnd, GCL_CBCLSEXTRA)))
if (0 <= (wndClassIndex = wndClassExtra-sizeof(windowSubclassProc)))
windowSubclassProc = (WNDPROC)(GetClassLongPtr(hWnd, wndClassIndex));
if (windowSubclassProc)
lResult = CallWindowProc
(windowSubclassProc, hWnd, msg, wParam, lParam);
else
lResult = DefWindowProc(hWnd, msg, wParam, lParam);
return lResult;
}
示例5: refresh_happiness_bitmap
/**************************************************************************
...
**************************************************************************/
static void refresh_happiness_bitmap(HBITMAP bmp,
struct city *pcity,
enum citizen_feeling index)
{
enum citizen_category citizens[MAX_CITY_SIZE];
RECT rc;
int i;
int num_citizens = get_city_citizen_types(pcity, index, citizens);
int pix_width = HAPPINESS_PIX_WIDTH * tileset_small_sprite_width(tileset);
int offset = MIN(tileset_small_sprite_width(tileset), pix_width / num_citizens);
/* int true_pix_width = (num_citizens - 1) * offset + tileset_small_sprite_width(tileset); */
HDC hdc = CreateCompatibleDC(NULL);
HBITMAP old=SelectObject(hdc,bmp);
rc.left=0;
rc.top=0;
rc.right=pix_width;
rc.bottom=tileset_small_sprite_height(tileset);
FillRect(hdc,&rc,(HBRUSH)GetClassLong(root_window,GCL_HBRBACKGROUND));
for (i = 0; i < num_citizens; i++) {
draw_sprite(get_citizen_sprite(tileset, citizens[i], i, pcity),
hdc, i * offset, 0);
}
SelectObject(hdc,old);
DeleteDC(hdc);
}
示例6: SetClassLong
int CAnsiWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CWnd::OnCreate(lpCreateStruct) == -1)
return -1;
SetClassLong(GetSafeHwnd(), GCL_STYLE, GetClassLong(GetSafeHwnd(), GCL_STYLE)-CS_VREDRAW);
while ( m_strList.GetCount () < pDoc->m_nScrollSize )
m_strList.AddTail("");
// Init colors
m_nCurrentBg = 0;
m_nCurrentFg =7;
//===================================================================================================================
((CMainFrame*)AfxGetMainWnd())->m_editBar.GetDlgItem(IDC_EDIT)->SetFont(&pDoc->m_fntText);
CRect rect;
GetClientRect(&rect);
// To init screen dimentions in characters !!!
SetScrollSettings();
return 0;
}
示例7: sys_directx_set_close_button_callback
/* sys_directx_set_close_button_callback:
* Sets the close button callback function.
*/
static int sys_directx_set_close_button_callback(void (*proc)(void))
{
DWORD class_style;
HMENU sys_menu;
HWND allegro_wnd = win_get_window();
user_close_proc = proc;
/* get the old class style */
class_style = GetClassLong(allegro_wnd, GCL_STYLE);
/* and the system menu handle */
sys_menu = GetSystemMenu(allegro_wnd, FALSE);
/* enable or disable the no_close_button flag and the close menu option */
if (proc) {
class_style &= ~CS_NOCLOSE;
EnableMenuItem(sys_menu, SC_CLOSE, MF_BYCOMMAND | MF_ENABLED);
}
else {
class_style |= CS_NOCLOSE;
EnableMenuItem(sys_menu, SC_CLOSE, MF_BYCOMMAND | MF_GRAYED);
}
/* change the class to the new style */
SetClassLong(allegro_wnd, GCL_STYLE, class_style);
/* Redraw the whole window to display the changes of the button.
* (we use this because UpdateWindow() only works for the client area)
*/
RedrawWindow(allegro_wnd, NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);
return 0;
}
示例8: __declspec
extern "C" __declspec(dllexport) LRESULT CALLBACK PoeWndProc(int nCode, WPARAM wParam, LPARAM lParam) {
PCWPSTRUCT msg = (PCWPSTRUCT)lParam;
if (origCursor == 0) {
origCursor = (HCURSOR)GetClassLong(msg->hwnd,GCL_HCURSOR);
}
if (nCode < 0) {
return CallNextHookEx(NULL,nCode,wParam,lParam);
}
if (msg->message == windowMessage) {
// time to do magic and stuff.
numPulses = 0;
currentCursor = 0;
SetClassLong(msg->hwnd, GCL_HCURSOR,(LONG)cursors[currentCursor]);
SetCursor(cursors[currentCursor]);
SetTimer(msg->hwnd,PULSE_TIMER,100,TimerProc);
return TRUE;
}
return CallNextHookEx(NULL,nCode,wParam,lParam);
}
示例9: SetClassLong
int CAnsiWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CWnd::OnCreate(lpCreateStruct) == -1)
return -1;
SetClassLong(GetSafeHwnd(), GCL_STYLE, GetClassLong(GetSafeHwnd(), GCL_STYLE)-CS_VREDRAW);
while ( m_strList.GetCount () < nScrollSize )
m_strList.AddTail("");
m_TotalLinesReceived = 0;
// Init colors
m_nCurrentBg = 0;
m_nCurrentFg =7;
//===================================================================================================================
CRect rect;
GetClientRect(&rect);
// To init screen dimentions in characters !!!
SetScrollSettings();
return 0;
}
示例10: GetClassLong
BOOL CDetailCustomDlg::OnInitDialog()
{
CPropertyPage::OnInitDialog();
DWORD style = GetClassLong(m_lstOptions, GCL_STYLE);
SetClassLong(m_lstOptions, GCL_STYLE, style & ~CS_DBLCLKS);
IcqContact *contact = ((CViewDetailDlg *) GetParent())->contact;
bitset<NR_CONTACT_FLAGS> &f = contact->flags;
for (int id = IDS_OPTION_FIRST; id <= IDS_OPTION_LAST; id++) {
CString str;
str.LoadString(id);
int i = m_lstOptions.AddString(str);
m_lstOptions.SetCheck(i, f.test(i));
}
CheckDlgButton(IDC_CUSTOM_SOUND, contact->flags.test(CF_CUSTOMSOUND));
enableGreeting();
OnCustomSound();
m_cmbSound.SetCurSel(curSel);
for (int i = 0; i < NR_CUSTOM_SOUNDS; i++)
soundFiles[i] = contact->soundFiles[i].c_str();
SetDlgItemText(IDC_FILE, soundFiles[curSel]);
SetDlgItemText(IDC_GREETING, contact->greeting.c_str());
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例11: GetClassLong
///////////////////////////////////////////////////////////////////////
/// Function: DialogWindow
///
/// Author: $author$
/// Date: 1/29/2012
///////////////////////////////////////////////////////////////////////
static XosWinDialogWindow* DialogWindow
(HWND hWnd,
UINT msg,
WPARAM wParam,
LPARAM lParam)
{
int wndExtra = GetClassLong(hWnd, GCL_CBWNDEXTRA);
if (wndExtra < XosWinDialogWindowClass::WindowExtra())
return 0;
int wndExtraOffset = XosWinDialogWindowClass::WindowExtraOffset();
XosWinDialogWindow* dialogWindow = (XosWinDialogWindow*)
(GetWindowLongPtr(hWnd, wndExtraOffset));
switch(msg)
{
case WM_INITDIALOG:
SetWindowLongPtr(hWnd, wndExtraOffset, lParam);
if ((dialogWindow = (XosWinDialogWindow*)(lParam)))
dialogWindow->Attach(hWnd);
break;
case WM_DESTROY:
SetWindowLongPtr(hWnd, wndExtraOffset, 0);
break;
}
return dialogWindow;
}
示例12: ShowNotifyIcon
VOID ShowNotifyIcon(HWND hWnd, BOOL bAdd)
{
NOTIFYICONDATA nid;
ZeroMemory(&nid,sizeof(nid));
nid.cbSize=sizeof(NOTIFYICONDATA);
nid.hWnd=hWnd;
nid.uID=0;
nid.uFlags=NIF_ICON | NIF_MESSAGE | NIF_TIP;
nid.uCallbackMessage=WM_TRAYMESSAGE;
nid.hIcon = (HICON)GetClassLong(hWnd, GCL_HICONSM);
nid.uVersion = 0;
GetWindowText(hWnd, nid.szTip, sizeof(nid.szTip));
wcscat_s(nid.szTip, sizeof(nid.szTip), L"\nDouble-click to maximize");
if(bAdd)
{
for(int i = 0; i < 60; i++)
{
if(Shell_NotifyIcon(NIM_ADD, &nid))
break;
Sleep(1000);
}
}
else
Shell_NotifyIcon(NIM_DELETE, &nid);
}
示例13: GetClassLong
//---------------------------------------------------------------------------
TColCombo::TColCombo(HANDLE Par,bool Tabstop,HFONT fnt)
{
VNumItems=0;for (int n=0;n<MAX_CC_ITEMS;n++)VItem[n]=NULL;
VVisible=0;VLeft=0;VTop=0;VWidth=100;VHeight=200;
VBoxGap=0;VBoxSurround=2;VBoxWidth=25;
VParent=Par;
for (VId=50000;VId<100000;VId++)if (GetDlgItem(VParent,VId)==NULL) break;
Font=fnt;if (Font==NULL)Font=(HFONT)SendMessage(VParent,WM_GETFONT,0,0);
VHandle=CreateWindowEx(0,"COMBOBOX","",
CBS_DROPDOWNLIST | CBS_HASSTRINGS | CBS_OWNERDRAWFIXED |
WS_BORDER | (Tabstop==true ? WS_TABSTOP:0) | WS_CHILDWINDOW | WS_VSCROLL
,VLeft,VTop,VWidth,VHeight,
VParent,(HANDLE) VId,(HANDLE) GetClassLong(VParent,GCL_HMODULE),0);
if (IsWindow(VHandle)==0){VHandle=NULL;return;}
SendMessage(VHandle,WM_SETFONT,(WPARAM)Font,0);
HANDLE tempdc=CreateCompatibleDC(0);
HANDLE oldfnt=SelectObject(tempdc,Font);
SIZE sz;GetTextExtentPoint32(tempdc,"HjTTLMjpq",strlen("HjTTLMjpq"),&sz);
SelectObject(tempdc,oldfnt);
DeleteDC(tempdc);
FontHeight=sz.cy;VItemHeight=FontHeight;VSelItemHeight=FontHeight+2;
SendMessage(VHandle,CB_SETITEMHEIGHT,-1,VSelItemHeight);
SendMessage(VHandle,CB_SETITEMHEIGHT,0,VItemHeight);
}
示例14: LoadBitmap
/* ボタンコントロール作成 */
HWND ButtonControl::CreateButton(
LPCWSTR lpszText,
LPRECT lpRect,
HWND hWndParent, // 親ウィンドウまたはオーナーウィンドウのハンドル
HMENU hMenu, // メニューハンドルまたは子ウィンドウ ID
HINSTANCE hInstance, // アプリケーションインスタンスのハンドル
int nNorm, // ノーマルのときのリソースビットマップID
int nSel, // 押したときのリソースビットマップID
int nHover, // ホバーのときのリソースビットマップID
int nDis // ディセーブルのときのリソースビットマップID
)
{
m_hBmpNorm = LoadBitmap(hInstance, MAKEINTRESOURCE(nNorm));
m_hBmpSel = LoadBitmap(hInstance, MAKEINTRESOURCE(nSel));
m_hBmpHover = LoadBitmap(hInstance, MAKEINTRESOURCE(nHover));
m_hBmpDis = LoadBitmap(hInstance, MAKEINTRESOURCE(nDis));
m_nWidth = lpRect->right - lpRect->left;
m_nHeight = lpRect->bottom - lpRect->top;
const HWND hWnd = CreateWindowEx(0, L"BUTTON", lpszText, WS_CHILD | WS_VISIBLE | BS_OWNERDRAW, lpRect->left, lpRect->top, m_nWidth, m_nHeight, hWndParent, hMenu, hInstance, NULL);
if (!hWnd) return NULL;
SetClassLong(hWnd, GCL_STYLE, GetClassLong(hWnd, GCL_STYLE) & ~CS_DBLCLKS);
SetProp(hWnd, SZCECOWIZBUTTONPROC, this); // ウィンドウハンドルのプロパテにオブジェクトのポインタを関連付ける
m_DefBtnProc = (WNDPROC)SetWindowLong(hWnd, GWL_WNDPROC, (LONG)GlobalButtonProc);
return hWnd;
}
示例15: GetWindowLong
BOOL CSonicSkin::Attach(HWND hWnd)
{
m_hWnd = hWnd;
if(g_UI.Attach(hWnd, this) == FALSE)
{
return FALSE;
}
// erase NC rect
DWORD dwStyle = GetWindowLong(hWnd, GWL_STYLE);
DWORD dwClsStyle = GetClassLong(hWnd, GCL_STYLE);
DWORD dwExStyle = GetWindowLong(hWnd, GWL_EXSTYLE);
SetClassLong(hWnd, GCL_STYLE, dwClsStyle | CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS);
SetWindowLong(hWnd, GWL_STYLE, (dwStyle & ~WS_CAPTION & ~DS_MODALFRAME & ~DS_3DLOOK & ~DS_FIXEDSYS & ~DS_SETFONT) | WS_CLIPCHILDREN);
SetWindowLong(hWnd, GWL_EXSTYLE, (dwExStyle & ~WS_EX_DLGMODALFRAME));
SetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_DRAWFRAME | SWP_NOCOPYBITS);
// initialize
if(m_bg.pText->IsValid() == FALSE)
{
TCHAR szText[256];
GetWindowText(m_hWnd, szText, Tsizeof(szText));
m_bg.pText->Format(_T("%s"), szText);
}
else
{
SetWindowText(m_hWnd, m_bg.pText->GetTextWithoutCtrl());
}
CRect rtClient;
GetClientRect(m_hWnd, &rtClient);
m_pPaint->Create(FALSE, rtClient.Width(), rtClient.Height(), m_hWnd);
return TRUE;
}