473,396 Members | 1,886 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

VC++ Closing Macro Window/Prompt Problem

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
5 3637
Niheel
2,460 Expert Mod 2GB
So the problem you are having is not executing the find and replace but closing the window/prompt?
Nov 15 '05 #2
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
Niheel
2,460 Expert Mod 2GB
[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
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
Niheel
2,460 Expert Mod 2GB
Thanks for posting, keep us in mind if you have any more programming or software related questions.
Nov 16 '05 #6

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

Similar topics

8
by: Arun Seetharam | last post by:
Dear Folks, The application I am working on uses Frames (TopFrame, SideFrame(Left) and the MainFrame). On the occurance of a certain event, I am closing the window from one of the frames. This...
5
by: Lance | last post by:
Hi, Can anyone point me in the right direction for using C# to close an alertbox for the admin user? Background: We have some servers (NT4) that are running some services that throw an...
4
by: Daniel Walzenbach | last post by:
Hi, does anybody know the JavaScript the guys at Microsoft used in MS CRM to prevent people from closing a browser window and asking them (on the client) what they really want to do? If you...
1
by: Audrey | last post by:
Hi Need some advice here.. I have a frame with a hyperlink to logout from the site When the Logout link (on the left frame) is clicked, a page stating "You've logged out. Please login again" is...
0
by: Mythran | last post by:
I have a class which inherits Form and would like it to display modally from a macro. I want it to stay in front of the .Net IDE until the user presses Ok and would like the IDE to be locked from...
6
by: Giojo | last post by:
Hello guys! I can't resolve this problem.. I want my programm in c# working with only console if there are some parameters, but if someone make double-click on the exe I want to start the graphic...
10
by: Tony | last post by:
I need to know how to open a pop up and close the main window without a prompt in Firefox 2 and IE 7. Anybody have any ideas on how to do that. I currently have this and it works in IE 6 and...
3
by: guest | last post by:
I have a problem, I have Javascript that opens a popup. I want to avoide the user from closing the parent window first. I dont want to use showDialog, I want to use window.open() only.. Is there any...
3
MMcCarthy
by: MMcCarthy | last post by:
Although some users find Macros simple and easy to use, there are some major limitations to using them. Although you can use macros to perform tasks, there is limited control on when and how those...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.