Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Problem with the paste menu

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
Ivo Posted - Feb 23 2006 : 2:12:01 PM
Hi, I have a custom add-in for VS 2003 using that DTE automation. It issues "Edit.Copy" and "Edit.Cut" commands with the following code:


	CComPtr<EnvDTE::Commands> pCommands;
	m_pDTE->get_Commands(&pCommands);
	VARIANT str;
	memset(&str,0,sizeof(str));
	str.vt=VT_BSTR;
	str.bstrVal=_com_util::ConvertStringToBSTR("Edit.Copy");
	CComPtr<Command> cmd;
	HRESULT r=pCommands->Item(str,0,&cmd);
	SysFreeString(str.bstrVal);
	if (r==S_OK) {
		BSTR guid;
		cmd->get_Guid(&guid);
		long id;
		cmd->get_ID(&id);
		VARIANT vin,vout;
		memset(&vin,0,sizeof(vin));
		memset(&vout,0,sizeof(vout));
		pCommands->Raise(guid,id,&vin,&vout);
		SysFreeString(guid);
	}


The problem is that the text being copied is not added to the Ctrl+Shift+V paste menu. What am I doing wrong? Note: It is added to the native Ctrl+Shift+V clipboard ring, just doesn't work with Visual Assist's replacement.

Can someone help?

Thanks
Ivo
6   L A T E S T    R E P L I E S    (Newest First)
Ivo Posted - Feb 28 2006 : 01:26:11 AM
Well, Craig Skibo from the VS team suggested a much simple solution:
m_pDTE->ExecuteCommand(CComBSTR("Edit.Copy"),CComBSTR(""));
The new code works much better with Visual Assist. Serves me right for not reading the MSDN first... :)
support Posted - Feb 26 2006 : 2:00:26 PM
VA X is intercepting the copy before Edit.Copy is run. Unfortunately, you can't prod VA X into adding code to its clipboard ring.
Ivo Posted - Feb 25 2006 : 4:48:49 PM
Thanks for the reply. I don't know how to access the edit menu and trigger a command from it, at least not in a documented and robust way. The menus are user-editable and the command may not even be there.
I posted a question to the MSDN extensibility forum. Hopefully they'll tell me there is a better way of executing an IDE command than the way I'm doing it. BTW, here's the full source of my addin: http://www.codeproject.com/macro/VSHelper.asp
feline Posted - Feb 25 2006 : 4:28:03 PM
i am somewhat out of my area here, but is it possible to trigger the edit menu followed by the copy command from your addin? a bit more long winded, but if this both works and is correctly picked up by VA then perhaps you can move forward from here in stages.
Ivo Posted - Feb 23 2006 : 4:17:07 PM
No, my addin doesn't do anything to intercept the copy/cut events (intentionally :)). The code above is executed from another command (Ctrl+Shift+C). If I use the regular Ctrl+C and Ctrl+X the text goes to VA, no problem. I'm trying to invoke the regular Edit.Copy from my addin, and I want VA to add the text to the paste menu, just like when I invoke the command with a Ctrl+C shortcut.
feline Posted - Feb 23 2006 : 4:00:22 PM
at a wild guess the copy and cut events are going to your addin, and VA does not know about them. i will ask support about this, since there is nothing i can personally suggest.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000