macros

% style macros not supported in some C++/CLI project property pages under VS2010?

We're currently evaluating VS2010 and have upgraded our VS2008 C++/CLI project to the new .vcxproj format. I've noticed that a certain property we had set in the project settings did not get translated properly. Under Configuration Properties -> Managed Resources -> Resource Logical Name, we used to have (in VS2008) the setting: $(Int...

C++ Macro problem, not replacing all values

I have the following 2 macros: #define SCOPED_ENUM_HEADER(NAME) struct NAME{ enum _NAME{ #define SCOPED_ENUM_FOOTER(NAME) };}; typedef NAME::_NAME NAMEtype; Only the first instance of NAME get replaced by the passed NAME. What's wrong with it? Is is to be used in such a way: SCOPED_ENUM_HEADER(LOGLEVEL) UNSET, FILE, SCREEN...

Automating Excel macro using python

I am using python in Linux to automate an excel. I have finished writing data into excel by using pyexcelerator package. Now comes the real challenge. I have to add another tab to the existing sheet and that tab should contain the macro run in the first tab. All these things should be automated. I Googled a lot and found win32come to d...

What is the difference between #ifdef __IPHONE_3.2 and #if __IPHONE_3.2?

Hi, I have an iphone app that needs to work for 3.1.3 for the iPhone and 3.2 for the iPad. It is an iPhone app that I want to work on the iPad. The main difference is the MPMoviePlayerController which introduces/and deprecates lots of things in 3.2. Since, the iPhone OS only goes up to 3.1.3 and the iPad is on 3.2, I need to seper...

Add a Keyboard shortcut to AutoKeys macro from VBA in Access 2003.

I have an Access 2003 application and it has AutoKeys macro. I would like to add an another Keyboard shortcut to this application from my VBA module. How can I do that? ...

Anonymous union definition/declaration in a macro GNU vs VS2008

I am attempting to alter an IAR specific header file for a lpc2138 so it can compile with Visual Studio 2008 (to enable compatible unit testing). My problem involves converting register definitions to be hardware independent (not at a memory address) The "IAR-safe macro" is: #define __IO_REG32_BIT(NAME, ADDRESS, ATTRIBUTE, BIT_STRUCT)...

C++ macro expansion , debugging

I have a bunch of MACROS in c++ code that expand into some functions. And I am debugging something. Just want to see what the code ends up looking like” Any ideas? ...

How to fill in Different String Values in Different Cells in Excel 2007 VBA marcos

Hello everyone, So I am trying to fill in Values "A-Z, 0-9" in a 2007 excel macro in four different locations (I am trying to put A-Z and 0-9 in cells: a1 to d9, e1 to h9, a10 to d18, and e10 to h18). So far I have the code: Sub TwoDArrays() Dim Matrix(9, 4) As Variant Dim Matrix2(9, 4) As Variant Dim Matrix3(9, 4) As Variant Dim Mat...

c program output

Hello, I am trying some program and confused with the output of the program #include<stdio.h> #define a(x) (x*x) int main() { int i=3,j; j=a(i+1); printf("%d",j); return 0; } I want to know why the program is not giving the output 16(as instead to that i an getting the output 7 for the above program ) i understood the point...

Excel macro to change location of .cub files used by pivot tables? (to allow .xls files that depend on .cub files to be moved)

I often use Excel with pivot tables based on .cub files for OLAP-type analysis. This is great except when you want to move the xls and you realise internally it's got a non-relative reference to the location of the .cub file. How can we cope with this - ie make it convenient to move around xls files that depend on .cub files? The best ...

How can I access the controls in a Windows Forms Designer window through a VS macro?

I'm just getting started on this, so bear with me. I was looking into writing some macros to provide keyboard shortcuts in the Windows Forms Designer in Visual Studio. In particular I was hoping to create shortcuts for manipulating certain properties of the selected control in the designer. Obviously to do this I need to somehow access t...

MS Excel - Macros for consolidating values from multiple sheets into a single sheet

Hi everyone... Consider i have 4 workbooks with the following structure... 1. Main.xlsx Name Jan Feb Mar A B C 2. Jan.xlsx Name Jan A 3.3 B 6.4 C 5.3 3. Feb.xlsx Name Feb A 1.3 B 3.4 C 5.5 4. Mar.xls...

Is there a way to make C macros keyword agnostic?

Is there a way to concatenate keywords in a macro and get C to behave in a more dynamic fashion as in: #define macro(fun,ction,var,iable) function(variable) I know this kind of thing exists in other languages. ...

C++ preprocessor #define-ing a keyword. Is it standards conforming?

Help settle the debate that's going on in the comments at this question about bool and 1: Can a standards-conforming C++ preprocessor allow one to use #define to redefine a language keyword? If so, must a standards-conforming C++ preprocessor allow this? If a C++ program redefines a language keyword, can that program itself be standard...

Accessing a local from one macro in another executed in the scope of the let.

Be gentle, as my macrofoo is weak. What I'd like to do is something like this: (defmacro foo [x] `(dosync (alter x# conj x))) (defmacro bar [] `(let [x# (ref [])] (foo 3))) Is this possible? I can't just (let [x ..] ..) because of symbol capturing. NOTE: I'm aware this example is trivial and not macro-worthy, but it's the simplest e...

Replacing in part of a document with OpenOffice.org BASIC

I try to replace a word in an OpenOffice document, from the visual cursor to the end of the document. I would like to do it in a single operation, so that I could eventually undo the action in one step. Unfortunatelly, the only method I have located is ReplaceAll, that seems to work only for whole documents and not for shorter ranges. ...

Microsoft Word Macro - Exporting Word Review Comments - How do you reference the sentence related to a comment?

I am trying to export of a Word document review comments. I want to export the sentence selection that was commented on followed by the comment. Screen shot of the image: http://jspeaks.com/mswordcomment.png I have found code to loop through the document comments, but I cannot figure out how to reference the sentence selection that th...

Macro C++ Issues __VA_ARGS__

What (if any) are some potential problems with a C++ macro usage like this? Would an inline function be a more appropriate solution? #define EVENT_INFO(_format_, ...) CMyEvent::Generate(__FILE__, __LINE__, CMyEvent::EVT_HIGH, _format_, __VA_ARGS__) void CMyEvent::Generate( const char* file, // filename int ...

Are incremental Macro definition possible?

I often find the following type of incremental definition useful: (define (foo) (display "bar")) (foo) ;prints bar (define foo (let ((bar foo)) (lambda () (display "foo") (bar)))) (foo) ;prints foobar How do I preform this type of incremental definition with macros? I could not get let-sy...

c++ macros question

can somebody explain the following code please? #if 1 // loop type #define FOR_IS_FASTER 1 #define WHILE_IS_FASTER 0 // indexing type #define PREINCREMENT_IS_FASTER 1 #define POSTINCREMENT_IS_FASTER 0 #else // loop type #define FOR_IS_FASTER 1 #define WHILE_IS_FASTER 0 // indexing type #define PREINCREMENT_IS_FASTER 0 #define POSTINC...