visual-c++

Modifying/detecting Local Security Policy programmatically

Is it possible to do at least one of the following: 1) Detect a setting of a Local Security Policy (Accounts: Limit local account use of blank passwords to console logon only) 2) Modify that setting Using Win32/MFC? Thanks in advance. ...

Get CSIDL_LOCAL_APPDATA path for any user on Windows

Hello all, Is there any Win32/MFC API to get the CSIDL_LOCAL_APPDATA for any user that I want (not only the currently logged on one)? Let's say I have a list of users in the form "domain\user" and I want to get a list of their paths - is that possible? Thanks in advance! ...

Why does fatal error "LNK1104: cannot open file 'C:\Program.obj'" occur when I compile a C++ project in Visual Studio?

I've created a new C++ project in Visual Studio 2008. No code has been written yet; Only project settings have been changed. When I compile the project, I receive the following fatal error: fatal error LNK1104: cannot open file 'C:\Program.obj' ...

Automatically stop Visual C++ 2008 build at first compile error?

I know I can compile individual source files, but sometimes -- say, when editing a header file used by many .cpp files -- multiple source files need to be recompiled. That's what Build is for. Default behavior of the "Build" command in VC9 (Visual C++ 2008) is to attempt to compile all files that need it. Sometimes this just results i...

Sounds for build error/success in Visual C++?

On long Visual C++ builds, it would be really helpful to hear some sort of (optional) sounds for such build/compile results as: individual compile error file compile success/failure build success/failure batch build success/failure Does anyone know how to enable sounds for these kinds of build occurrences in Visual C++ (especially Vi...

Is it possible to impersonate a user without logging him on?

Hello all, Is it possible to impersonate a user without supplying user name/password? Basically, I'd like to get the CSIDL_LOCAL_APPDATA for a user (not the current one) using the ShGetFolderPath() function. All I currently have is a SID for that user. Thanks in advance. ...

Indirect Typelib not imported well from Debug dll

Using VC2005, I have 3 projects to build: libA (contains a typelib, results in libA.dll): IDL has a line library libA { ... libB (contains a typelib importing libA, results in libB.dll): IDL has a line importlib( "libA " ); libC (imports libB): one of the source files contains #import <libB.dll> the #import <libB.dll> is handled by...

Weird MSC 8.0 error: "The value of ESP was not properly saved across a function call..."

We recently attempted to break apart some of our Visual Studio projects into libraries, and everything seemed to compile and build fine in a test project with one of the library projects as a dependency. However, attempting to run the application gave us the following nasty run-time error message: Run-Time Check Failure #0 - The valu...

Different dependency settings for 'Debug' and 'Release' build configuration in VisualC++ 6.0

I'm using VisualC++ 6.0. (and, yes, I'm using Mosaic browser..;) My VC++ project has different dependency setting for 'Debug' and 'Release' build configuration. So, when I switch from one configuration to other, I have to change the dependency by hand every time. Is there any better way to do this? Can I keep my dependency setting accor...

Visual Studio support for new C / C++ standards?

Hello everyone, I keep reading about C99 and C++0x and all these totally sweet things that are getting added to the language standard that might be nice to use someday. However, we currently languish in the land of writing C++ in Visual Studio. Will any of the new stuff in the standard ever get added to visual studio, or are microsoft ...

How to find unused attributes/methods in Visual C++ 2008

Is there a way to identify unused attributes/methods in Visual C++ 2008 Professional? If it's not possible by default, recommendations of 3rd-party tools are also much appreciated. Thanks, Florian Edit: nDepend only works for .NET assemblies. I'm looking for something that can be used with native C++ applications. ...

Compatibility Mode for Web Services

I have a web service that loads an unmanaged .dll made from VC++ 6. In Vista and Windows Server 2008, I can get applications using this to work by putting them in Win98 Compatibility mode. Is there a similar way I can do this with my web service, so it will run? ...

How to put breakpoint in every function of .cpp file?

Is there a macro that does it? Which DTE objects to use? ...

How can you bring a control to front in mfc

How do you change controls' Z-order in MFC at design time - i.e. I can't use SetWindowPos or do this at runtime - I want to see the changed z-order in the designer (even if I have to resort to direct-editing the .rc code). I have an MFC dialog to which I am adding controls. If there is overlap between the edges of the controls, I want ...

How can I access argc and argv in c++ from a library function

I'm writing a library which is to be dynamically loaded in C++. I'd like to read argc and argv (for debugging reasons) from within my code, however I do not have access to the main function. Is there any way to retrieve the command line (both Windows and Linux solution would be nice). Thanks, Dan ...

Fatal Error C1083: Cannot Open Include file: 'tiffio.h': No such file or directory VC++ 2008

I got this error when I tried to compile an application that includes the tiffio.h header. For the record, the tiffio.h is located at: C:\Program Files\GnuWin32\include I have set that directory to be included in the 'Projects' and 'Solution' Visual C++ directories, as shown in the image located here. What am I missing? ...

Stop MSVC++ debug errors from blocking the current process?

Any failed ASSERT statements on Windows cause the below debug message to appear and freeze the applications execution. I realise this is expected behaviour but it is running periodically on a headless machine so prevent the unit tests from failing, instead waiting on user input indefinitely. Is there s a registry key or compiler flag I ...

Docking a CControlBar derived window

How can I dock a CControlBar derived window to the middle of a splitter window (CSplitterWnd)? I would like the bar to be repositioned whenever the splitter is moved. To make it a little clearer as to what I'm after, imagine the vertical ruler in the Dialog Editor in Visual Studio (MFC only). It gets repositioned whenever the tree vie...

Is it possible to convince GCC to mimic the fastcall calling convention?

So i have a piece of assembly that needs to call a function with the fastcall calling convention on windows, but gcc doesn't (afaict) support it. GCC does provide the regparm attribute but that expects the first 3 parameters to be passed in eax, edx and ecx, whereas fastcall expects the first two parameters to be passed in ecx and edx. ...

How do you control printer tray selection for printer in Windows

We need to be able to change the default selected print tray of a given printer. Does anyone have VC++/win32 code for doing this? In case it matters, I believe we have to change the default setting for the printer. Our print jobs are executed by an application other than ours, so we can't make these kinds of changes in the context of ...