Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 Problem with the paste menu
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Ivo
Senior Member

34 Posts

Posted - Feb 23 2006 :  2:12:01 PM  Show Profile  Reply with Quote
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

feline
Whole Tomato Software

United Kingdom
18952 Posts

Posted - Feb 23 2006 :  4:00:22 PM  Show Profile  Reply with Quote
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.

zen is the art of being at one with the two'ness
Go to Top of Page

Ivo
Senior Member

34 Posts

Posted - Feb 23 2006 :  4:17:07 PM  Show Profile  Reply with Quote
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.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18952 Posts

Posted - Feb 25 2006 :  4:28:03 PM  Show Profile  Reply with Quote
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.

zen is the art of being at one with the two'ness
Go to Top of Page

Ivo
Senior Member

34 Posts

Posted - Feb 25 2006 :  4:48:49 PM  Show Profile  Reply with Quote
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
Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Feb 26 2006 :  2:00:26 PM  Show Profile  Reply with Quote
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.
Go to Top of Page

Ivo
Senior Member

34 Posts

Posted - Feb 28 2006 :  01:26:11 AM  Show Profile  Reply with Quote
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... :)
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000