本文整理汇总了C++中TreeView_GetSelection函数的典型用法代码示例。如果您正苦于以下问题:C++ TreeView_GetSelection函数的具体用法?C++ TreeView_GetSelection怎么用?C++ TreeView_GetSelection使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TreeView_GetSelection函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDlgItem
void CPpcFolderDlg::OnBtnDown(HWND hDlg, WPARAM wParam)
{
TV_ITEM tvi;
HWND hWnd = GetDlgItem(hDlg, IDC_TREE_FOLDER);
HTREEITEM hItem = TreeView_GetSelection(hWnd);
if (!hItem)
return;
memset(&tvi, 0, sizeof(tvi));
tvi.mask = TVIF_CHILDREN | TVIF_STATE;
tvi.hItem = hItem;
TreeView_GetItem(hWnd, &tvi);
if (tvi.cChildren) {
if (wParam == VK_RIGHT) {
if (!(tvi.state & TVIS_EXPANDED))
TreeView_Expand(hWnd, hItem, TVE_EXPAND);
else {
hItem = TreeView_GetChild(hWnd, hItem);
TreeView_SelectItem(hWnd, hItem);
}
}
else {
if (tvi.state & TVIS_EXPANDED)
TreeView_Expand(hWnd, hItem, TVE_COLLAPSE);
else {
hItem = TreeView_GetParent(hWnd, hItem);
TreeView_SelectItem(hWnd, hItem);
}
}
}
else {
if (wParam == VK_LEFT) {
hItem = TreeView_GetParent(hWnd, hItem);
TreeView_SelectItem(hWnd, hItem);
}
}
}
示例2: LoadLibraryW
VOID
CDeviceView::DisplayPropertySheet()
{
#ifndef __REACTOS__
pDevicePropertiesExW DevicePropertiesExW;
HMODULE hModule;
hModule = LoadLibraryW(L"devmgr.dll");
if (hModule == NULL) return;
DevicePropertiesExW = (pDevicePropertiesExW)GetProcAddress(hModule,
"DevicePropertiesExW");
if (DevicePropertiesExW == NULL)
{
FreeLibrary(hModule);
return;
}
#endif
TV_ITEM tvItem;
tvItem.hItem = TreeView_GetSelection(m_hTreeView);
tvItem.mask = TVIF_PARAM;
if (TreeView_GetItem(m_hTreeView, &tvItem) &&
(LPTSTR)tvItem.lParam != NULL)
{
DevicePropertiesExW(m_hTreeView,
NULL,
(LPTSTR)tvItem.lParam,
1,//DPF_EXTENDED,
FALSE);
}
#ifndef __REACTOS__
FreeLibrary(hModule);
#endif
}
示例3: GetDlgItem
void CAddBookmarkDialog::OnOk()
{
HWND hName = GetDlgItem(m_hDlg,IDC_BOOKMARK_NAME);
std::wstring strName;
GetWindowString(hName,strName);
HWND hLocation = GetDlgItem(m_hDlg,IDC_BOOKMARK_LOCATION);
std::wstring strLocation;
GetWindowString(hLocation,strLocation);
if(strName.size() > 0 &&
strLocation.size() > 0)
{
HWND hTreeView = GetDlgItem(m_hDlg,IDC_BOOKMARK_TREEVIEW);
HTREEITEM hSelected = TreeView_GetSelection(hTreeView);
CBookmarkFolder &BookmarkFolder = m_pBookmarkTreeView->GetBookmarkFolderFromTreeView(hSelected);
CBookmark Bookmark = CBookmark::Create(strName,strLocation,_T(""));
BookmarkFolder.InsertBookmark(Bookmark);
}
EndDialog(m_hDlg,1);
}
示例4: TreeWndProc
/* Header code - Directional Arrows */
static LRESULT CALLBACK TreeWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (GetBackgroundBitmap() != NULL)
{
switch (uMsg)
{
case WM_MOUSEMOVE:
{
if (MouseHasBeenMoved())
ShowCursor(TRUE);
break;
}
case WM_KEYDOWN :
if (wParam == VK_F2)
{
if (lpCurrentFolder->m_dwFlags & F_CUSTOM)
{
TreeView_EditLabel(hWnd,TreeView_GetSelection(hWnd));
return TRUE;
}
}
break;
case WM_ERASEBKGND:
return TRUE;
break;
case WM_PAINT:
TreeCtrlOnPaint(hWnd, uMsg, wParam, lParam);
break;
}
}
/* message not handled */
return CallWindowProc(g_lpTreeWndProc, hWnd, uMsg, wParam, lParam);
}
示例5: XuLy_LV_NMDBLCLK
void XuLy_LV_NMDBLCLK(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
NMITEMACTIVATE *lpnmitem = (LPNMITEMACTIVATE) lParam;
// Neu khong co item nao duoc chon thi thoat
if (lpnmitem->iItem == -1)
return;
LVITEM kq;
TCHAR szFileName[PATHFILE_MAX_LEN];
kq.mask = LVIF_TEXT;
kq.iItem = lpnmitem->iItem;
kq.iSubItem = 0;
kq.pszText = szFileName;
kq.cchTextMax = PATHFILE_MAX_LEN;
ListView_GetItem(hwndListView, &kq);
HTREEITEM hParent = TreeView_GetSelection(hwndTreeView);
HTREEITEM hItem = TV_FindItem(hParent, kq.pszText);
if (hItem == NULL) // Item la tap tin
{
// Lay duong dan cua thu muc cha roi noi voi ten tap tin de co duoc duong
// dan thuc su cua file
TVITEM k;
k.hItem = hParent;
k.mask = TVIF_PARAM;
TreeView_GetItem(hwndTreeView, &k);
TCHAR szFile[PATHFILE_MAX_LEN];
wsprintf(szFile, _T("%s\\%s"), (TCHAR*) k.lParam, kq.pszText);
// Thuc thi file
ShellExecute(NULL , _T("open"), szFile, NULL, NULL, SW_SHOWNORMAL);
}
else
TreeView_SelectItem(hwndTreeView, hItem);
}
示例6: TreeView_AddItem
HTREEITEM TreeView_AddItem(int iImage, const TCHAR *text)
{
HTREEITEM hCurrent = TreeView_GetSelection(g_hwndTree);
TVINSERTSTRUCT tvs;
tvs.item.mask = TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT;
if (!hCurrent)
tvs.hParent = TVI_ROOT;
else
tvs.hParent = hCurrent;
tvs.item.pszText = (LPSTR)text;
tvs.item.iSelectedImage = tvs.item.iImage = iImage;
tvs.item.lParam = g_tvIndexCFG++;
tvs.item.cchTextMax = lstrlen(tvs.item.pszText) + 1;
tvs.hInsertAfter = TVI_LAST;
HTREEITEM hNewItem = TreeView_InsertItem(g_hwndTree, &tvs);
if (hCurrent)
TreeView_Expand(g_hwndTree, hCurrent, TVE_EXPAND);
return hNewItem;
}
示例7: _CmdWndProc
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HTREEITEM hSelection;
HKEY hRootKey;
LPCWSTR keyPath, s;
WORD wID = LOWORD(wParam);
UNREFERENCED_PARAMETER(message);
switch (wID)
{
/* Parse the menu selections: */
case ID_REGISTRY_EXIT:
DestroyWindow(hWnd);
break;
case ID_VIEW_REFRESH:
/* TODO */
break;
case ID_TREE_EXPANDBRANCH:
(void)TreeView_Expand(g_pChildWnd->hTreeWnd, TreeView_GetSelection(g_pChildWnd->hTreeWnd), TVE_EXPAND);
break;
case ID_TREE_COLLAPSEBRANCH:
(void)TreeView_Expand(g_pChildWnd->hTreeWnd, TreeView_GetSelection(g_pChildWnd->hTreeWnd), TVE_COLLAPSE);
break;
case ID_TREE_RENAME:
SetFocus(g_pChildWnd->hTreeWnd);
(void)TreeView_EditLabel(g_pChildWnd->hTreeWnd, TreeView_GetSelection(g_pChildWnd->hTreeWnd));
break;
case ID_TREE_DELETE:
hSelection = TreeView_GetSelection(g_pChildWnd->hTreeWnd);
keyPath = GetItemPath(g_pChildWnd->hTreeWnd, hSelection, &hRootKey);
if (keyPath == 0 || *keyPath == 0)
{
MessageBeep(MB_ICONHAND);
}
else if (DeleteKey(hWnd, hRootKey, keyPath))
DeleteNode(g_pChildWnd->hTreeWnd, 0);
break;
case ID_TREE_EXPORT:
ExportRegistryFile(g_pChildWnd->hTreeWnd);
break;
case ID_EDIT_FIND:
FindDialog(hWnd);
break;
case ID_EDIT_COPYKEYNAME:
hSelection = TreeView_GetSelection(g_pChildWnd->hTreeWnd);
keyPath = GetItemPath(g_pChildWnd->hTreeWnd, hSelection, &hRootKey);
CopyKeyName(hWnd, hRootKey, keyPath);
break;
case ID_EDIT_NEW_KEY:
CreateNewKey(g_pChildWnd->hTreeWnd, TreeView_GetSelection(g_pChildWnd->hTreeWnd));
break;
case ID_EDIT_NEW_STRINGVALUE:
case ID_EDIT_NEW_BINARYVALUE:
case ID_EDIT_NEW_DWORDVALUE:
SendMessageW(hFrameWnd, WM_COMMAND, wParam, lParam);
break;
case ID_SWITCH_PANELS:
g_pChildWnd->nFocusPanel = !g_pChildWnd->nFocusPanel;
SetFocus(g_pChildWnd->nFocusPanel? g_pChildWnd->hListWnd: g_pChildWnd->hTreeWnd);
break;
default:
if ((wID >= ID_TREE_SUGGESTION_MIN) && (wID <= ID_TREE_SUGGESTION_MAX))
{
s = Suggestions;
while(wID > ID_TREE_SUGGESTION_MIN)
{
if (*s)
s += wcslen(s) + 1;
wID--;
}
SelectNode(g_pChildWnd->hTreeWnd, s);
break;
}
return FALSE;
}
return TRUE;
}
示例8: ObjectBrowserProc
LRESULT WINAPI ObjectBrowserProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
traceIn(ObjectBrowserProc);
switch(message)
{
case WM_COMMAND:
switch(LOWORD(wParam))
{
case ID_OBJECTS_OPENMODULE:
LoadNewModule();
break;
case ID_OBJECTS_UNLOADMODULE:
{
DWORD dwCurSel = SendMessage(hwndModuleList, LB_GETCURSEL, 0, 0);
if(dwCurSel != LB_ERR)
{
if(MessageBox(hwndModuleList, TEXT("Unloading a module will remove all objects associated with this module from this level.\r\n\r\nAre you sure you want to do this?"), TEXT("Unload Module"), MB_YESNO|MB_ICONQUESTION) == IDYES)
{
String strModuleName;
strModuleName.SetLength(255);
SendMessage(hwndModuleList, LB_GETTEXT, dwCurSel, (LPARAM)(CTSTR)strModuleName);
SendMessage(hwndModuleList, LB_DELETESTRING, dwCurSel, 0);
level->UnloadLevelModule(strModuleName);
UpdateObjectTreeAndModules();
}
}
else
MessageBox(hwnd, TEXT("You have to select a module to unload."), NULL, MB_OK);
break;
}
case ID_OBJECTS_CLOSE:
DestroyWindow(hwnd);
editor->hwndObjectBrowser = NULL;
break;
}
break;
case WM_NOTIFY:
{
NMTREEVIEW *info = (NMTREEVIEW*)lParam;
if(info->hdr.code == TVN_SELCHANGED)
{
HTREEITEM hItem = TreeView_GetSelection(hwndObjectTree);
TVITEMEX tvi;
zero(&tvi, sizeof(tvi));
tvi.mask = TVIF_PARAM|TVIF_HANDLE;
tvi.hItem = hItem;
TreeView_GetItem(hwndObjectTree, &tvi);
Class *cls = (Class*)tvi.lParam;
editor->selectedEntityClass = cls;
if((levelInfo->curEditMode == EditMode_Create) && levelInfo->newObject && levelInfo->newObject->IsOf(GetClass(EntityPlacer)))
{
EntityPlacer *ep = (EntityPlacer*)levelInfo->newObject;
EditMode em = ep->prevEditMode;
EntityType et = ep->entityType;
delete levelInfo->newObject;
levelInfo->newObject = CreateObjectParam2(EntityPlacer, em, et);
}
}
break;
}
case WM_SIZE:
{
int cx = LOWORD(lParam);
int cy = HIWORD(lParam);
SetWindowPos(hwndObjectTree, NULL, 150, 0, cx-150, cy, SWP_NOMOVE);
SetWindowPos(hwndModuleList, NULL, 0, 0, 150, cy, SWP_NOMOVE);
break;
}
case WM_SIZING:
{
int borderXSize = 300;
int borderYSize = 300;
borderXSize += GetSystemMetrics(SM_CXSIZEFRAME)*2;
borderYSize += GetSystemMetrics(SM_CYSIZEFRAME)*2;
borderYSize += GetSystemMetrics(SM_CYCAPTION);
borderYSize += GetSystemMetrics(SM_CYMENU);
RECT *pRect = (RECT*)lParam;
//.........这里部分代码省略.........
示例9: switch
//.........这里部分代码省略.........
case IDC_MANAGESKINS_CLICKTHROUGH_CHECKBOX:
m_IgnoreUpdate = true;
m_SkinWindow->SetClickThrough(!m_SkinWindow->GetClickThrough());
break;
case IDC_MANAGESKINS_KEEPONSCREEN_CHECKBOX:
m_IgnoreUpdate = true;
m_SkinWindow->SetKeepOnScreen(!m_SkinWindow->GetKeepOnScreen());
break;
case IDC_MANAGESKINS_SAVEPOSITION_CHECKBOX:
m_IgnoreUpdate = true;
m_SkinWindow->SetSavePosition(!m_SkinWindow->GetSavePosition());
break;
case IDC_MANAGESKINS_SNAPTOEDGES_CHECKBOX:
m_IgnoreUpdate = true;
m_SkinWindow->SetSnapEdges(!m_SkinWindow->GetSnapEdges());
break;
case IDC_MANAGESKINS_ZPOSITION_COMBOBOX:
if (HIWORD(wParam) == CBN_SELCHANGE)
{
m_IgnoreUpdate = true;
ZPOSITION zpos = (ZPOSITION)(ComboBox_GetCurSel((HWND)lParam) - 2);
m_SkinWindow->SetWindowZPosition(zpos);
}
break;
case IDC_MANAGESKINS_TRANSPARENCY_COMBOBOX:
if (HIWORD(wParam) == CBN_SELCHANGE)
{
m_IgnoreUpdate = true;
int sel = ComboBox_GetCurSel((HWND)lParam) + IDM_SKIN_TRANSPARENCY_0;
SendMessage(m_SkinWindow->GetWindow(), WM_COMMAND, sel, 0);
}
break;
case IDC_MANAGESKINS_ONHOVER_COMBOBOX:
if (HIWORD(wParam) == CBN_SELCHANGE)
{
m_IgnoreUpdate = true;
HIDEMODE hide = (HIDEMODE)ComboBox_GetCurSel((HWND)lParam);
m_SkinWindow->SetWindowHide(hide);
}
break;
case IDM_MANAGESKINSMENU_EXPAND:
{
HWND tree = GetDlgItem(m_Window, IDC_MANAGESKINS_SKINS_TREEVIEW);
HTREEITEM item = TreeView_GetSelection(tree);
TreeView_Expand(tree, item, TVE_TOGGLE);
}
break;
case IDM_MANAGESKINSMENU_OPENFOLDER:
{
HWND tree = GetDlgItem(m_Window, IDC_MANAGESKINS_SKINS_TREEVIEW);
Rainmeter->OpenSkinFolder(GetTreeSelectionPath(tree));
}
break;
default:
if (wParam >= ID_CONFIG_FIRST && wParam <= ID_CONFIG_LAST)
{
std::map<std::wstring, CMeterWindow*>::const_iterator iter = Rainmeter->GetAllMeterWindows().begin();
int index = (int)wParam - ID_CONFIG_FIRST;
int i = 0;
for ( ; iter != Rainmeter->GetAllMeterWindows().end(); ++iter)
{
if (i == index)
{
std::wstring name = ((*iter).second)->GetFolderPath() + L'\\';
name += ((*iter).second)->GetFileName();
HWND item = GetDlgItem(m_Window, IDC_MANAGESKINS_SKINS_TREEVIEW);
SelectTreeItem(item, TreeView_GetRoot(item), name.c_str());
break;
}
++i;
}
}
else if (wParam == IDM_SKIN_MONITOR_AUTOSELECT ||
wParam == IDM_SKIN_MONITOR_PRIMARY ||
wParam >= ID_MONITOR_FIRST && wParam <= ID_MONITOR_LAST)
{
if (m_SkinWindow)
{
SendMessage(m_SkinWindow->GetWindow(), WM_COMMAND, wParam, 0);
}
break;
}
return 1;
}
return 0;
}
示例10: TreeViewNotify
static LRESULT TreeViewNotify(HWND hWnd, LPARAM lParam,INT iLVIndex,LPNMHDR pnmh)
{
LPNMLVKEYDOWN pnkd;
struct OBJ *poj;
CHAR szServ[20];
LPNMHDR lpnmh;
HTREEITEM hItem;
LPNMTREEVIEW lpnmtv;
TVITEM item;
BOOL fReturn;
LRESULT lRes;
if (iLVIndex>100||iLVIndex<0) return 0;
poj=TVList[iLVIndex].lpObj;
if (pnmh->code==0) efx2();
lpnmh = (LPNMHDR) lParam;
// Lancio se connessa la procedura di controllo esterna
if (TVList[iLVIndex].subPostNotify)
{
fReturn=FALSE;
lRes=(*TVList[iLVIndex].subPostNotify)(poj,&fReturn, EXT_PREV,hWnd,0,0,lParam);
if (fReturn) return lRes;
}
switch(pnmh->code)
{
case TVN_SELCHANGING:
lpnmtv = (LPNMTREEVIEW) lParam;
TreeView_SelectDropTarget(lpnmh->hwndFrom,lpnmtv->itemNew.hItem);
ZeroFill(item);
hItem=TreeView_GetSelection(lpnmh->hwndFrom);
item.mask=TVIF_PARAM;
item.hItem=hItem;
item.pszText=szServ;
item.cchTextMax=sizeof(szServ);
TreeView_GetItem(lpnmh->hwndFrom,&item);
OBJ_key=item.lParam;
sprintf(szServ,"%sSEL",poj->nome);
obj_addevent(szServ);
break;
case NM_DBLCLK :
ZeroFill(item);
hItem=TreeView_GetSelection(lpnmh->hwndFrom);
item.mask=TVIF_PARAM;
item.hItem=hItem;
item.pszText=szServ;
item.cchTextMax=sizeof(szServ);
TreeView_GetItem(lpnmh->hwndFrom,&item);
OBJ_key=item.lParam;
sprintf(szServ,"%sDCLK",poj->nome);
obj_addevent(szServ);
break;
case NM_RCLICK:
hItem=TreeView_GetSelection(lpnmh->hwndFrom);
if (hItem==NULL) break;
//memset(&item,0,sizeof(item));
ZeroFill(item);
item.mask=TVIF_TEXT|TVIF_PARAM;
item.hItem=hItem;
item.pszText=szServ;
item.cchTextMax=sizeof(szServ);
TreeView_GetItem(lpnmh->hwndFrom,&item);
//_d_("[%s] ",szServ);
OBJ_key=item.lParam;
sprintf(szServ,"%sRC",poj->nome);
obj_addevent(szServ);
break;
case TVN_BEGINDRAG:
//case TVN_BEGINRDRAG:
Main_OnBeginDrag(lpnmh->hwndFrom, (LPNMTREEVIEW) lParam);
break;
//efx1();
//break;
case TVN_KEYDOWN:
pnkd = (LPNMLVKEYDOWN) lParam;
if (pnkd->wVKey==ESC) winSetFocus(WindowNow());
if ((pnkd->wVKey>=' ')&&(pnkd->wVKey<='<'))
{
//efx1();
}
break;
}
// Lancio se connessa la procedura di controllo esterna
if (TVList[iLVIndex].subPostNotify)
//.........这里部分代码省略.........
示例11: CoTaskMemFree
BOOL Explorerplusplus::OnTreeViewItemExpanding(LPARAM lParam)
{
NMTREEVIEW *pnmtv;
TVITEM *tvItem;
HTREEITEM *pItem;
NMHDR *nmhdr;
nmhdr = (NMHDR *)lParam;
pnmtv = (LPNMTREEVIEW)lParam;
tvItem = &pnmtv->itemNew;
pItem = &tvItem->hItem;
if(TreeView_GetParent(nmhdr->hwndFrom,*pItem) == NULL)
{
return FALSE;
}
if(pnmtv->action == TVE_EXPAND)
{
LPITEMIDLIST pidl = NULL;
pidl = m_pMyTreeView->BuildPath(tvItem->hItem);
m_pMyTreeView->AddDirectory(tvItem->hItem,pidl);
CoTaskMemFree(pidl);
}
else
{
HTREEITEM hSelection = TreeView_GetSelection(m_hTreeView);
if(hSelection != NULL)
{
/* We may collapse multiple levels (not just the parent folder), so we need
to search up the tree for the parent item. */
HTREEITEM hItem = hSelection;
do
{
hItem = TreeView_GetParent(m_hTreeView,hItem);
} while (hItem != tvItem->hItem && hItem != NULL);
if(hItem == tvItem->hItem)
{
LPITEMIDLIST pidl = NULL;
pidl = m_pMyTreeView->BuildPath(tvItem->hItem);
BrowseFolder(pidl,SBSP_SAMEBROWSER);
CoTaskMemFree(pidl);
}
}
m_pMyTreeView->EraseItems(tvItem->hItem);
SendMessage(nmhdr->hwndFrom,TVM_EXPAND,
(WPARAM)TVE_COLLAPSE|TVE_COLLAPSERESET,
(LPARAM)tvItem->hItem);
}
return FALSE;
}
示例12: rowOptShowSettings
void rowOptShowSettings(HWND hwnd)
{
TVITEM tvi;
pROWCELL cell;
HTREEITEM node = TreeView_GetSelection(GetDlgItem(hwnd, IDC_ROWTREE));
int param;
tvi.hItem = node;
tvi.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
TreeView_GetItem(GetDlgItem(hwnd, IDC_ROWTREE), &tvi);
cell = (pROWCELL)tvi.lParam;
if (!tvi.hItem) {
EnableWindow(GetDlgItem(hwnd, IDC_CONTTYPE), 0);
EnableWindow(GetDlgItem(hwnd, IDC_VALIGN), 0);
EnableWindow(GetDlgItem(hwnd, IDC_HALIGN), 0);
EnableWindow(GetDlgItem(hwnd, IDC_CONTWIDTH), 0);
EnableWindow(GetDlgItem(hwnd, IDC_CONTHEIGHT), 0);
EnableWindow(GetDlgItem(hwnd, IDC_SPINCONTWIDTH), 0);
EnableWindow(GetDlgItem(hwnd, IDC_SPINCONTHEIGHT), 0);
SendDlgItemMessage(hwnd, IDC_SPINCONTWIDTH, UDM_SETPOS, 0, 0);
SendDlgItemMessage(hwnd, IDC_SPINCONTHEIGHT, UDM_SETPOS, 0, 0);
EnableWindow(GetDlgItem(hwnd, IDC_CONTLAYER), 0);
return;
}
EnableWindow(GetDlgItem(hwnd, IDC_CONTTYPE), 1);
EnableWindow(GetDlgItem(hwnd, IDC_VALIGN), 1);
EnableWindow(GetDlgItem(hwnd, IDC_HALIGN), 1);
EnableWindow(GetDlgItem(hwnd, IDC_CONTLAYER), 1);
if (cell->type != TC_SPACE && cell->type != TC_FIXED) {
EnableWindow(GetDlgItem(hwnd, IDC_CONTWIDTH), 0);
EnableWindow(GetDlgItem(hwnd, IDC_CONTHEIGHT), 0);
EnableWindow(GetDlgItem(hwnd, IDC_SPINCONTWIDTH), 0);
EnableWindow(GetDlgItem(hwnd, IDC_SPINCONTHEIGHT), 0);
SendDlgItemMessage(hwnd, IDC_SPINCONTWIDTH, UDM_SETPOS, 0, 0);
SendDlgItemMessage(hwnd, IDC_SPINCONTHEIGHT, UDM_SETPOS, 0, 0);
}
else {
EnableWindow(GetDlgItem(hwnd, IDC_CONTWIDTH), 1);
EnableWindow(GetDlgItem(hwnd, IDC_CONTHEIGHT), 1);
EnableWindow(GetDlgItem(hwnd, IDC_SPINCONTWIDTH), 1);
EnableWindow(GetDlgItem(hwnd, IDC_SPINCONTHEIGHT), 1);
SendDlgItemMessage(hwnd, IDC_SPINCONTWIDTH, UDM_SETPOS, 0, MAKELONG(cell->w, 0));
SendDlgItemMessage(hwnd, IDC_SPINCONTHEIGHT, UDM_SETPOS, 0, MAKELONG(cell->h, 0));
}
SendDlgItemMessage(hwnd, IDC_CONTTYPE, CB_SETCURSEL, cell->type, 0);
switch (cell->valign) {
case TC_VCENTER:
param = 1;
break;
case TC_BOTTOM:
param = 2;
break;
default:
param = 0;
}
SendDlgItemMessage(hwnd, IDC_VALIGN, CB_SETCURSEL, param, 0);
switch (cell->halign) {
case TC_HCENTER:
param = 1;
break;
case TC_RIGHT:
param = 2;
break;
default:
param = 0;
}
SendDlgItemMessage(hwnd, IDC_HALIGN, CB_SETCURSEL, param, 0);
CheckDlgButton(hwnd, IDC_CONTLAYER, cell->layer ? BST_CHECKED : BST_UNCHECKED);
}
示例13: DrivesTabProc
//.........这里部分代码省略.........
GetParent(hWnd),
IDC_PUSH_PROPERTIES,
(tvi.cChildren == 0) ? TRUE : FALSE
);
break;
}
case NM_DBLCLK:
{
// pretend we have clicked the Property button
PostMessage(
GetParent(hWnd),
WM_COMMAND,
MAKEWPARAM( IDC_PUSH_PROPERTIES, BN_CLICKED ),
0
);
break;
}
}
}
case WM_COMMAND:
{
LPDRIVE_INFO DriveInfo;
switch( LOWORD( wParam )) {
case IDC_PUSH_DRIVE_TYPE:
case IDC_PUSH_DRIVE_LETTER:
case IDC_PUSH_REFRESH:
FreeDriveInfoStructures( hWnd );
FillTreeViewWithDrives( hWnd,
GetDlgItem(hWnd, IDC_TV_DRIVE_LIST),
LOWORD( wParam ) );
EnableControl( GetParent(hWnd),
IDC_PUSH_PROPERTIES,
FALSE);
break;
case IDC_PUSH_SCSI_CHAIN:
DisplaySCSIDevices( hWnd, GetDlgItem(hWnd, IDC_TV_DRIVE_LIST) );
break;
case IDC_PUSH_PHYSICAL_DISKS:
//WORKITEM
break;
case IDC_PUSH_PROPERTIES:
if (HIWORD( wParam) == BN_CLICKED) {
TV_ITEM tvi;
TCHAR szBuffer[512];
tvi.mask = TVIF_TEXT | TVIF_CHILDREN | TVIF_PARAM;
tvi.hItem = TreeView_GetSelection( GetDlgItem(hWnd, IDC_TV_DRIVE_LIST) );
tvi.pszText = szBuffer;
tvi.cchTextMax = sizeof(szBuffer);
TreeView_GetItem (GetDlgItem(hWnd, IDC_TV_DRIVE_LIST), &tvi);
if ( !tvi.cChildren )
{
if ( GetDriveInfo( (LPDRIVE_INFO) tvi.lParam ) )
{
DisplayDrivePropertySheet( hWnd, (LPDRIVE_INFO) tvi.lParam);
}
else
{
TCHAR Buffer[256];
wsprintf( Buffer, (LPCTSTR) GetString( IDS_APPLICATION_FULLNAME ));
MessageBox ( hWnd,
(LPCTSTR) GetString( IDS_DRIVE_PROPERTY_NOT_AVAILABLE ),
Buffer,
MB_ICONSTOP | MB_OK );
}
}
break;
}
}
break;
}
}
return(FALSE);
}
示例14: OnTocTreeNotify
static LRESULT OnTocTreeNotify(WindowInfo *win, LPNMTREEVIEW pnmtv)
{
switch (pnmtv->hdr.code)
{
case TVN_SELCHANGED:
// When the focus is set to the toc window the first item in the treeview is automatically
// selected and a TVN_SELCHANGEDW notification message is sent with the special code pnmtv->action == 0x00001000.
// We have to ignore this message to prevent the current page to be changed.
if (TVC_BYKEYBOARD == pnmtv->action || TVC_BYMOUSE == pnmtv->action)
GoToTocLinkForTVItem(win, pnmtv->hdr.hwndFrom, pnmtv->itemNew.hItem, TVC_BYMOUSE == pnmtv->action);
// The case pnmtv->action==TVC_UNKNOWN is ignored because
// it corresponds to a notification sent by
// the function TreeView_DeleteAllItems after deletion of the item.
break;
case TVN_KEYDOWN: {
TV_KEYDOWN *ptvkd = (TV_KEYDOWN *)pnmtv;
if (VK_TAB == ptvkd->wVKey) {
if (win->tabsVisible && IsCtrlPressed())
TabsOnCtrlTab(win, IsShiftPressed());
else
AdvanceFocus(win);
return 1;
}
break;
}
case NM_CLICK: {
// Determine which item has been clicked (if any)
TVHITTESTINFO ht = { 0 };
DWORD pos = GetMessagePos();
ht.pt.x = GET_X_LPARAM(pos);
ht.pt.y = GET_Y_LPARAM(pos);
MapWindowPoints(HWND_DESKTOP, pnmtv->hdr.hwndFrom, &ht.pt, 1);
TreeView_HitTest(pnmtv->hdr.hwndFrom, &ht);
// let TVN_SELCHANGED handle the click, if it isn't on the already selected item
if ((ht.flags & TVHT_ONITEM) && TreeView_GetSelection(pnmtv->hdr.hwndFrom) == ht.hItem)
GoToTocLinkForTVItem(win, pnmtv->hdr.hwndFrom, ht.hItem);
break;
}
case NM_RETURN:
GoToTocLinkForTVItem(win, pnmtv->hdr.hwndFrom);
break;
case NM_CUSTOMDRAW:
#ifdef DISPLAY_TOC_PAGE_NUMBERS
if (win->AsEbook())
return CDRF_DODEFAULT;
switch (((LPNMCUSTOMDRAW)pnmtv)->dwDrawStage) {
case CDDS_PREPAINT:
return CDRF_NOTIFYITEMDRAW;
case CDDS_ITEMPREPAINT:
return CDRF_DODEFAULT | CDRF_NOTIFYPOSTPAINT;
case CDDS_ITEMPOSTPAINT:
RelayoutTocItem((LPNMTVCUSTOMDRAW)pnmtv);
// fall through
default:
return CDRF_DODEFAULT;
}
break;
#else
return CDRF_DODEFAULT;
#endif
case TVN_GETINFOTIP:
CustomizeTocInfoTip((LPNMTVGETINFOTIP)pnmtv);
break;
}
return -1;
}
示例15: WndProc
static LRESULT CALLBACK WndProc (HWND hwnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
{
static bool bDragging = FALSE;
switch (uMessage)
{
case WM_SETFOCUS:
case WM_KILLFOCUS:
{
mxWindow *window = (mxWindow *) GetWindowLong (hwnd, GWL_USERDATA);
if ( window )
{
mxEvent event;
event.event = mxEvent::Focus;
event.widget = NULL;
event.action = (uMessage == WM_SETFOCUS);
RecursiveHandleEvent( window, &event );
return 0;
}
}
break;
case WM_ACTIVATE:
{
mxWindow *window = (mxWindow *) GetWindowLong (hwnd, GWL_USERDATA);
if ( window )
{
mxEvent event;
event.event = mxEvent::Activate;
event.widget = NULL;
event.action = (LOWORD( wParam ) != WA_INACTIVE);
RecursiveHandleEvent( window, &event );
return 0;
}
}
break;
case WM_COMMAND:
{
mxWindow *window = (mxWindow *) GetWindowLong (hwnd, GWL_USERDATA);
if (LOWORD (wParam) > 0 && window)
{
WORD wNotifyCode = (WORD) HIWORD (wParam);
HWND hwndCtrl = (HWND) lParam;
mxEvent event;
CHAR className[128];
GetClassName (hwndCtrl, className, 128);
if (!strcmpi (className, "edit"))
{
if (wNotifyCode != EN_CHANGE)
break;
}
else if (!strcmpi (className, "combobox"))
{
if (wNotifyCode != CBN_SELCHANGE)
break;
}
else if (!strcmpi (className, "listbox"))
{
if (wNotifyCode != LBN_SELCHANGE)
break;
}
event.event = mxEvent::Action;
event.widget = (mxWidget *) GetWindowLong ((HWND) lParam, GWL_USERDATA);
event.action = (int) LOWORD (wParam);
RecursiveHandleEvent( window, &event );
}
}
break;
case WM_NOTIFY:
{
if (isClosing)
break;
NMHDR *nmhdr = (NMHDR *) lParam;
mxEvent event;
#if 0
//if ( nmhdr->idFrom > 0 )
{
mxWidget *temp = (mxWidget *) GetWindowLong (nmhdr->hwndFrom, GWL_USERDATA);
if ( temp && temp->getType() == MX_TREEVIEW )
{
NMTREEVIEW *nmt = ( NMTREEVIEW * )nmhdr;
HTREEITEM hItem = TreeView_GetSelection (nmhdr->hwndFrom);
char sz[ 256 ];
sprintf( sz, "tree view receiving notify %i : %s action %i old %p new %p selection %p\n", nmhdr->code, translatecode( nmhdr->code ),
nmt->action, nmt->itemOld, nmt->itemNew, hItem );
OutputDebugString( sz );
}
}
#endif
if (nmhdr->code == TVN_SELCHANGED)
//.........这里部分代码省略.........