giuseppe500

hello.
Now i must work whith code.
I have a project to internozionalize and i get the string and place its in the string table .
I must get the string that not are c++ statement ,and for that i use the regexp.
The problem is ho to work whit code !
The string varue fin must be
1) inserted in the string table ok i have the function
2)get the value of id increment


3)replace the old string value with loadstring(id) how
there is find and replace must i use this


thancks



Re: Visual Studio Extensibility Addin work whith code and regexp

giuseppe500

I'm also wold to insert two or tree line of commented text for the old code but i not know how to work with code from an addin.
ther is a link




Re: Visual Studio Extensibility Addin work whith code and regexp

Carlos Quintero - MVP

You need to get a EnvDTE.Document, convert its .Object property to a EnvDTE.TextDocument, get a TextPoint from it and the call CreateEditPoint to get an EnvDTE.EditPoint and then use its methods to insert, delete or replace text.

See a related article:

http://www.mztools.com/articles/2006/MZ009.htm






Re: Visual Studio Extensibility Addin work whith code and regexp

giuseppe500

thanks.
how retrieve all' .cpp code files in the project from my addin
and for get a string with the source of the .cpp file

because i couldn't find the .selection members




Re: Visual Studio Extensibility Addin work whith code and regexp

Carlos Quintero - MVP

See:

HOWTO: Navigate the files of a solution from a Visual Studio .NET macro or add-in.

HOWTO: Navigate the code elements of a file from a Visual Studio .NET macro or add-in.

http://www.mztools.com/resources_vsnet_addins.htm






Re: Visual Studio Extensibility Addin work whith code and regexp

giuseppe500

thanks alot.
But insert a comment is possible
because it isn't in the FileCodeModel.
The problem is:
1)i have a line whith this code:
afxmessagebox("giuseppe"))
2)replace a text with afxmessagebox(::Loadstring("idxgiuseppe")) from the strng table
3)add a comment on the top with the old value of afxmessagebox:

///////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////
///// the old value is giuseppe
////



4 i can undo the action and delete the comments.




Re: Visual Studio Extensibility Addin work whith code and regexp

giuseppe500

5)what are the .selection members the addin return a com object and i dont'say the member for the point1,2,3,4 and 5!