oleview: Added copy HTML tag functionality.

This commit is contained in:
Piotr Caban 2006-06-22 20:00:11 +02:00 committed by Alexandre Julliard
parent 749e65cb37
commit 0defa4e807
2 changed files with 34 additions and 2 deletions

View File

@ -49,7 +49,7 @@ IDM_MENU MENU
MENUITEM "Create Instance &On", IDM_CREATEINSTON, GRAYED MENUITEM "Create Instance &On", IDM_CREATEINSTON, GRAYED
MENUITEM "&Release Instance", IDM_RELEASEINST, GRAYED MENUITEM "&Release Instance", IDM_RELEASEINST, GRAYED
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Copy &CLSID to clipboard", IDM_COPYCLSID, GRAYED MENUITEM "Copy C&LSID to clipboard", IDM_COPYCLSID, GRAYED
MENUITEM "Copy &HTML object Tag to clipboard", IDM_HTMLTAG, GRAYED MENUITEM "Copy &HTML object Tag to clipboard", IDM_HTMLTAG, GRAYED
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&View...", IDM_VIEW, GRAYED MENUITEM "&View...", IDM_VIEW, GRAYED

View File

@ -22,6 +22,9 @@
GLOBALS globals; GLOBALS globals;
static WCHAR wszRegEdit[] = { 'r','e','g','e','d','i','t','.','e','x','e','\0' }; static WCHAR wszRegEdit[] = { 'r','e','g','e','d','i','t','.','e','x','e','\0' };
static WCHAR wszFormat[] = { '<','o','b','j','e','c','t','\n',' ',' ',' ',
'c','l','a','s','s','i','d','=','\"','c','l','s','i','d',':','%','s','\"','\n',
'>','\n','<','/','o','b','j','e','c','t','>' };
INT_PTR CALLBACK CreateInstOnProc(HWND hDlgWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) INT_PTR CALLBACK CreateInstOnProc(HWND hDlgWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
@ -70,6 +73,31 @@ void CopyClsid(HTREEITEM item)
} }
} }
void CopyHTMLTag(HTREEITEM item)
{
TVITEM tvi;
memset(&tvi, 0, sizeof(TVITEM));
tvi.hItem = item;
tvi.cchTextMax = MAX_LOAD_STRING;
SendMessage(globals.hTree, TVM_GETITEM, 0, (LPARAM)&tvi);
if(OpenClipboard(globals.hMainWnd) && EmptyClipboard() && tvi.lParam)
{
HANDLE hClipData = GlobalAlloc(GHND, sizeof(WCHAR[MAX_LOAD_STRING]));
LPVOID pLoc = GlobalLock(hClipData);
int clsidLen = lstrlenW(((ITEM_INFO *)tvi.lParam)->clsid)-1;
((ITEM_INFO *)tvi.lParam)->clsid[clsidLen] = '\0';
wsprintfW(pLoc, wszFormat, ((ITEM_INFO *)tvi.lParam)->clsid+1);
((ITEM_INFO *)tvi.lParam)->clsid[clsidLen] = '}';
GlobalUnlock(hClipData);
hClipData = SetClipboardData(CF_UNICODETEXT, hClipData);
CloseClipboard();
}
}
void ResizeChild(void) void ResizeChild(void)
{ {
RECT client, stat, tool; RECT client, stat, tool;
@ -150,7 +178,7 @@ void RefreshMenu(HTREEITEM item)
EnableMenuItem(hMenu, IDM_VIEW, MF_GRAYED); EnableMenuItem(hMenu, IDM_VIEW, MF_GRAYED);
} }
parent = TreeView_GetParent(globals.hTree, item); parent = TreeView_GetParent(globals.hTree, item);
if(parent==tree.hAID || parent==tree.hGBCC) if(parent==tree.hAID || parent==tree.hGBCC || parent==tree.hTL)
EnableMenuItem(hMenu, IDM_COPYCLSID, MF_ENABLED); EnableMenuItem(hMenu, IDM_COPYCLSID, MF_ENABLED);
} }
@ -174,6 +202,10 @@ int MenuCommand(WPARAM wParam, HWND hWnd)
hSelect = TreeView_GetSelection(globals.hTree); hSelect = TreeView_GetSelection(globals.hTree);
CopyClsid(hSelect); CopyClsid(hSelect);
break; break;
case IDM_HTMLTAG:
hSelect = TreeView_GetSelection(globals.hTree);
CopyHTMLTag(hSelect);
break;
case IDM_CREATEINST: case IDM_CREATEINST:
hSelect = TreeView_GetSelection(globals.hTree); hSelect = TreeView_GetSelection(globals.hTree);
CreateInst(hSelect, NULL); CreateInst(hSelect, NULL);