visual-studio-macros

Is there a better way to pass formatted output to OutputDebugString?

醉酒当歌 提交于 2021-02-05 04:44:49
问题 Typically, when I need to do debug output in Windows, I use the following C code segment: #ifdef _DEBUG #define DBGPRINT( kwszDebugFormatString, ... ) \ { \ wprintf_s( L"[%s:%d] ", __FUNCTIONW__, __LINE__ ); \ wprintf_s( kwszDebugFormatString, __VA_ARGS__ ); \ } #else #define DBGPRINT( kwszDebugFormatString, ...) ;; #endif I'd like to recode this to use OutputDebugString which doesn't accept a format string. I consider statically allocating a small array on the stack (e.g., WCHAR wszBuf[100]

Visual Studio macro: Find files that aren't included in the project?

社会主义新天地 提交于 2020-01-09 05:06:41
问题 I'd like to write a macro to crawl through the files in my project directory and find files that aren't included in the project. In playing around with the DTE object, I see that the Project object has ProjectItems ; if a ProjectItem represents a directory, then it has its own ProjectItems collection. This gives me all files that are included in the project. So I could crawl recursively through each ProjectItems collection, and for each ProjectItem that's a directory, check to see if there

Visual Studio macro: Find files that aren't included in the project?

℡╲_俬逩灬. 提交于 2020-01-09 05:03:45
问题 I'd like to write a macro to crawl through the files in my project directory and find files that aren't included in the project. In playing around with the DTE object, I see that the Project object has ProjectItems ; if a ProjectItem represents a directory, then it has its own ProjectItems collection. This gives me all files that are included in the project. So I could crawl recursively through each ProjectItems collection, and for each ProjectItem that's a directory, check to see if there

Set Legend Text Pie Chart

人盡茶涼 提交于 2020-01-07 05:46:20
问题 I have been trying to set my two legends using a VBA Macro. I want to change my two legends from 1 and 2 to Male and Female on my Pie Chart. I can change it manually by setting it in the "Select Data Source" dialog by setting "Category (X) axis labels" to "=Sheet1!$B$6:$C$6" (which is Male and Female) How do I do this with VBA, though? Here is my code... Sub Pie() For X = 7 To 13 Charts.Add ActiveChart.ChartType = xlPie ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("b" & X & ":c" &

VS 2015 shortcut for “GoTo Region” #region / #endregion

青春壹個敷衍的年華 提交于 2019-12-24 17:27:41
问题 Visual studio 2012 was having a working keyboard shortcut for moving to and fro between #region and #endregion . Ctrl + ] This was not documented anywhere and this was indeed a keyboard shortcut for moving to and fro between { and } . But the same shortcut was working for regions. See below SO question which is similar. How to jump to the region header from the endregion tag in c# visual studio 2012? Visual studio 2015 seems to have stopped supporting this keyboard shortcut for regions. I

Add DLL reference to visual studio macros

不想你离开。 提交于 2019-12-24 15:09:56
问题 I need to create a lot of macros in visual studio the probelem is I do not know visual basic that good. What I have been doing so far is: Create the algorithm "Code" I plan to use on C# on a console application. I complile it then decomplite it with reflector into visual basic. When I decompile the code I lose the comments plus sometimes I have to refer back to the code and it becomes hard to manage. I am tired of compiling and decompiling plus I have to make a few twick every now and then. I

Visual Studio Macros stopped working [duplicate]

做~自己de王妃 提交于 2019-12-24 13:26:38
问题 This question already has an answer here : Macros don't run in Visual Studio 2010 (1 answer) Closed 3 years ago . My Visual Studio Macros stopped working, with no errors displayed or logged I could find. (I did think it was something I did to my machine.) 回答1: Microsoft released a Windows Update that fixed a security issue (MS14-009) that broke Visual Studio Macros. The workaround, described in KB2934830, is to add <?xml version="1.0"?> <configuration> <runtime> <AllowDComReflection enabled=

OnBuildBegin does not fire in Visual Studio Macro until I run it from Macro Explorer

穿精又带淫゛_ 提交于 2019-12-24 10:45:06
问题 I have the following Visual Studio Macro: Imports System Imports EnvDTE Imports EnvDTE80 Imports EnvDTE90 Imports MyMacros.EnvironmentEvents Imports System.Diagnostics Public Module Module1 Private WithEvents buildEvents As EnvDTE.BuildEvents = EnvironmentEvents.BuildEvents Public Sub BuildEvents_OnBuildBegin() Handles buildEvents.OnBuildBegin Dim projectItem As ProjectItem = DTE.Solution.FindProjectItem("T4MVCVB.tt") projectItem.Save() End Sub End Module I can run it from the Macro explorer,

In visual studio, how can I write a macro that will insert the date into a comment?

廉价感情. 提交于 2019-12-23 20:15:13
问题 My question is as exact as it is. I am wondering if it would be possible to insert the date or the date and time into a comment without having to manually write it out. But what I would really like to know is, is there a way to do this and will I have to implement something with visual studio to do this for me and if so, how can I do this? Any help will be greatly appreciated! :) Also, I am coding in C-Sharp and am using Visual Studio 2010. 回答1: In Visual Studio 2010 you write macros in

Excel VBA range.find acting up

白昼怎懂夜的黑 提交于 2019-12-17 20:29:03
问题 Im trying to use range.find to look up a value within a column, and return the matching value from the next column. I recorded the find() using the macro recorder, which seemed to work fine for a while, but for some reason it's now giving me an error. As far as I can tell I haven't changed anything that should affect this bit of code. This is what I have Public Function look_up_id(id, table) Worksheets(table).Activate Cells.Find(What:=id, After:=ActiveCell, LookIn:=xlFormulas, LookAt _ :