macros

C++: sizeof for array length

Let's say I have a macro called LengthOf(array): sizeof array / sizeof array[0] When I make a new array of size 23, shouldn't I get 23 back for LengthOf? WCHAR* str = new WCHAR[23]; str[22] = '\0'; size_t len = LengthOf(str); // len == 4 Why does len == 4? UPDATE: I made a typo, it's a WCHAR*, not a WCHAR**. ...

Returning pointer to a certain value in a macro?

Is it possible to write a macro that has a type and a value as its input parameters (MACRO(type,value)), and returns a valid pointer to a location that holds the submitted value. This macro should perform like the following function, but in a more generic manner: int *val_to_ptr(int val){ int *r = NULL; r = nm_malloc(sizeof(*r)...

Assign keyboard shortcut to Visual Studio 2010 custom macro

I had a macro (http://weblogs.asp.net/koenv/archive/2008/02/14/quick-attach-and-detach-debugger.aspx) in Visual Studio 2008 that attaches the debugger to IIS (for ASP.NET/WCF development). I assigned a shortcut to it using the options dialog. Now I migrated the macro to Visual Studio 2010 but I can't find the macro in the list of comman...

C macro issue: redefinition of functions / structure

Given the following code (it's a macro that generates code for a list data structure, based on the contained type). list.h #ifndef _LIST_H #define _LIST_H #ifdef __cplusplus extern "C" { #endif #define LIST_TEMPLATE_INIT(type) \ typedef struct __list_s_##type { \ struct __list_s_##type *next; \ type value; \ ...

VS2010 Macro/Add In for "Run" and "Run On" commands in Visual Studio 2010

Much to annoyance of many developers Microsoft have removed the "Run" and "Run On" commands in Visual Studio 2010: More details at: http://social.msdn.microsoft.com/Forums/en/vstsdb/thread/f374c604-a7eb-496d-a261-9374790cdbf9 Has anyone seen or written a VS2010 Macro or Extension that fills the gaps and replicates this functionality? ...

Programmatically Determine If An Excel File (.xls) Contains Macros

Is there any way to programmatically determine if an .xls contains macros, without actually opening it in Excel? Also are there any methods to examine which certificate (including timestamp cert) these macros are signed with? Again without using Excel. I'm wondering in particular if there are any strings that always show up in the raw ...

Declaration for object for which creation is wrapped in macro

The following macro is defined in our code: #define MSGMacro(obj, arg) MyPaymentClass obj(arg) Where MSGMacro is used to creates the object of type MyPaymentClass using code like MSGMacro(Card, 1); MSGMacro(Cash, 2); ---- ---- //removed unwanted things to keep question cleaner. All the above code is in one cpp file, Now the pro...

Macro to Display String on Checkbox Select

I have a checkbox on sheet1 (there are about 7 sheets total). If the checkbox is selected (true), I want it to say "Approved" in cell M9. If the checkbox is not selected (false), I want it to say "Denied" in the textbox. Do I need to create a macro for that? If I want it to display the same text in cell M5 of sheet2, how would I put it...

MACRO compilation PROBLEM

i was given a primitive task to find out (and to put in cl) how many nums in an array are bigger than the following ones, (meaning if (arr[i] > arr[i+1]) count++;) but i've problems as it has to be a macro. i am getting errors from TASM. can someone give me a pointer? SortA macro a, l LOCAL noes irp reg, <si,di,bx> push reg end...

Can someone explain the concept of 'hygiene' to me (I'm a scheme programmer)?

So... I'm new to scheme r6rs, and am learning macros. Can somebody explain to me what is meant by 'hygiene'? Thanks in advance. ...

vba: getting list of all files with ESY extension in a directory

in vba how do i get a list of all the files with a specific extension in a specific directory? i am unable to do application.filesearch, because i am using excel 2007 ...

vba: get unique values from array

is there built in functionality in vba to get unique values from a one-dimensional array? what about just getting rid of duplicates? if not, then how would i get the unique values from an array? ...

my macro is stuck how do i kill it?

i have a macro that goes through a directory and looks at all the files unfortunately it's on a mapped network drive and its really slow how do i stop the macro? ...

vba: clear entire array

i have an array like this: Dim aFirstArray() As Variant how do i clear the entire array>? what about a collection? ...

vba: a forever loop

Sub something(tecan) On Error Resume Next Dim arr As New Collection, a Dim aFirstArray() As Variant Dim i As Long aFirstArray() = Array(Dir(tecan & "*.ESY", vbNormal)) aFirstArray(0) = Mid(aFirstArray(0), 1, 4) Do While Dir <> "" ReDim Preserve aFirstArray(UBound(aFirstArray) + 1) aFirstArray(UBound(aFirstArray)) = Mid(Dir, 1...

Any utility to test expand C/C++ #define macros?

It seems I often spend way too much time trying to get a #define macro to do exactly what i want. I'll post my current dilemma below and any help is appreciated. But really the bigger question is whether there is any utility someone could recommend, to quickly display what a macro is actually doing? It seems like even the slow trial and ...

Python win32com - Automating Word - How to replace text in a text box?

I'm trying to automate word to replace text in a word document using Python. (I'm on word 2003 if that matters and Python 2.4) The first part of my replace method below works on everything except text in text boxes. The text just doesn't get selected. I notice when I go into Word manually and hit ctrl-A all of the text gets selected ...

Run a macro in all buffers in vim

I know about the :bufdo command, and was trying to combine it with a macro I had recorded (@a) to add a #include in the proper spot of each of the header files I'd loaded. However, I couldn't find an easy way to run the macro on each buffer. Is there a way to execute a macro through ex mode, which is what :bufdo requires? Or is there ...

vba: This key is already associated with an element of this collection

Dim arr As New Collection, a Dim aFirstArray() As Variant ...some code For Each a In aFirstArray arr.Add a, a Next i get this error: This key is already associated with an element of this collection on this line : arr.Add a, a what am i doing wrong? ...

Visual Studio Macro Parsing

I'm looking for a way (and maybe a macro isn't the best approach) to jump from one class to a related class much the same way that I can us the go to definition feature. The related class is related like so: In a class called MyStuffController and in a method MyAction I would like to go to the directly related Views/MyStuff/MyAction/My...