Windows CRT and assert reporting (abort, retry, ignore)

This works (for me atleast, on vs 2008): (Essentially, return TRUE from the hooked function) int __cdecl CrtDbgHook(int nReportType, char* szMsg, int* pnRet) { return TRUE;//Return true – Abort,Retry,Ignore dialog will *not* be displayed return FALSE;//Return false – Abort,Retry,Ignore dialog *will be displayed* } int _tmain(int argc, TCHAR* argv[], TCHAR* envp[]) { _CrtSetReportHook2(_CRT_RPTHOOK_INSTALL, CrtDbgHook); assert(false); … Read more

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

Here is the C# version of your code: public static void IncludeNewFiles() { int count = 0; EnvDTE80.DTE2 dte2; List<string> newfiles; dte2 = (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject(“VisualStudio.DTE.10.0”); foreach (Project project in dte2.Solution.Projects) { if (project.UniqueName.EndsWith(“.csproj”)) { newfiles = GetFilesNotInProject(project); foreach (var file in newfiles) project.ProjectItems.AddFromFile(file); count += newfiles.Count; } } dte2.StatusBar.Text = String.Format(“{0} new file{1} included in the … Read more

Custom Color Palette in Visual Studio Color Property Editor

The editor that helps you to pick color in visual studio is ColorEditor which doesn’t persists custom colors across different controls. To solve the problem, you should: Create a custom UITypeEditor based on ColorEditor Register the editor for type Color at visual studio startup Here is a detailed answer including codes which I used to … Read more