grab our rss feed

stevienova.com

Homepage of Steve Novoselac

Entries Tagged ‘CPlusPlus’

VS2005 C++ Unit Tests - System.AccessViolationException: Attempted to read or write protected memory.

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt..
If you have VS2005 C++ Unit Tests, written in managed C++ as they should be, and you are calling native code from them, and you see that error when running your unit tests - I have found it [...]

Comments (3) | 796 views

VS2005 LNK1104 Error - cannot open file

If you are referncing another lib in a project and you goto build and get
fatal error LNK1104: cannot open file ‘C:\MyProject\Debug.obj’
Do a double check in the project you are referencing configuration. If you have a space in the name (Say “Debug Test”) you might see this error and scratch your head. If the project you [...]

Leave a Comment | 504 views

HowTo: Make a Win32 DLL without MFC and ATL

Vs2005->New->Project
Win32->Win32 Project
On the Wizard, Application Settings, choose DLL radio box, hit finish.
This is all great, except when you build it, you just end up with a dll. How do you use the dll in another project?
Add a Module-Definition File (.def) - call it Export.def
next time you build, there will be a “.lib” file avail so [...]

Comments (1) | 182 views

VS2005 MFC Class Wizard Changes

If you ever used Visual Studio/C++ 6 (98), you would notice that the MFC Class Wizard allows you to set up messages as you create a class. Well, I’m not sure about VS2003, but VS2005, when you use the MFC Class Wizard, there are no options for setting up messages and events. Where did the [...]

Leave a Comment | 115 views

Static Code Analysis in C/C++

If you ever need to run static code analysis on C/C++ files, you can use Vs2005, but if you are in Vs2003, here is what you can do:
c:\Program Files\Microsoft Visual Studio 8\VC>cl /analyze “C:\MyCodeFile.c” > c:\MyCodeFileAnalysis.txt
Found this on MSDN

Leave a Comment | 156 views

VS2005 - Browser Helper Object (BHO) Tutorial

I have been dabbling with BHO’s for some time, way back with VB6, then tried in .NET, and with C++ as well. There are so many cool things you can do with them. Anyways, most of the documentation out there is sparse and old. I told myself the next time I have to make one, [...]

Comments (11) | 1,644 views

SHGetFolderPath on Windows 98

SHGetFolderPath doesn’s seem to work on Windows 98. If you use it to try  to find like the “My Pictures” directory,  it will error out.  I have read that some versions of Win98 do work, depends on the version of shell32.dll (5 and greater). A workaround that you can use , which probably isn’t 100%  [...]

Comments (2) | 2,760 views

strcpy vs. strncpy

strcpy - Copies the content pointed by src to dest stopping after the terminating null-character is copied.
dest should have enough memory space allocated to contain src string.
strncpy - Copies the first num characters of src to dest.
No null-character is implicitly appended to dest after copying process. So dest may not be null-terminated if no null-caracters [...]

Comments (1) | 2,340 views

Kill.exe and EnableDebugPriv()

The last few days, I have been looking into a solution to kill a process in c/c++ - but not just any process, a ScreenSaver running while the computer is locked. Most examples on MSDN and such terminiate processes by sending close messages to them, and 99% of the time that works. It even works [...]

Comments (6) | 428 views

Visual C++ fatal error LNK1158 midl.exe

ok. Dang it I don’t like C++ and I was getting this error trying to compile a solution. Since searching in google doesnt give anything (do c++ developers use the internet yet?) I am posting this here for the next unlucky soul. What it means is that file is missing from an executable path or [...]

Comments (1) | 384 views