本文整理汇总了C++中GetParent函数的典型用法代码示例。如果您正苦于以下问题:C++ GetParent函数的具体用法?C++ GetParent怎么用?C++ GetParent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetParent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetPageText
int wxTreebookExt::ChangeSelection(size_t n) {
int i = wxTreebook::ChangeSelection(n);
wxString Temp = GetPageText( n );
((wxDialog*)GetParent())->SetTitle( Temp );
return i;
};
示例2: switch
INT_PTR CALLBACK
CFileDefExt::GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG:
{
LPPROPSHEETPAGEW ppsp = (LPPROPSHEETPAGEW)lParam;
if (ppsp == NULL || !ppsp->lParam)
break;
TRACE("WM_INITDIALOG hwnd %p lParam %p ppsplParam %S\n", hwndDlg, lParam, ppsp->lParam);
CFileDefExt *pFileDefExt = reinterpret_cast<CFileDefExt *>(ppsp->lParam);
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pFileDefExt);
pFileDefExt->InitGeneralPage(hwndDlg);
break;
}
case WM_COMMAND:
if (LOWORD(wParam) == 14024) /* Opens With - Change */
{
CFileDefExt *pFileDefExt = reinterpret_cast<CFileDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
OPENASINFO oainfo;
oainfo.pcszFile = pFileDefExt->m_wszPath;
oainfo.pcszClass = NULL;
oainfo.oaifInFlags = OAIF_REGISTER_EXT|OAIF_FORCE_REGISTRATION;
return SUCCEEDED(SHOpenWithDialog(hwndDlg, &oainfo));
}
else if (LOWORD(wParam) == 14021 || LOWORD(wParam) == 14022 || LOWORD(wParam) == 14023) /* checkboxes */
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
else if (LOWORD(wParam) == 14001) /* Name */
{
if (HIWORD(wParam) == EN_CHANGE)
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
}
break;
case WM_NOTIFY:
{
LPPSHNOTIFY lppsn = (LPPSHNOTIFY)lParam;
if (lppsn->hdr.code == PSN_APPLY)
{
CFileDefExt *pFileDefExt = reinterpret_cast<CFileDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
/* Update attributes first */
DWORD dwAttr = GetFileAttributesW(pFileDefExt->m_wszPath);
if (dwAttr)
{
dwAttr &= ~(FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_ARCHIVE);
if (BST_CHECKED == SendDlgItemMessageW(hwndDlg, 14021, BM_GETCHECK, 0, 0))
dwAttr |= FILE_ATTRIBUTE_READONLY;
if (BST_CHECKED == SendDlgItemMessageW(hwndDlg, 14022, BM_GETCHECK, 0, 0))
dwAttr |= FILE_ATTRIBUTE_HIDDEN;
if (BST_CHECKED == SendDlgItemMessageW(hwndDlg, 14023, BM_GETCHECK, 0, 0))
dwAttr |= FILE_ATTRIBUTE_ARCHIVE;
if (!SetFileAttributesW(pFileDefExt->m_wszPath, dwAttr))
ERR("SetFileAttributesW failed\n");
}
/* Update filename now */
WCHAR wszBuf[MAX_PATH];
StringCchCopyW(wszBuf, _countof(wszBuf), pFileDefExt->m_wszPath);
LPWSTR pwszFilename = PathFindFileNameW(wszBuf);
UINT cchFilenameMax = _countof(wszBuf) - (pwszFilename - wszBuf);
if (GetDlgItemTextW(hwndDlg, 14001, pwszFilename, cchFilenameMax))
{
if (!MoveFileW(pFileDefExt->m_wszPath, wszBuf))
ERR("MoveFileW failed\n");
}
SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, PSNRET_NOERROR);
return TRUE;
}
break;
}
default:
break;
}
return FALSE;
}
示例3: SetPos
void CVolumeCtrl::SetPosInternal(int pos)
{
SetPos(pos);
GetParent()->PostMessage(WM_HSCROLL, MAKEWPARAM((short)pos, SB_THUMBPOSITION), (LPARAM)m_hWnd); // this will be reflected back on us
}
示例4: OnBnClickedButtonCancel
void CInitialConfigDlg::OnBnClickedButtonCancel()
{
// TODO: 在此添加控件通知处理程序代码
::SendMessage(GetParent()->GetSafeHwnd(),WM_MY_RefreshNodeInfoList,NULL,NULL);
SendMessage(WM_CLOSE);
}
示例5: GetWindowRect
void CTreePropSheetSplitter::GetAdjustedClientRect(CRect* pRect) const
{
GetWindowRect(pRect);
GetParent()->ScreenToClient(pRect);
}
示例6: GetParent
// Moves widget in Z direction
void Widget::Dive(int dz)
{
GetParent()->Lift( -dz, this);
}
示例7: ColourPickerWndProc
static LRESULT CALLBACK ColourPickerWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case WM_CREATE:
SetWindowLongPtr(hwnd, 0, 0);
SetWindowLongPtr(hwnd, sizeof(COLORREF), 0);
break;
case CPM_SETDEFAULTCOLOUR:
SetWindowLongPtr(hwnd, sizeof(COLORREF), lParam);
break;
case CPM_GETDEFAULTCOLOUR:
return GetWindowLongPtr(hwnd, sizeof(COLORREF));
case CPM_SETCOLOUR:
SetWindowLongPtr(hwnd, 0, lParam);
InvalidateRect(hwnd, NULL, FALSE);
break;
case CPM_GETCOLOUR:
return GetWindowLongPtr(hwnd, 0);
case WM_LBUTTONUP:
{
COLORREF custColours[16] = { 0 };
custColours[0] = GetWindowLongPtr(hwnd, sizeof(COLORREF));
CHOOSECOLOR cc = { 0 };
cc.lStructSize = sizeof(CHOOSECOLOR);
cc.hwndOwner = hwnd;
cc.hInstance = (HWND)g_hInst;
cc.rgbResult = GetWindowLongPtr(hwnd, 0);
cc.lpCustColors = custColours;
cc.Flags = CC_ANYCOLOR | CC_FULLOPEN | CC_RGBINIT;
if (ChooseColor(&cc)) {
SetWindowLongPtr(hwnd, 0, cc.rgbResult);
SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), CPN_COLOURCHANGED), (LPARAM)hwnd);
InvalidateRect(hwnd, NULL, FALSE);
}
}
break;
case WM_ENABLE:
InvalidateRect(hwnd, NULL, FALSE);
break;
case WM_NCPAINT:
case WM_PAINT:
PAINTSTRUCT ps;
HDC hdc1 = BeginPaint(hwnd, &ps);
RECT rc;
GetClientRect(hwnd, &rc);
DrawEdge(hdc1, &rc, EDGE_ETCHED, BF_RECT);
InflateRect(&rc, -2, -2);
HBRUSH hBrush = (IsWindowEnabled(hwnd)) ? CreateSolidBrush(GetWindowLongPtr(hwnd, 0)) : CreateHatchBrush(HS_BDIAGONAL, GetSysColor(COLOR_GRAYTEXT));
SetBkColor(hdc1, GetSysColor(COLOR_BTNFACE));
FillRect(hdc1, &rc, hBrush);
DeleteObject(hBrush);
EndPaint(hwnd, &ps);
break;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
示例8: dc
//
// CHistoryPane message handlers
//
void CHistoryPane::OnPaint()
{
CPaintDC dc(this);
CRect r;
CRgn rgn;
CPen pen;
uint w, i;
uint y, gap;
COLORREF colBack;
GetClientRect(&r);
colBack = GetSysColor(COLOR_3DLIGHT);
//
dc.FillSolidRect(0, 0, XBORDER, r.bottom, colBack);
dc.FillSolidRect(r.right-XBORDER, 0, XBORDER, r.bottom, colBack);
dc.FillSolidRect(XBORDER, 0, r.right-r.left-2*XBORDER, YBORDER, colBack);
dc.FillSolidRect(XBORDER, r.bottom-YBORDER, r.right-r.left-2*XBORDER, YBORDER, colBack);
dc.Draw3dRect(&r, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT));
//
r.DeflateRect(XBORDER, YBORDER);
rgn.CreateRectRgnIndirect(&r);
dc.SelectClipRgn(&rgn, RGN_COPY);
pen.CreatePen(PS_SOLID, 1, RGB(0xff,0x3f,0x00));
//dc.SetROP2(R2_XORPEN);
dc.SelectObject(&pen);
dc.SelectStockObject(NULL_BRUSH);
dc.SetStretchBltMode(HALFTONE);
//
w = m_uWidth;
y = YBORDER;
gap = 0;
for (i=m_uTopItem; i<m_vItems.size(); i++)
{
CItem & info = m_vItems[i];
CRect rTmp(0,0,0,0);
rTmp = CRect(XBORDER, y, XBORDER+m_uWidth, y+info.h0);
BitmapBlt(&dc, &rTmp, info.image0, 0);
if (info.sel0 != rTmp)
{
rTmp = info.sel0 + CSize(0,y);
dc.Rectangle(&rTmp);
}
dc.FillSolidRect(XBORDER, y+info.h0, m_uWidth, YSPACE, GetSysColor(COLOR_3DLIGHT));
//dc.Draw3dRect(XBORDER, y, w, info.h0, GetSysColor(COLOR_3DHILIGHT), GetSysColor(COLOR_3DSHADOW));
y += info.h0 + YSPACE;
if (y > r.bottom)
break;
}
if (y < r.bottom)
{
gap = r.bottom - y;
dc.FillSolidRect(XBORDER, y, m_uWidth, r.bottom-y, colBack);
}
if (m_bSendScroll ||
gap != m_uTrailingGap)
{
m_uTrailingGap = gap;
m_bSendScroll = false;
GetParent()->PostMessage(m_uMsgScroll);
}
}
示例9: PaintWorker
//.........这里部分代码省略.........
item_id = ctl->stateId == PBS_HOT ? ID_EXTBKTBBUTTONMOUSEOVER : (ctl->stateId == PBS_PRESSED ? ID_EXTBKTBBUTTONSPRESSED : ID_EXTBKTBBUTTONSNPRESSED);
//GetItemByStatus(ctl->stateId == PBS_HOT ? ID_EXTBKBUTTONSMOUSEOVER : (ctl->stateId == PBS_PRESSED ? ID_EXTBKTBBUTTONSPRESSED : ID_EXTBKTBBUTTONSNPRESSED), &item);
else
item_id = ctl->stateId == PBS_HOT ? ID_EXTBKBUTTONSMOUSEOVER : (ctl->stateId == PBS_PRESSED ? ID_EXTBKBUTTONSPRESSED : ID_EXTBKBUTTONSNPRESSED);
item = &StatusItems[item_id - ID_STATUS_OFFLINE];
//GetItemByStatus(ctl->stateId == PBS_PRESSED ? ID_EXTBKBUTTONSPRESSED : ID_EXTBKBUTTONSNPRESSED, &item);
SetTextColor(hdcMem, item->TEXTCOLOR);
if(item->IGNORED) {
if(pt.y < 10 || cfg::dat.bWallpaperMode)
//SkinDrawBg(ctl->hwnd, hdcMem);
BitBlt(hdcMem, 0, 0, rc.right, rc.bottom, cfg::dat.hdcBg, pt.x, pt.y, SRCCOPY);
else
FillRect(hdcMem, &rc, GetSysColorBrush(COLOR_3DFACE));
}
else {
if(pt.y < 10 || cfg::dat.bWallpaperMode)
//SkinDrawBg(ctl->hwnd, hdcMem);
BitBlt(hdcMem, 0, 0, rc.right, rc.bottom, cfg::dat.hdcBg, pt.x, pt.y, SRCCOPY);
else
FillRect(hdcMem, &rc, GetSysColorBrush(COLOR_3DFACE));
rc.top += item->MARGIN_TOP; rc.bottom -= item->MARGIN_BOTTOM;
rc.left += item->MARGIN_LEFT; rc.right -= item->MARGIN_RIGHT;
DrawAlpha(hdcMem, &rc, item->COLOR, item->ALPHA, item->COLOR2, item->COLOR2_TRANSPARENT, item->GRADIENT,
item->CORNER, item->BORDERSTYLE, item->imageItem);
}
}
else {
if (ctl->stateId == PBS_PRESSED || ctl->stateId == PBS_HOT)
hbr = GetSysColorBrush(COLOR_3DFACE);
else {
HDC dc;
HWND hwndParent;
hwndParent = GetParent(ctl->hwnd);
dc = GetDC(hwndParent);
hbr = (HBRUSH) SendMessage(hwndParent, WM_CTLCOLORDLG, (WPARAM) dc, (LPARAM) hwndParent);
ReleaseDC(hwndParent, dc);
}
if (hbr) {
FillRect(hdcMem, &rc, hbr);
DeleteObject(hbr);
}
}
if(!ctl->bSkinned && ctl->buttonItem == 0) {
if (ctl->stateId == PBS_HOT || ctl->focus) {
if (ctl->pbState)
DrawEdge(hdcMem, &rc, EDGE_ETCHED, BF_RECT | BF_SOFT);
else
DrawEdge(hdcMem, &rc, BDR_RAISEDOUTER, BF_RECT | BF_SOFT);
} else if (ctl->stateId == PBS_PRESSED)
DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT | BF_SOFT);
}
}
} else {
// Draw background/border
if (ctl->hThemeButton && ctl->bThemed) {
int state = IsWindowEnabled(ctl->hwnd) ? (ctl->stateId == PBS_NORMAL && ctl->defbutton ? PBS_DEFAULTED : ctl->stateId) : PBS_DISABLED;
POINT pt;
RECT rcParent;
GetWindowRect(ctl->hwnd, &rcParent);
pt.x = rcParent.left;
pt.y = rcParent.top;
ScreenToClient(pcli->hwndContactList, &pt);
BitBlt(hdcMem, 0, 0, rcClient.right, rcClient.bottom, cfg::dat.hdcBg, pt.x, pt.y, SRCCOPY);
示例10: ServicesPageWndProc
//.........这里部分代码省略.........
ListView_Sort(hServicesListCtrl, 0);
Update_Btn_States(hDlg);
// Select the first item.
ListView_SetItemState(hServicesListCtrl, 0, LVIS_SELECTED, LVIS_SELECTED);
return TRUE;
}
case WM_DESTROY:
{
ClearServicesList();
userModificationsList.RemoveAll();
return 0;
}
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case IDC_BTN_SERVICES_ACTIVATE:
{
BOOL bAreThereModifs = FALSE;
int index = -1; // From the beginning.
while ((index = ListView_GetNextItem(hServicesListCtrl, index, LVNI_ALL)) != -1)
{
bAreThereModifs = ValidateItem(index, TRUE, FALSE) || bAreThereModifs; // The order is verrrrrry important !!!!
}
if (bAreThereModifs)
{
Update_Btn_States(hDlg);
PropSheet_Changed(GetParent(hServicesPage), hServicesPage);
}
return TRUE;
}
case IDC_BTN_SERVICES_DEACTIVATE:
{
BOOL bAreThereModifs = FALSE;
int index = -1; // From the beginning.
while ((index = ListView_GetNextItem(hServicesListCtrl, index, LVNI_ALL)) != -1)
{
bAreThereModifs = ValidateItem(index, FALSE, FALSE) || bAreThereModifs; // The order is verrrrrry important !!!!
}
if (bAreThereModifs)
{
Update_Btn_States(hDlg);
PropSheet_Changed(GetParent(hServicesPage), hServicesPage);
}
return TRUE;
}
case IDC_CBX_SERVICES_MASK_PROPRIETARY_SVCS:
{
bMaskProprietarySvcs = !bMaskProprietarySvcs;
GetServices(bMaskProprietarySvcs);
Update_Btn_States(hDlg);
return TRUE;
}
示例11: switch
bool KX_RaySensor::Evaluate()
{
bool result = false;
bool reset = m_reset && m_level;
m_rayHit = false;
m_hitObject = NULL;
m_hitPosition[0] = 0;
m_hitPosition[1] = 0;
m_hitPosition[2] = 0;
m_hitNormal[0] = 1;
m_hitNormal[1] = 0;
m_hitNormal[2] = 0;
KX_GameObject* obj = (KX_GameObject*)GetParent();
MT_Point3 frompoint = obj->NodeGetWorldPosition();
MT_Matrix3x3 matje = obj->NodeGetWorldOrientation();
MT_Matrix3x3 invmat = matje.inverse();
MT_Vector3 todir;
m_reset = false;
switch (m_axis)
{
case SENS_RAY_X_AXIS: // X
{
todir[0] = invmat[0][0];
todir[1] = invmat[0][1];
todir[2] = invmat[0][2];
break;
}
case SENS_RAY_Y_AXIS: // Y
{
todir[0] = invmat[1][0];
todir[1] = invmat[1][1];
todir[2] = invmat[1][2];
break;
}
case SENS_RAY_Z_AXIS: // Z
{
todir[0] = invmat[2][0];
todir[1] = invmat[2][1];
todir[2] = invmat[2][2];
break;
}
case SENS_RAY_NEG_X_AXIS: // -X
{
todir[0] = -invmat[0][0];
todir[1] = -invmat[0][1];
todir[2] = -invmat[0][2];
break;
}
case SENS_RAY_NEG_Y_AXIS: // -Y
{
todir[0] = -invmat[1][0];
todir[1] = -invmat[1][1];
todir[2] = -invmat[1][2];
break;
}
case SENS_RAY_NEG_Z_AXIS: // -Z
{
todir[0] = -invmat[2][0];
todir[1] = -invmat[2][1];
todir[2] = -invmat[2][2];
break;
}
}
todir.normalize();
m_rayDirection[0] = todir[0];
m_rayDirection[1] = todir[1];
m_rayDirection[2] = todir[2];
MT_Point3 topoint = frompoint + (m_distance) * todir;
PHY_IPhysicsEnvironment* pe = m_scene->GetPhysicsEnvironment();
if (!pe)
{
std::cout << "WARNING: Ray sensor " << GetName() << ": There is no physics environment!" << std::endl;
std::cout << " Check universe for malfunction." << std::endl;
return false;
}
PHY_IPhysicsController *spc = obj->GetPhysicsController();
KX_GameObject *parent = obj->GetParent();
if (!spc && parent)
spc = parent->GetPhysicsController();
if (parent)
parent->Release();
PHY_IPhysicsEnvironment* physics_environment = this->m_scene->GetPhysicsEnvironment();
KX_RayCast::Callback<KX_RaySensor> callback(this, spc);
KX_RayCast::RayTest(physics_environment, frompoint, topoint, callback);
/* now pass this result to some controller */
if (m_rayHit)
{
//.........这里部分代码省略.........
示例12: EtpWsWatchDlgProc
INT_PTR CALLBACK EtpWsWatchDlgProc(
_In_ HWND hwndDlg,
_In_ UINT uMsg,
_In_ WPARAM wParam,
_In_ LPARAM lParam
)
{
PWS_WATCH_CONTEXT context;
if (uMsg == WM_INITDIALOG)
{
context = (PWS_WATCH_CONTEXT)lParam;
SetProp(hwndDlg, L"Context", (HANDLE)context);
}
else
{
context = (PWS_WATCH_CONTEXT)GetProp(hwndDlg, L"Context");
if (uMsg == WM_DESTROY)
RemoveProp(hwndDlg, L"Context");
}
if (!context)
return FALSE;
switch (uMsg)
{
case WM_INITDIALOG:
{
HWND lvHandle;
PhCenterWindow(hwndDlg, GetParent(hwndDlg));
context->WindowHandle = hwndDlg;
context->ListViewHandle = lvHandle = GetDlgItem(hwndDlg, IDC_LIST);
PhSetListViewStyle(lvHandle, FALSE, TRUE);
PhSetControlTheme(lvHandle, L"explorer");
PhAddListViewColumn(lvHandle, 0, 0, 0, LVCFMT_LEFT, 340, L"Instruction");
PhAddListViewColumn(lvHandle, 1, 1, 1, LVCFMT_LEFT, 80, L"Count");
PhSetExtendedListView(lvHandle);
ExtendedListView_SetSort(lvHandle, 1, DescendingSortOrder);
context->Hashtable = PhCreateSimpleHashtable(64);
context->BufferSize = 0x2000;
context->Buffer = PhAllocate(context->BufferSize);
PhInitializeQueuedLock(&context->ResultListLock);
context->SymbolProvider = PhCreateSymbolProvider(context->ProcessItem->ProcessId);
PhLoadSymbolProviderOptions(context->SymbolProvider);
if (!context->SymbolProvider || !context->SymbolProvider->IsRealHandle)
{
PhShowError(hwndDlg, L"Unable to open the process.");
EndDialog(hwndDlg, IDCANCEL);
break;
}
context->ProcessHandle = context->SymbolProvider->ProcessHandle;
// Load symbols for both process and kernel modules.
context->LoadingSymbolsForProcessId = context->ProcessItem->ProcessId;
PhEnumGenericModules(
NULL,
context->ProcessHandle,
0,
EnumGenericModulesCallback,
context
);
context->LoadingSymbolsForProcessId = SYSTEM_PROCESS_ID;
PhEnumGenericModules(
SYSTEM_PROCESS_ID,
NULL,
0,
EnumGenericModulesCallback,
context
);
context->Enabled = EtpUpdateWsWatch(hwndDlg, context);
if (context->Enabled)
{
// WS Watch is already enabled for the process. Enable updating.
EnableWindow(GetDlgItem(hwndDlg, IDC_ENABLE), FALSE);
ShowWindow(GetDlgItem(hwndDlg, IDC_WSWATCHENABLED), SW_SHOW);
SetTimer(hwndDlg, 1, 1000, NULL);
}
else
{
// WS Watch has not yet been enabled for the process.
}
}
break;
case WM_DESTROY:
{
context->Destroying = TRUE;
PhDereferenceObject(context->Hashtable);
if (context->Buffer)
//.........这里部分代码省略.........
示例13: ButOrderOpts
static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
HWND hTree = GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE);
OrderData *dat = (OrderData*)GetWindowLongPtr(hTree, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
dat = (OrderData*)malloc( sizeof(OrderData));
SetWindowLongPtr(hTree, GWLP_USERDATA, (LONG_PTR)dat);
dat->dragging = 0;
SetWindowLongPtr(hTree, GWL_STYLE, GetWindowLongPtr(hTree, GWL_STYLE)|TVS_NOHSCROLL);
SetDlgItemInt(hwndDlg, IDC_BUTTHEIGHT, g_ctrl->nButtonHeight, FALSE);
SendDlgItemMessage(hwndDlg, IDC_SPIN_HEIGHT, UDM_SETRANGE, 0, MAKELONG(50,10));
SendDlgItemMessage(hwndDlg, IDC_SPIN_HEIGHT, UDM_SETPOS, 0, MAKELONG(g_ctrl->nButtonHeight,0));
SetDlgItemInt(hwndDlg, IDC_BUTTWIDTH, g_ctrl->nButtonWidth, FALSE);
SendDlgItemMessage(hwndDlg, IDC_SPIN_WIDTH, UDM_SETRANGE, 0, MAKELONG(50,10));
SendDlgItemMessage(hwndDlg, IDC_SPIN_WIDTH, UDM_SETPOS, 0, MAKELONG(g_ctrl->nButtonWidth,0));
SetDlgItemInt(hwndDlg, IDC_BUTTGAP, g_ctrl->nButtonSpace, FALSE);
SendDlgItemMessage(hwndDlg, IDC_SPIN_GAP, UDM_SETRANGE, 0, MAKELONG(20,0));
SendDlgItemMessage(hwndDlg, IDC_SPIN_GAP, UDM_SETPOS, 0, MAKELONG(g_ctrl->nButtonSpace,0));
CheckDlgButton(hwndDlg, IDC_USEFLAT, g_ctrl->bFlatButtons);
CheckDlgButton(hwndDlg, IDC_AUTORESIZE, g_ctrl->bAutoSize);
CheckDlgButton(hwndDlg, IDC_SINGLELINE, g_ctrl->bSingleLine);
BuildTree(hwndDlg);
EnableWindow(GetDlgItem(hwndDlg, IDC_ENAME), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_EPATH), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_DELLBUTTON), FALSE);
OptionshWnd = hwndDlg;
return TRUE;
case WM_COMMAND:
if (HIWORD(wParam) == EN_CHANGE && OptionshWnd) {
switch(LOWORD(wParam)) {
case IDC_ENAME: case IDC_EPATH:
break;
default:
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
break;
}
if ((HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == BN_DBLCLK)) {
int ctrlid = LOWORD(wParam);
//----- Launch buttons -----
if (ctrlid == IDC_BROWSE) {
TCHAR str[MAX_PATH];
OPENFILENAME ofn = {0};
GetDlgItemText(hwndDlg, IDC_EPATH, str, sizeof(str));
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
ofn.hInstance = NULL;
ofn.lpstrFilter = NULL;
ofn.lpstrFile = str;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_EXPLORER;
ofn.nMaxFile = sizeof(str);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = _T("exe");
if (!GetOpenFileName(&ofn))
break;
SetDlgItemText(hwndDlg, IDC_EPATH, str);
break;
}
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
if (ctrlid == IDC_LBUTTONSET) {
TVITEM tvi ={0};
tvi.hItem = TreeView_GetSelection(hTree);
if (tvi.hItem == NULL)
break;
tvi.mask = TVIF_PARAM;
TreeView_GetItem(hTree, &tvi);
TopButtonInt* btn = (TopButtonInt*)tvi.lParam;
TCHAR buf [256];
// probably, condition not needs
if (btn->dwFlags & TTBBF_ISLBUTTON) {
if (!(btn->dwFlags & TTBBF_OPTIONAL)) {
// create button
TTBButton ttb = { 0 };
ttb.cbSize = sizeof(ttb);
ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RUN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISLBUTTON | TTBBF_INTERNAL | TTBBF_OPTIONAL;
ttb.name = NULL;
ttb.program = NULL;
int id = btn->id;
//.........这里部分代码省略.........
示例14: InitTrayNotify
/*--------------------------------------------------
initialize
----------------------------------------------------*/
void InitTrayNotify(HWND hwndClock)
{
HWND hwnd, hwnd2;
char classname[80];
EndTrayNotify();
bFillTray = GetMyRegLong(NULL, "FillTray", FALSE);
bFlatTray = GetMyRegLong(NULL, "FlatTray", TRUE);
bSkinTray = GetMyRegLong(NULL, "SkinTray", FALSE);
// if(bSkinTray) bFillTray = FALSE; // ちょっと強引に設定の矛盾をなくす
if(!bFillTray && !bFlatTray && !bSkinTray) return ;
// get window handle of TrayNotifyWnd
hwndTrayNotify = GetParent(hwndClock); // TrayNotifyWnd
// search toolbar
if(bFillTray)
{
hwndToolbar = NULL;
hwnd = GetWindow(hwndTrayNotify, GW_CHILD);
while(hwnd)
{
GetClassName(hwnd, classname, 80);
if(lstrcmpi(classname, "ToolbarWindow32") == 0)
{
hwndToolbar = hwnd;
break;
}else if(lstrcmpi(classname, "SysPager") == 0)
{
hwnd2 = GetWindow(hwnd, GW_CHILD);
while(hwnd2)
{
GetClassName(hwnd2, classname, 80);
if(lstrcmpi(classname, "ToolbarWindow32") == 0)
{
hwndToolbar = hwnd2;
break;
}
}
hwnd2 = GetWindow(hwnd2, GW_HWNDNEXT);
}
hwnd = GetWindow(hwnd, GW_HWNDNEXT);
}
if(hwndToolbar == NULL)
{
bFillTray = FALSE;
}
}
if(bFillTray)
{
s_hwndClock = hwndClock;
oldClassStyleTrayNotify = GetClassLongPtr(hwndTrayNotify, GCL_STYLE);
SetClassLongPtr(hwndTrayNotify, GCL_STYLE,
oldClassStyleTrayNotify|CS_HREDRAW|CS_VREDRAW);
oldWndProcTrayNotify =
(WNDPROC)GetWindowLongPtr(hwndTrayNotify, GWLP_WNDPROC);
SubclassWindow(hwndTrayNotify, WndProcTrayNotify);
oldStyleTrayNotify = GetWindowLongPtr(hwndTrayNotify, GWL_STYLE);
SetWindowLongPtr(hwndTrayNotify, GWL_STYLE,
oldStyleTrayNotify & ~(WS_CLIPCHILDREN|WS_CLIPSIBLINGS));
}
if(bFlatTray)
{
oldExStyleTrayNotify = GetWindowLongPtr(hwndTrayNotify, GWL_EXSTYLE);
SetWindowLongPtr(hwndTrayNotify, GWL_EXSTYLE,
oldExStyleTrayNotify & ~WS_EX_STATICEDGE);
SetWindowPos(hwndTrayNotify, NULL, 0, 0, 0, 0,
SWP_DRAWFRAME|SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER);
}
if(bFillTray || bFlatTray)
InvalidateRect(hwndTrayNotify, NULL, TRUE);
// if(bFillTray)
// SendMessage(hwndToolbar, WM_SYSCOLORCHANGE, 0, 0);
if(bFillTray)
{
if(!bWinXP)
SendMessage(hwndToolbar, WM_SYSCOLORCHANGE, 0, 0);
else
SendMessage(GetParent(hwndToolbar), WM_SYSCOLORCHANGE, 0, 0);
}
#ifdef TEST_505
{
RECT rc;
LONG style;
style = GetWindowLongPtr(hwndTrayNotify, GWL_STYLE);
style |= WS_POPUPWINDOW | WS_CAPTION;
//.........这里部分代码省略.........
示例15: switch
bool TrackBar::OnEventMouse(Event event,WPARAM wparam,LPARAM lparam)
{
if(!GetVisible() || !GetEnabled())
return false;
switch(event)
{
case EventLeftButtonDown:
if(PointInTrack(*(Point*)wparam))
{
if(!GetFocused())
Focus();
mTracking = true;
mTrackingValue = mValue;
mTrackingPosition = ((Point*)wparam)->x - GetTrackBox().GetCenter().x;
SetCapture(GetKernel()->GetWindowHandle());
return true;
}
if(PointIn(*(Point*)wparam))
{
if(!GetFocused())
Focus();
if(((Point*)wparam)->x > GetTrackBox().GetCenter().x)
{
if(GetTrackValue() < GetTrackRange())
SetTrackValue(GetTrackValue() + 1);
}
else
{
if(GetTrackValue())
SetTrackValue(GetTrackValue() - 1);
}
return true;
}
break;
case EventLeftButtonUp:
if(mTracking)
{
mTracking = false;
ReleaseCapture();
return true;
}
break;
case EventMouseMove:
if(mTracking)
{
Point delta = *(Point*)wparam;
delta.x -= GetScreenPosition().x + mTrackingPosition;
float val = (float)GetBoundingBox().GetWidth() / (float)GetTrackRange();
if((float)delta.x / val > (float)GetTrackRange())
SetTrackValue(GetTrackRange());
else if((float)delta.x / val < 0.0f)
SetTrackValue(0);
else
SetTrackValue((float)delta.x / val);
if(GetParent())
GetParent()->OnEvent(EventChildCommand,ControlEventTrackChange,(LPARAM)this);
}
break;
}
return Control::OnEventMouse(event,wparam,lparam);
}