oleview: Replace some SendMessage wrappers with the real thing.

This commit is contained in:
Michael Stefaniuc 2010-05-07 10:45:29 +02:00 committed by Alexandre Julliard
parent 55e4eba2ec
commit 5005581c8b
5 changed files with 78 additions and 40 deletions

View File

@ -295,7 +295,7 @@ void RefreshDetails(HTREEITEM item)
if(tvi.lParam && ((ITEM_INFO *)tvi.lParam)->cFlag & SHOWALL) if(tvi.lParam && ((ITEM_INFO *)tvi.lParam)->cFlag & SHOWALL)
{ {
if(TabCtrl_GetItemCount(details.hTab) == 1) if(SendMessageW(details.hTab, TCM_GETITEMCOUNT, 0, 0) == 1)
{ {
TCITEM tci; TCITEM tci;
memset(&tci, 0, sizeof(TCITEM)); memset(&tci, 0, sizeof(TCITEM));
@ -377,7 +377,7 @@ static LRESULT CALLBACK DetailsProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
{ {
case TCN_SELCHANGE: case TCN_SELCHANGE:
ShowWindow(details.hReg, SW_HIDE); ShowWindow(details.hReg, SW_HIDE);
sel = TabCtrl_GetCurSel(details.hTab); sel = SendMessageW(details.hTab, TCM_GETCURSEL, 0, 0);
if(sel==0) ShowWindow(details.hReg, SW_SHOW); if(sel==0) ShowWindow(details.hReg, SW_SHOW);
break; break;

View File

@ -47,7 +47,8 @@ static IUnknown *GetInterface(void)
CLSID clsid; CLSID clsid;
IUnknown *unk; IUnknown *unk;
hSelect = TreeView_GetSelection(globals.hTree); hSelect = (HTREEITEM)SendMessageW(globals.hTree, TVM_GETNEXTITEM,
TVGN_CARET, 0);
memset(&tvi, 0, sizeof(TVITEM)); memset(&tvi, 0, sizeof(TVITEM));
tvi.hItem = hSelect; tvi.hItem = hSelect;
@ -55,7 +56,8 @@ static IUnknown *GetInterface(void)
CLSIDFromString(((ITEM_INFO *)tvi.lParam)->clsid, &clsid); CLSIDFromString(((ITEM_INFO *)tvi.lParam)->clsid, &clsid);
memset(&tvi, 0, sizeof(TVITEM)); memset(&tvi, 0, sizeof(TVITEM));
tvi.hItem = TreeView_GetParent(globals.hTree, hSelect); tvi.hItem = (HTREEITEM)SendMessageW(globals.hTree, TVM_GETNEXTITEM,
TVGN_PARENT, (LPARAM)hSelect);
SendMessage(globals.hTree, TVM_GETITEM, 0, (LPARAM)&tvi); SendMessage(globals.hTree, TVM_GETITEM, 0, (LPARAM)&tvi);
IUnknown_QueryInterface(((ITEM_INFO *)tvi.lParam)->pU, &clsid, (void *)&unk); IUnknown_QueryInterface(((ITEM_INFO *)tvi.lParam)->pU, &clsid, (void *)&unk);
@ -179,7 +181,8 @@ void InterfaceViewer(HTREEITEM item)
memset(&tvi, 0, sizeof(TVITEM)); memset(&tvi, 0, sizeof(TVITEM));
tvi.mask = TVIF_TEXT; tvi.mask = TVIF_TEXT;
tvi.hItem = TreeView_GetParent(globals.hTree, item); tvi.hItem = (HTREEITEM)SendMessageW(globals.hTree, TVM_GETNEXTITEM,
TVGN_PARENT, (LPARAM)item);
tvi.cchTextMax = MAX_LOAD_STRING; tvi.cchTextMax = MAX_LOAD_STRING;
tvi.pszText = wszParent; tvi.pszText = wszParent;

View File

@ -219,7 +219,8 @@ void RefreshMenu(HTREEITEM item)
tvi.hItem = item; tvi.hItem = item;
SendMessage(globals.hTree, TVM_GETITEM, 0, (LPARAM)&tvi); SendMessage(globals.hTree, TVM_GETITEM, 0, (LPARAM)&tvi);
parent = TreeView_GetParent(globals.hTree, item); parent = (HTREEITEM)SendMessageW(globals.hTree, TVM_GETNEXTITEM,
TVGN_PARENT, (LPARAM)item);
SendMessage(globals.hToolBar, TB_ENABLEBUTTON, IDM_CREATEINST, FALSE); SendMessage(globals.hToolBar, TB_ENABLEBUTTON, IDM_CREATEINST, FALSE);
SendMessage(globals.hToolBar, TB_ENABLEBUTTON, IDM_RELEASEINST, FALSE); SendMessage(globals.hToolBar, TB_ENABLEBUTTON, IDM_RELEASEINST, FALSE);
@ -290,27 +291,32 @@ static int MenuCommand(WPARAM wParam, HWND hWnd)
ShellAbout(hWnd, wszAbout, wszAboutVer, NULL); ShellAbout(hWnd, wszAbout, wszAboutVer, NULL);
break; break;
case IDM_COPYCLSID: case IDM_COPYCLSID:
hSelect = TreeView_GetSelection(globals.hTree); hSelect = (HTREEITEM)SendMessageW(globals.hTree,
TVM_GETNEXTITEM, TVGN_CARET, 0);
CopyClsid(hSelect); CopyClsid(hSelect);
break; break;
case IDM_HTMLTAG: case IDM_HTMLTAG:
hSelect = TreeView_GetSelection(globals.hTree); hSelect = (HTREEITEM)SendMessageW(globals.hTree,
TVM_GETNEXTITEM, TVGN_CARET, 0);
CopyHTMLTag(hSelect); CopyHTMLTag(hSelect);
break; break;
case IDM_CREATEINST: case IDM_CREATEINST:
hSelect = TreeView_GetSelection(globals.hTree); hSelect = (HTREEITEM)SendMessageW(globals.hTree,
TVM_GETNEXTITEM, TVGN_CARET, 0);
CreateInst(hSelect, NULL); CreateInst(hSelect, NULL);
SendMessage(globals.hTree, TVM_EXPAND, TVE_EXPAND, (LPARAM)hSelect); SendMessage(globals.hTree, TVM_EXPAND, TVE_EXPAND, (LPARAM)hSelect);
break; break;
case IDM_CREATEINSTON: case IDM_CREATEINSTON:
if(DialogBox(0, MAKEINTRESOURCE(DLG_CREATEINSTON), if(DialogBox(0, MAKEINTRESOURCE(DLG_CREATEINSTON),
hWnd, CreateInstOnProc) == IDCANCEL) break; hWnd, CreateInstOnProc) == IDCANCEL) break;
hSelect = TreeView_GetSelection(globals.hTree); hSelect = (HTREEITEM)SendMessageW(globals.hTree,
TVM_GETNEXTITEM, TVGN_CARET, 0);
CreateInst(hSelect, globals.wszMachineName); CreateInst(hSelect, globals.wszMachineName);
SendMessage(globals.hTree, TVM_EXPAND, TVE_EXPAND, (LPARAM)hSelect); SendMessage(globals.hTree, TVM_EXPAND, TVE_EXPAND, (LPARAM)hSelect);
break; break;
case IDM_RELEASEINST: case IDM_RELEASEINST:
hSelect = TreeView_GetSelection(globals.hTree); hSelect = (HTREEITEM)SendMessageW(globals.hTree,
TVM_GETNEXTITEM, TVGN_CARET, 0);
ReleaseInst(hSelect); ReleaseInst(hSelect);
RefreshMenu(hSelect); RefreshMenu(hSelect);
RefreshDetails(hSelect); RefreshDetails(hSelect);
@ -322,7 +328,8 @@ static int MenuCommand(WPARAM wParam, HWND hWnd)
EmptyTree(); EmptyTree();
if(globals.bExpert) AddTreeEx(); if(globals.bExpert) AddTreeEx();
else AddTree(); else AddTree();
hSelect = TreeView_GetChild(globals.hTree, TVI_ROOT); hSelect = (HTREEITEM)SendMessageW(globals.hTree,
TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)TVI_ROOT);
SendMessage(globals.hTree, TVM_SELECTITEM, 0, (LPARAM)hSelect); SendMessage(globals.hTree, TVM_SELECTITEM, 0, (LPARAM)hSelect);
RefreshMenu(hSelect); RefreshMenu(hSelect);
break; break;
@ -362,7 +369,8 @@ static int MenuCommand(WPARAM wParam, HWND hWnd)
EmptyTree(); EmptyTree();
if(globals.bExpert) AddTreeEx(); if(globals.bExpert) AddTreeEx();
else AddTree(); else AddTree();
hSelect = TreeView_GetChild(globals.hTree, TVI_ROOT); hSelect = (HTREEITEM)SendMessageW(globals.hTree,
TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)TVI_ROOT);
SendMessage(globals.hTree, TVM_SELECTITEM, 0, (LPARAM)hSelect); SendMessage(globals.hTree, TVM_SELECTITEM, 0, (LPARAM)hSelect);
RefreshMenu(hSelect); RefreshMenu(hSelect);
break; break;
@ -414,7 +422,8 @@ static int MenuCommand(WPARAM wParam, HWND hWnd)
break; break;
} }
case IDM_VIEW: case IDM_VIEW:
hSelect = TreeView_GetSelection(globals.hTree); hSelect = (HTREEITEM)SendMessageW(globals.hTree,
TVM_GETNEXTITEM, TVGN_CARET, 0);
if(IsInterface(hSelect)) InterfaceViewer(hSelect); if(IsInterface(hSelect)) InterfaceViewer(hSelect);
else CreateTypeLibWindow(globals.hMainInst, NULL); else CreateTypeLibWindow(globals.hMainInst, NULL);
break; break;

View File

@ -148,7 +148,8 @@ void CreateInst(HTREEITEM item, WCHAR *wszMachineName)
SendMessage(globals.hTree, TVM_SETITEM, 0, (LPARAM)&tvi); SendMessage(globals.hTree, TVM_SETITEM, 0, (LPARAM)&tvi);
tvi.mask = TVIF_TEXT; tvi.mask = TVIF_TEXT;
hCur = TreeView_GetChild(globals.hTree, tree.hI); hCur = (HTREEITEM)SendMessageW(globals.hTree, TVM_GETNEXTITEM,
TVGN_CHILD, (LPARAM)tree.hI);
while(hCur) while(hCur)
{ {
@ -157,7 +158,8 @@ void CreateInst(HTREEITEM item, WCHAR *wszMachineName)
if(!tvi.lParam) if(!tvi.lParam)
{ {
hCur = TreeView_GetNextSibling(globals.hTree, hCur); hCur = (HTREEITEM)SendMessageW(globals.hTree, TVM_GETNEXTITEM,
TVGN_NEXT, (LPARAM)hCur);
continue; continue;
} }
@ -174,7 +176,8 @@ void CreateInst(HTREEITEM item, WCHAR *wszMachineName)
wszRegPath, ((ITEM_INFO *)tvi.lParam)->clsid, NULL); wszRegPath, ((ITEM_INFO *)tvi.lParam)->clsid, NULL);
SendMessage(globals.hTree, TVM_INSERTITEM, 0, (LPARAM)&tvis); SendMessage(globals.hTree, TVM_INSERTITEM, 0, (LPARAM)&tvis);
} }
hCur = TreeView_GetNextSibling(globals.hTree, hCur); hCur = (HTREEITEM)SendMessageW(globals.hTree, TVM_GETNEXTITEM,
TVGN_NEXT, (LPARAM)hCur);
} }
RefreshMenu(item); RefreshMenu(item);
@ -200,11 +203,13 @@ void ReleaseInst(HTREEITEM item)
SendMessage(globals.hTree, TVM_EXPAND, TVE_COLLAPSE, (LPARAM)item); SendMessage(globals.hTree, TVM_EXPAND, TVE_COLLAPSE, (LPARAM)item);
cur = TreeView_GetChild(globals.hTree, item); cur = (HTREEITEM)SendMessageW(globals.hTree, TVM_GETNEXTITEM,
TVGN_CHILD, (LPARAM)item);
while(cur) while(cur)
{ {
SendMessage(globals.hTree, TVM_DELETEITEM, 0, (LPARAM)cur); SendMessage(globals.hTree, TVM_DELETEITEM, 0, (LPARAM)cur);
cur = TreeView_GetChild(globals.hTree, item); cur = (HTREEITEM)SendMessageW(globals.hTree, TVM_GETNEXTITEM,
TVGN_CHILD, (LPARAM)item);
} }
tvi.mask = TVIF_CHILDREN|TVIF_STATE; tvi.mask = TVIF_CHILDREN|TVIF_STATE;
@ -242,7 +247,8 @@ BOOL CreateRegPath(HTREEITEM item, WCHAR *buffer, int bufSize)
if(!tvi.lParam) return FALSE; if(!tvi.lParam) return FALSE;
tvi.hItem = TreeView_GetParent(globals.hTree, tvi.hItem); tvi.hItem = (HTREEITEM)SendMessageW(globals.hTree, TVM_GETNEXTITEM,
TVGN_PARENT, (LPARAM)tvi.hItem);
} }
return ret; return ret;
} }
@ -304,8 +310,10 @@ static void AddCOMandAll(void)
RegCloseKey(hInfo); RegCloseKey(hInfo);
if(tree.hGBCC) curSearch = TreeView_GetChild(globals.hTree, tree.hGBCC); if(tree.hGBCC) curSearch = (HTREEITEM)SendMessageW(globals.hTree,
else curSearch = TreeView_GetChild(globals.hTree, TVI_ROOT); TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)tree.hGBCC);
else curSearch = (HTREEITEM)SendMessageW(globals.hTree,
TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)TVI_ROOT);
while(curSearch) while(curSearch)
{ {
@ -324,7 +332,8 @@ static void AddCOMandAll(void)
SendMessage(globals.hTree, TVM_INSERTITEM, 0, (LPARAM)&tvis); SendMessage(globals.hTree, TVM_INSERTITEM, 0, (LPARAM)&tvis);
break; break;
} }
curSearch = TreeView_GetNextSibling(globals.hTree, curSearch); curSearch = (HTREEITEM)SendMessageW(globals.hTree,
TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)curSearch);
} }
} }
RegCloseKey(hCurKey); RegCloseKey(hCurKey);
@ -600,18 +609,23 @@ void EmptyTree(void)
TVITEM tvi; TVITEM tvi;
tvi.mask = TVIF_PARAM; tvi.mask = TVIF_PARAM;
cur = TreeView_GetChild(globals.hTree, TVI_ROOT); cur = (HTREEITEM)SendMessageW(globals.hTree, TVM_GETNEXTITEM,
TVGN_CHILD, (LPARAM)TVI_ROOT);
while(TRUE) while(TRUE)
{ {
del = cur; del = cur;
cur = TreeView_GetChild(globals.hTree, del); cur = (HTREEITEM)SendMessageW(globals.hTree, TVM_GETNEXTITEM,
TVGN_CHILD, (LPARAM)del);
if(!cur) cur = TreeView_GetNextSibling(globals.hTree, del); if(!cur) cur = (HTREEITEM)SendMessageW(globals.hTree,
TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)del);
if(!cur) if(!cur)
{ {
cur = TreeView_GetPrevSibling(globals.hTree, del); cur = (HTREEITEM)SendMessageW(globals.hTree, TVM_GETNEXTITEM,
if(!cur) cur = TreeView_GetParent(globals.hTree, del); TVGN_PREVIOUS, (LPARAM)del);
if(!cur) cur = (HTREEITEM)SendMessageW(globals.hTree,
TVM_GETNEXTITEM, TVGN_PARENT, (LPARAM)del);
tvi.hItem = del; tvi.hItem = del;
SendMessage(globals.hTree, TVM_GETITEM, 0, (LPARAM)&tvi); SendMessage(globals.hTree, TVM_GETITEM, 0, (LPARAM)&tvi);

View File

@ -122,7 +122,8 @@ static void SaveIdl(WCHAR *wszFileName)
char *wszIdl; char *wszIdl;
TYPELIB_DATA *data; TYPELIB_DATA *data;
hIDL = TreeView_GetChild(typelib.hTree, TVI_ROOT); hIDL = (HTREEITEM)SendMessageW(typelib.hTree, TVM_GETNEXTITEM,
TVGN_CHILD, (LPARAM)TVI_ROOT);
memset(&tvi, 0, sizeof(TVITEM)); memset(&tvi, 0, sizeof(TVITEM));
tvi.hItem = hIDL; tvi.hItem = hIDL;
@ -280,7 +281,8 @@ static void AddChildrenData(HTREEITEM hParent, TYPELIB_DATA *pData)
memset(&tvi, 0, sizeof(tvi)); memset(&tvi, 0, sizeof(tvi));
hCur = TreeView_GetChild(typelib.hTree, hParent); hCur = (HTREEITEM)SendMessageW(typelib.hTree, TVM_GETNEXTITEM,
TVGN_CHILD, (LPARAM)hParent);
if(!hCur) return; if(!hCur) return;
do do
@ -289,7 +291,8 @@ static void AddChildrenData(HTREEITEM hParent, TYPELIB_DATA *pData)
SendMessage(typelib.hTree, TVM_GETITEM, 0, (LPARAM)&tvi); SendMessage(typelib.hTree, TVM_GETITEM, 0, (LPARAM)&tvi);
if(tvi.lParam && ((TYPELIB_DATA *)(tvi.lParam))->idlLen) if(tvi.lParam && ((TYPELIB_DATA *)(tvi.lParam))->idlLen)
AddToTLDataStrWithTabsW(pData, ((TYPELIB_DATA *)(tvi.lParam))->idl); AddToTLDataStrWithTabsW(pData, ((TYPELIB_DATA *)(tvi.lParam))->idl);
}while((hCur = TreeView_GetNextSibling(typelib.hTree, hCur))); } while((hCur = (HTREEITEM)SendMessageW(typelib.hTree, TVM_GETNEXTITEM,
TVGN_NEXT, (LPARAM)hCur)));
} }
static void CreateTypeInfo(WCHAR *wszAddTo, WCHAR *wszAddAfter, TYPEDESC tdesc, ITypeInfo *pTypeInfo) static void CreateTypeInfo(WCHAR *wszAddTo, WCHAR *wszAddAfter, TYPEDESC tdesc, ITypeInfo *pTypeInfo)
@ -857,7 +860,8 @@ static void AddIdlData(HTREEITEM hCur, TYPELIB_DATA *pTLData)
{ {
TVITEM tvi; TVITEM tvi;
hCur = TreeView_GetChild(typelib.hTree, hCur); hCur = (HTREEITEM)SendMessageW(typelib.hTree, TVM_GETNEXTITEM,
TVGN_CHILD, (LPARAM)hCur);
memset(&tvi, 0, sizeof(TVITEM)); memset(&tvi, 0, sizeof(TVITEM));
tvi.mask = TVIF_PARAM; tvi.mask = TVIF_PARAM;
@ -869,7 +873,8 @@ static void AddIdlData(HTREEITEM hCur, TYPELIB_DATA *pTLData)
AddToTLDataStrW(pTLData, wszNewLine); AddToTLDataStrW(pTLData, wszNewLine);
AddToTLDataStrWithTabsW(pTLData, ((TYPELIB_DATA*)(tvi.lParam))->idl); AddToTLDataStrWithTabsW(pTLData, ((TYPELIB_DATA*)(tvi.lParam))->idl);
} }
hCur = TreeView_GetNextSibling(typelib.hTree, hCur); hCur = (HTREEITEM)SendMessageW(typelib.hTree, TVM_GETNEXTITEM,
TVGN_NEXT, (LPARAM)hCur);
} }
} }
@ -883,7 +888,8 @@ static void AddPredefinitions(HTREEITEM hFirst, TYPELIB_DATA *pTLData)
'a','l','l',' ','t','y','p','e','s',' ','d','e','f','i','n','e','d',' ', 'a','l','l',' ','t','y','p','e','s',' ','d','e','f','i','n','e','d',' ',
'i','n',' ','t','h','i','s',' ','t','y','p','e','l','i','b','\0' }; 'i','n',' ','t','h','i','s',' ','t','y','p','e','l','i','b','\0' };
hFirst = TreeView_GetChild(typelib.hTree, hFirst); hFirst = (HTREEITEM)SendMessageW(typelib.hTree, TVM_GETNEXTITEM,
TVGN_CHILD, (LPARAM)hFirst);
AddToTLDataStrWithTabsW(pTLData, wszPredefinition); AddToTLDataStrWithTabsW(pTLData, wszPredefinition);
AddToTLDataStrW(pTLData, wszNewLine); AddToTLDataStrW(pTLData, wszNewLine);
@ -904,7 +910,8 @@ static void AddPredefinitions(HTREEITEM hFirst, TYPELIB_DATA *pTLData)
AddToTLDataStrWithTabsW(pTLData, wszText); AddToTLDataStrWithTabsW(pTLData, wszText);
AddToTLDataStrW(pTLData, wszNewLine); AddToTLDataStrW(pTLData, wszNewLine);
} }
hCur = TreeView_GetNextSibling(typelib.hTree, hCur); hCur = (HTREEITEM)SendMessageW(typelib.hTree, TVM_GETNEXTITEM,
TVGN_NEXT, (LPARAM)hCur);
} }
} }
@ -1527,15 +1534,19 @@ static void EmptyTLTree(void)
TVITEM tvi; TVITEM tvi;
tvi.mask = TVIF_PARAM; tvi.mask = TVIF_PARAM;
cur = TreeView_GetChild(typelib.hTree, TVI_ROOT); cur = (HTREEITEM)SendMessageW(typelib.hTree, TVM_GETNEXTITEM,
TVGN_CHILD, (LPARAM)TVI_ROOT);
while(TRUE) while(TRUE)
{ {
del = cur; del = cur;
cur = TreeView_GetChild(typelib.hTree, del); cur = (HTREEITEM)SendMessageW(typelib.hTree, TVM_GETNEXTITEM,
TVGN_CHILD, (LPARAM)del);
if(!cur) cur = TreeView_GetNextSibling(typelib.hTree, del); if(!cur) cur = (HTREEITEM)SendMessageW(typelib.hTree,
if(!cur) cur = TreeView_GetParent(typelib.hTree, del); TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)del);
if(!cur) cur = (HTREEITEM)SendMessageW(typelib.hTree,
TVM_GETNEXTITEM, TVGN_PARENT, (LPARAM)del);
tvi.hItem = del; tvi.hItem = del;
SendMessage(typelib.hTree, TVM_GETITEM, 0, (LPARAM)&tvi); SendMessage(typelib.hTree, TVM_GETITEM, 0, (LPARAM)&tvi);
@ -1622,7 +1633,8 @@ BOOL CreateTypeLibWindow(HINSTANCE hInst, WCHAR *wszFileName)
TVITEM tvi; TVITEM tvi;
memset(&tvi, 0, sizeof(TVITEM)); memset(&tvi, 0, sizeof(TVITEM));
tvi.hItem = TreeView_GetSelection(globals.hTree); tvi.hItem = (HTREEITEM)SendMessageW(globals.hTree, TVM_GETNEXTITEM,
TVGN_CARET, 0);
SendMessage(globals.hTree, TVM_GETITEM, 0, (LPARAM)&tvi); SendMessage(globals.hTree, TVM_GETITEM, 0, (LPARAM)&tvi);
lstrcpyW(typelib.wszFileName, ((ITEM_INFO*)tvi.lParam)->path); lstrcpyW(typelib.wszFileName, ((ITEM_INFO*)tvi.lParam)->path);