macros

Foreach-statement in c++ and language extension?

You can simulate foreach-statement in c++ with macro declaration. I'm using similar syntax for looping arrays in the following way: int array1[10]; vector<int> array2(10); fori(array1) forj(array2) fork(123) if(array1[i]==array[j]) return true; What's your favorite macros for extending c++ l...

Problem of input mask in VBA text box ?

There is a problem in VBA text box while filling input mask property: I am trying to make the combination of date and time: Hence i put it like below: 00/00/00;0;_00:00;0;_ But while running the application, i am only getting 00/00/00 (Date). But i remember, i got the result as like 00/00/00 00.00 as expected when i first put the ...

Large C macros. What's the benefit?

I've been working with a large codebase written primarily by programmers who no longer work at the company. One of the programmers apparently had a special place in his heart for very long macros. The only benefit I can see to using macros is being able to write functions that don't need to be passed in all their parameters (which is r...

What is the purpose of the ## operator in C++, and what is it called?

I was looking through the DXUTCore project that comes with the DirectX March 2009 SDK, and noticed that instead of making normal accessor methods, they used macros to create the generic accessors, similar to the following: #define GET_ACCESSOR( x, y ) inline x Get##y() { DXUTLock l; return m_state.m_##y;}; ... GET_ACCESSOR( WCHAR*, W...

VBA sql query problem

Below query is resulting NO rows lstResults.RowSource = "select EmpId from tblTesting where Empid ='" & Me.txtSearchEmpId.Value & "'" Where below working fine : lstResults.RowSource = "select * from tblTesting" WHere is the fault here? I check the value of '" & Me.txtSearchEmpId.Value & "'" using break point its having the value o...

outlook macro to send email conditionally

Hi, Could anyone guide me in creating an Outlook Macro that does the following: Whenever I send a mail to a particular mail-id an automated mail will be send to a specified group pa mail-ids or some outlook contacts group. Thanks in advance!! ...

Need help with a macros for Visual Studio to cancel outlining at file open...

As you can guess from the title, the outlining with regions finally made me sick. I remember reading in comments somewhere that it is possible to have a macros to perform this task. Since I haven't ever written a single macros fro VS, I ask for community assistance. How? ...

how to loop through rows columns in excel VBA Macro

Hi, I am trying to create a macro that has a loop which copies a function down column 1 (VOL) and another function down column 2 (CAPACITY) for each Station. This is what I have so far: Sub TieOut() Dim i As Integer Dim j As Integer For i = 1 To 3 For j = 1 To 3 Worksheets("TieOut").Cells(i, j).Value = ...

Commented lines in macros

Please help a macro beginner... I created a simple macro for loading images and split it up into several lines so that I can log every time code generated from the macro is executed (for debugging). It looks like this: #define LOAD_PNG(L_I_IMAGE_NAME) ({ \ PngImageClass* __tmp; \ printf("Loading png: %s", L_I_IMAGE_NAME);\ __tmp = [imag...

Difficult boo syntactic macro

I'm creating a DSL for an extensible card game engine I'm working on, with boo. I have a card macro that creates a class for a new type of card, and initializes some properties in the constructor. That macro has a few submacros for setting other things. Basically I want it to turn something like this: card 'A new card': type TypeA ...

How to make absolute cell ref in loop work and skipping over a column in loop?

I ALMOST got my code working but there are still two things wrong with it (two major things anyway). 1) The absolute cell ref. is not working as it does in Excel. I want for example $A5 but instead of changing to A6 A7 etc., it stays A5 throughout the loop. 2) There is a third column that I need to skip over. I only need my loop to wri...

FREE tool to play back keystrokes and mouse clicks?

Every time I test my program, I have to go through a bunch of the same keystrokes and mouse clicks. I am looking for a tool to automate this like a Macro recorder. The tool needs to save the clicks and keystrokes one time. Then every time my program runs, I hit a keyboard shortcut and it does its work. I see a lot of such shareware tool...

Easy way to convert exec sp_executesql to a normal query?

When dealing with debugging queries using Profiler and SSMS, its pretty common for me to copy a query from Profiler and test them in SSMS. Because I use parameterized sql, my queries are all sent as exec sp_executesql queries. exec sp_executesql N'/*some query here*/', N'@someParameter tinyint', @ someParameter =2 I'll take this ...

C++ Template preprocessor tool

Is there a compiler or standalone preprocessor which takes C++ files and runs a template expansion pass, generating new C++ code with expanded template instantiations? I remember such a tool in the mid-90s when templates were still new and experimental, and the preprocessor was a way to do template programming with compilers without nat...

Do Visual Studio 2008 macros have to be written in VB.Net?

Probably a stupid question but, do Visual Studio 2008 macros have to be written in VB.Net? If not, what are the alternatives? ...

Is it OK to use a macro to specialize std::swap?

So, I have a macro. // swap_specialize.hpp #include <algorithm> #ifndef STD_SWAP_SPECIALIZE #define STD_SWAP_SPECIALIZE( CLASSNAME ) \ namespace std { \ template<> inline \ void swap( CLASSNAME & lhs, CLASSNAME & rhs ) \ { lhs.swap(rhs); } } #endif So then I have a class // c.hpp #include...

What does macro mean?

I have somewhat experience with what people call excel "macros". The vba code that controls the activeX components, right? But I still do not know the true meaning of the term macro :). What kind of code is called macro? Is it something like vba or js implemented into a program? Like vba to excel or vba to autocad or js to flex? ...

Error 70 in Excel VBA

Hi, I am trying to upload directly a picture/chart from excel to a Sharepoint group URL. Here is the script: Sub ExportChartJPG() ActiveChart.Export Filename:="http://sharepoint.ap.xxxxxxxxxxxxxx.com/xxxxxx/xxxxxxxxxxxxxx/Pictures/MyChart.jpg", _FilterName:="jpeg" End Sub Is that possible? If it's not then can you suggest anothe...

How would I retreive the fully qualified name of an identifier in a VS macro?

I'm trying to resolve the fully qualified name of a c# identifier at a certain point (cursor) of a code window, using a Macro (or even an Add-in) in Visual Studio 2008. For example, if the cursor is in "Rectangle", I would like "System.Drawing.Rectangle" returned. I've tried FileCodeModel.CodeElements and .CodeElementFromPoint but they...

Printing name and value of a define

Hello, I have a C program with a lot of optimizations that can be enabled or disabled with #defines. When I run my program, I would like to know what macros has been defined at compile time. So I am trying to write a macro function to print the actual value of a macro. Something like this : SHOW_DEFINE(X){\ if( IS_DEFINED(X) )\ ...