By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,486 Members | 1,716 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,486 IT Pros & Developers. It's quick & easy.

VC++ Closing Macro Window/Prompt Problem

P: 3
Hello, all! I'm creating a macro for help with some c/c++ projects, and within it, I'm trying to execute Find/Replace. Actually, it's executing fine. It's closing the prompt that I'm having a problem with. Here's a snipet of the code:

DTE.ItemOperations.OpenFile(path + sFile)
ActiveDocument.Selection.StartOfDocument()
DTE.ExecuteCommand("Edit.Find")
DTE.Windows.Item(sFile).Activate()
DTE.Find.FindWhat = functName
DTE.Find.Target = vsFindTarget.vsFindTargetCurrentDocument
DTE.Find.MatchCase = True
DTE.Find.MatchWholeWord = True
DTE.Find.Backwards = False
DTE.Find.MatchInHiddenText = False
DTE.Find.PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxLiteral
DTE.Find.Action = vsFindAction.vsFindActionFind
DTE.Find.Execute()
DTE.Windows.Item(Constants.vsWindowKindFindReplace).Close()

The debugger tells me that Constants is ambiguous, and it will not let me execute the macro. If I simply remove the Constants, the Find/Replace will execute, but of course, the prompt will not close because the parameter is incorrect. I'm running VS 2003. Has anyone else had this problem, and if so, is there a way to correct it? Thanks!
Nov 15 '05 #1
Share this Question
Share on Google+
5 Replies


Expert Mod 100+
P: 2,328
So the problem you are having is not executing the find and replace but closing the window/prompt?
Nov 15 '05 #2

P: 3
Yes, exactly! I have checked several sources, and everyone seems to have used the exact same code that I have. I even tried recording a macro from C++.NET, and that's exactly what it told me to use. The exact message that I get about the Constants identifier is:

'Constants' is ambiguous, imported from the namespaces or types 'Microsoft.VisualBasic, EnvDTE'.

It will not let me execute the macro until I remove the word. If I remove it, the Find/Replace will execute and find the correct word, but the popup will not close. I then get a message stating the the parameter is not correct.

Thanks in advance for any help!
Nov 15 '05 #3

Expert Mod 100+
P: 2,328
[font=Arial]http://msdn2.microsoft.com/en-us/lib...US,VS.80).aspx[/font]

from what i read, seems that you are probably using a name that is being used elsewhere, maybe change it to something else?

I don't have much VS experience, but that is the exact error messageyou are getting.

Please let me know if this helps.
Nov 15 '05 #4

P: 3
Great! It works now that I've fully qualified the name. I've very new to VB, and I appreciate the help!
Nov 16 '05 #5

Expert Mod 100+
P: 2,328
Thanks for posting, keep us in mind if you have any more programming or software related questions.
Nov 16 '05 #6

Post your reply

Sign in to post your reply or Sign up for a free account.