Visual Studio preprocessor macro

Hi,

I have code which is required to compile both on VS2002 as well as
VS2005. For this I am using the following approach,

#ifdef _VS2005_
   <code>...</code>
#else
   <code>...</code>
#endif

Is there any predefined visual studio macro which can help me identify
the IDE version, instead of me having to define a custom macro like
_VS2005_.

Thanks.

0
11/23/2006 8:02:49 AM
vc.mfc 33608 articles. 0 followers. Follow

4 Replies
299 Views

Similar Articles

[PageSpeed] 40

Aviraj wrote:
> Hi,
>
> I have code which is required to compile both on VS2002 as well as
> VS2005. For this I am using the following approach,
>
> #ifdef _VS2005_
>    <code>...</code>
> #else
>    <code>...</code>
> #endif
>
> Is there any predefined visual studio macro which can help me identify
> the IDE version, instead of me having to define a custom macro like
> _VS2005_.
>
> Thanks.

um, good question. I expect the answer too.
And hopelly that anybody can tell me or show something about the
difference between these Visual Studio IDEs.

0
Hooyoo
11/23/2006 9:05:19 AM
Hi,

See _MSC_VER macro in the MSDN.
Particularly, 1310 means VC2003, and 1400 means VC2005.


-- 
======
Arman


"Aviraj" wrote:

> Hi,
> 
> I have code which is required to compile both on VS2002 as well as
> VS2005. For this I am using the following approach,
> 
> #ifdef _VS2005_
>    <code>...</code>
> #else
>    <code>...</code>
> #endif
> 
> Is there any predefined visual studio macro which can help me identify
> the IDE version, instead of me having to define a custom macro like
> _VS2005_.
> 
> Thanks.
> 
> 
0
armancho_x1 (249)
11/23/2006 11:04:02 AM
Hi,

See _MSC_VER in the MSDN.
Particularly, 1310 means VS2003, and 1400 means VS2005.


-- 
======
Arman


"Hooyoo" wrote:

> 
> Aviraj wrote:
> > Hi,
> >
> > I have code which is required to compile both on VS2002 as well as
> > VS2005. For this I am using the following approach,
> >
> > #ifdef _VS2005_
> >    <code>...</code>
> > #else
> >    <code>...</code>
> > #endif
> >
> > Is there any predefined visual studio macro which can help me identify
> > the IDE version, instead of me having to define a custom macro like
> > _VS2005_.
> >
> > Thanks.
> 
> um, good question. I expect the answer too.
> And hopelly that anybody can tell me or show something about the
> difference between these Visual Studio IDEs.
> 
> 
0
armancho_x1 (249)
11/23/2006 11:12:01 AM
Hi Arman,

Thanks for the answer. It was just what I was looking for.

regards,
Aviraj

0
11/24/2006 5:11:05 AM
Reply:

Similar Artilces:

Problem using GO TO function in a macro on a large workbook.
Using Excel 97 on Windows XP. (This workbook was originally created in Excel 4.0.) I use a large excel workbook to do construction estimating. The WB consists of a main sheet that contains BUTTONS that were created and assigned to macros on a master macro sheet in the WB. The buttons take you to the specific section of another worksheet that contains the cells that return the total on the row corresponding to the button. Those sections are NAMED RANGES. The macro consists simply of: =FORMULA.GOTO(Sheet & Named Range) =SELECT ("RC3") The NAMED RANGES are created by going IN...

XP Visual Styles #2
Hi, I need to create buttons and other UI controls with XP visual styles ( the 3d views ). Found this on msdn site: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwxp/html/xptheming.asp Followed the steps mentioned for "Using ComCtl32.dll Version 6 in an Application That Does Not Use Third-Party Extensions". But even after following the mentioned steps, it does not work. Please point out the missing part in the documentation. Thanks, Pradeep I couldn't tell from your question whether you are creating new kinds of buttons or just want to use buttons and h...

Visual studio 2008
Hi guys, Ive just made the switch from vb to c# ... And in visual studio code behind on a asp page im not getting the drop down of page controls in the top left down down list ... How comes? Lee //"How comes?"// Do you mean "Why?" I think you mean .aspx page. I know its nit picky....but aspx is not asp just like vb.net is not vb. ................. Besides those 2 issues: I see a list of components in my web application. Did you use: File / New / Website or File / New / Project / Web / "ASP.NET Web Application" Try...

A way to detect macros? (not document macros)
We're writing an application that will be particularly vulnerable to attacks by macro programs (you know those apps that open up your app and type in text, etc..) Is there a way to detect their behaviour and perhaps block them? Thanks, Roger Short answer: No. Make sure you have good security, good AV, good anti spyware s/w and do not run with privilege. There are so many ways for such macros / spyware apps to operate that to attempt block them is an exercise in futility. The types of things that can happen include WM_SETTEXT / WM_GETTEXT (WM's in general) calls across processes, ...

Macro Protection #2
Hi I have a protected spreadsheet but can still get in to edit the Macros used. How do I stop this? Cheers Brian In VBA Tools ->VBA Project Properties and then the "Protection" Tab ...

Macro info please
We have our price lists in worksheets - and every so often we need to adjust the prices - the prices are in columns within the worksheet, but in different columns within the same worksheet. Is there an easy way to adjust these prices (either up or down (!)) by running a macro ? My thanks in anticipation. If it is a uniform increase/decrease, you can enter the multiplier in a cell, then copy it to the clipboard. Then select all the target cells, and Edit>PasteSpecial>Multiply. Clear the multiplier and you are done. -- --- HTH Bob (there's no email, no snail mail, but some...

Macros and Active X
My ctrl+c and ctrl+v shortcuts dont work unless I turn on my active forms bar to edit mode. Any guesses why -- Message posted from http://www.ExcelForum.com Because the spreadhseet is "live". You have to go into edit mode t make any changes to control toolbox items. -- Message posted from http://www.ExcelForum.com I'm not trying to edit my active x forms, The problems is that th standard ctrl+c and ctrl+v copy and paste short cuts wont work unles the active x edit mode is turned on. I don't have to turn on the active x edit mode to use these short cut in other wo...

macro for Tab colour change
This is what i have but the problem is when i type something in cell the Tab changes colour this is good & when i clear cell i want Tab to go back to its original colour is this possible Private Sub Workbook_SheetChange(ByVal Sh As Object, _ ByVal Target As Range) If Intersect(Target, Range("B300")) Is Nothing Then Exit Sub ActiveSheet.Tab.ColorIndex = 15 End Sub You could try this... Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) If Intersect(Target, Range("B300")) Is Nothing Then ActiveSh...

Re: OpenForm Macro
PO number "Endo" <3zc7s7@bma.biglobe.ne.jp> wrote in message news:... > > "dirtrhoads" <dirtrhoads@discussions.microsoft.com> wrote in message > news:FE05F4CB-006D-4891-BA95-0FA20E875115@microsoft.com... >>I have set up an OpenForm macro on a double click event in a subform. The >> subform is titled Active Orders at Belmont Subform. The form I have set >> to >> open is Order Details. I have set up the macro to open Order Details when >> I >> click on the PO_Number from my subform and it opens perfect, how...

How Can I call A Macro From One "Work book" to Another "Work book"?
Hi, All... I would like to call a macro from one Workbook to another Workbook What i Mean to say .. for example Let I have To Workbooks , name workbook1 and Workbook2 In sheet1 of workbook1 i have data like in the range A1:D4 A B C D X 2 3 4 Y 3 4 5 Z 4 5 6 I selected specific range mentioned above(A2:D4) and selected th columns graph after that i deleted all the data , cut that graph and paste in anothe "sheet2" , so that what ever the reflections/changes made by me in dat range from the worksheet1 , occured in Graph of worksheet successfully. I r...

Find Replace with Macro
Can anyone tell me how to construct a macro that will seacrh the entire contents of column C, find the contacts of cell A1 and replace it with B1, then do the same finding A2 and replacing it with B2 in column C, then A3 with B3 in column C etc etc. I can not get this to work. Sub Test() Dim r1 as Range Dim r2 as Range For Each r1 in Range("A1:A" & Range("A65536").End(xlUp).Row For Each r2 in Range("C1:C" & Range("C65536").End(xlUp).Row If r1.Value = r2.Value Then r2.Value = Range("B" & r1.Row).Value Next Next End Sub -...

Visual Studio 2005 doubts
is worked only in VC 6.0.. It doesnot work in Visual Sttudio 2005Code is the following....... CString CClientRRM::RetrieveMachineName() { char szMachineName[30]; LPTSTR lpbuffer; lpbuffer=szMachineName; DWORD size=sizeof(szMachineName); GetComputerName(lpbuffer,&size); return lpbuffer; } When I execute this code I got error message... ....Error is error C2440: '=' : cannot convert from 'char [30]' to 'LPTSTR'.. ponny skrev: > is worked only in VC 6.0.. > It doesnot work in Visual Sttudio...

Z order in Visual Studio Dialog Editor
I have a dialog with a large Tab Control. On Top of that tab control are a few other bits and pieces. I keep ending up with the Tab Control on top of the other things, so I can't see them when modifying the layout of the dialog. I have a 'send to back' and 'bring to front' button on the Layout toolbar, but it isn't active when I have my Tab Control selected. I can't find another 'send to back' option. The option must be here somewhere - help?!? "GT" <ContactGT_remove_@hotmail.com> wrote in message news:468d1731$0$26278$c3e8da3@news...

Activate a macro to insert a row and copy the formuals from the rows above to the blank row
This macro works fine doing it this way. The problem is when I try to protect the worksheet, and activate the macro to insert a row and copy the formulas from above to the blank row I get a "runtime error 1004" and it does not copy the formulas from the rows above to the inserted ( blank ) row. Anyone have any suggestions as what to do? I am using Excel 2002. Thanks, Charlie Excel will not allow you nor the code to insert a new row if the sheet is protected. What you have to do is include code in your macro to unprotect the sheet at the start of your macro and protect t...

append query with visual basic
I'm trying to execute an append query (qapdCopy&PasteProperties) with visual basic, but I get an error. Run-time error '' Syntex error in INSERT INTO statement. ================================================ Private Function Duplicate() Dim strInsert As String, strFrom As String Dim sstrWhere As String, Dim strSQL As String Dim db As DAO.Database Set db = CurrentDb strInsert = "INSERT qapdCopy&PasteProperties.* " strFrom = "FROM qapdCopy&PasteProperties " strWhere = "WHERE qapdCopy&PasteProperties.ChemicalID = " & [Forms]! [frmM...

Locking Code In Individual Macros
Is there a way to lock one macro for viewing without affecting all macros in the workbook? I need to protect the Workbook_Open macro but the user needs to be able to view other macros for troubleshooting. If not, is there a way to change the font color on only one macro? Thanks Dear Carl: Why don't you put all your "protected code" in a Sub that will be stored in a protected module? That way you can call the Sub from the Workbook_Open event. Hope this helps. Please rate this post. G.Morales "Carl Bowman" wrote: > Is there a way to lock one macro for viewi...

Would like better understanding of how this macro works.
I found most of the macro online and made some changes, but I'm not sure of all of the functions being done. The macro lets you select a group of graphic files and then inserts them into a Word table with one graphic per row. I would appreciate comments on what the different parts of the macro do. Sub AddPix() Dim fd As FileDialog ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=1, NumColumns:= _ 2, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _ wdAutoFitContent With Selection.Tables(1) .Columns.Pre...

Excel 2007 Countifs macro with multiple criteria (OR)
Been working on this reporting macro for excel 2007. Cant figure out how to make countifs work for many possible values in one cell. I have report with multiple colums. With no problem I can check if call has been on hold for less than 26 seconds etc. But in the same countifs sentence I should check also if colum H cell has one of correct names from 50 possible names. There is something like 50 names and about 30 names should be counted and the other 20 not. So I think I need somekind of a OR sentence inside criteria (also saw one possible solution that there would be possib...

Enable/Disable Macros question
Hi I have a workbook that has a few macros in it which need to be enabled. How can i close the workbook if someone clicks 'disable macros'.? I would like to place the 'check' in the workbook open module if possible. Thanks Paul On Fri, 13 Feb 2004 18:19:05 -0000, "Paul Watkins" <paul.watkins4@ntlworld.com> wrote: >Hi > >I have a workbook that has a few macros in it which need to be enabled. >How can i close the workbook if someone clicks 'disable macros'.? > >I would like to place the 'check' in the workbook open modu...

Insert Static Date as part of Macro
I've built a nice macro, but I want it to insert the date it is run in an empty cell within the macro's range. When working within a spreadsheet, Ctrl +; returns the system date, but I can't figure out how to put that command into a macro. The macro recorder editor shows that the system recognizes the entry as the current date, not a function that returns the current date. The now() or today() functions are both dynamic ... they change with the system date. That's not acceptable in this situation. I need to seen when the macro was run. Thanks for any help, Ralph di...

Macro to apply alternate grey/white shading to selected paragraphs
Dear Experts: I would like to do paragraph shading using grey shading alternately. Example: this is a sample text This is another sample text This is yet another sample text This may be the last paragraph acquiring grey shading This is the penultimate paragraph This is the last paragraph With these 6 paragraphs selected, I would like to run a macro which applies grey shading alternately to the selected paragraphs, i.e. grey/ white (no shading) alternately. Help is much appreciated. Thank you very much in advance. Regards, Andreas Use Dim oRng As Range For i = 2 T...

Save sheet copy with cell value name using a macro.
Good afternoon All, I need a VB statement to save a copy of the sheet i'm using (same were the macro is executed) with a cell value (EG cell "B2") of the workbook I'm using into a predefined path (EG "C:\"). If anybody can help me with this I'll be very glad. Leo. You want to save a sheet as a workbook with a name of the value in Range("B2") of the sheet? Sub Make_New_Book() Dim w As Worksheet Application.ScreenUpdating = False Application.DisplayAlerts = False ActiveSheet.Copy ActiveWorkbook.SaveAs Filename:="C:\...

Macro Security, Password Recovery & VB Code execution
I have found that if I set my macro security to high, VB code within (non-trusted) excel sheets do not execute... a microsoft security feature that ostensibly prevents non- trusted users from running VB The questions I have are : Is there a way to guarantee VB macro-execution using digital certificates or what-have-you ? Is there a way to detect, either within excel (well, not possible, it seems) or from outside, that the combo of users macro-security settings and signature status of a perticular excel file, WILL prevent VB from executing, if the file is attempted to opened ? ...

Designer and code file in Visual C++ 2005
Hi, I am working on my very first project in Visual C++ 2005 and had just created my very first form (Windows Form) , added a button, a meny and other stuff a regular project contains. But then it struck me that when adding events and such (in this case events) it created a definition for the method (event handler) in the header file that was created when I created the form. So the event code was both the declaration and the definition! As a C++ programmer, that turned my stomach inside out! What I do want is the declaration in the headerfile and the definition (the logic) in a separate sour...

Execute a module with a macro
Is there a way to execute a code in a module using a macro? I've used the 'OpenModule' action but it seems to only open the module instead of executing the command. Thanks! Yes. Select 'RunCode' as your action and then set the 'Function Name' property to the function your wish to execute. -- Hope this helps, Daniel Pineault http://www.cardaconsultants.com/ For Access Tips and Examples: http://www.devhut.net Please rate this post using the vote buttons if it was helpful. "EA" wrote: > Is there a way to execute a code in a ...