visual-c++

Forcing ints to initialize to 0 msvc++

Is there any compiler setting or other way to force an int to be initialized to 0? ...

Problem with Class wizard in VC++ express edition

I'm just getting started with Visual C++ but I've run into a brick wall. I'm trying to make a new class, so I right-click on my project, Add|Class, C++ class, and call it "piece". This creates "piece.h" and "piece.cpp". So far so good. When I try to include "piece.h" in my main.cpp file however, when I compile I get fatal error C1083: ...

Visual C++ - Event for ComboBox

I'd like to know if there is an event for ComboBox in Visual C++ that I can utilyze for doing something when mouse passes over the items of the combobox. Thank you ...

Why is my 64-bit C++ app crashing?

I have written a really small 64-bit application that crashes on clean installations of Windows Vista x64. It runs smoothly on my development machine (Windows 7 64-bit), which has Visual Studio 2008 installed. The 64-bit C++ application (unmanaged) is started by a 32-bit .NET application, and crashes immediately afterwards with an acces...

Machine dependent _write failures with EINVAL error code

This has some lengthy background before the actual question, however, it bears some explaining to hopefully weed out some red herrings. Our application, developed in Microsoft Visual C++ (2005), uses a 3rd party library (whose source code we luckily happen to have) to export a compressed file used in another 3rd party application. The ...

Window XP Password policy

Hi, I want to read the values of Account policy of Windows XP programmatically. Source code in C++ (Will be more specific) would be appreciated. If you have any guidelines then please help me soon. Thanks in Advance ...

segfault on Win XP x64, doesn't happen on XP x32 - strncpy issue? How to fix?

Hi there, I'm pretty inexperienced using C++, but I'm trying to compile version 2.0.2 of the SBML toolbox for matlab on a 64-bit XP platform. The SBML toolbox depends upon Xerces 2.8 and libsbml 2.3.5. I've been able to build and compile the toolbox on a 32-bit machine, and it works when I test it. However, after rebuilding it on a 64-...

How to initialize 48bpp bitmaps from RGB?

I'm writing an interpreter in managed C++ for, among other things, the PPM image format. The image spec allows for images with up to two bytes per pixel per channel, or 48 bit per pixel color images. I'm attempting to read this format and convert it to a .Net bitmap, but im having trouble getting it working. When I have 24 bit per pix...

Custom image while dragging an CWnd-derived object

Hi all, I want to display a custom image while dragging an object in a drag&drop operation. I have created a CWnd-derived control (a chart) and I display 4 of them in the same dialog. I've implemented drag&drop using COleDataSource so that the user can change its position by dragging and dropping the control. Now I would like to displ...

shellexecute question

i have successfully used shellexecute() to open a .rtf file. but my problem is i have to double click the button before the file opens. can i make it open in a single click of the button? when i try to open a folder using shellexecute, the folder opens in a single click of a button only. does shellexecute() really behaves like that? ...

Unmanaged VC++ Application's memory consumption on windows server

OK, so I have a very large multi-threaded unmanaged c++ application (server) that runs on a windows 2003 server. It hosts sessions for 20-50 concurrent users doing all sorts of business logic... At times it can be using a very large amount of memory due to things like object/session caching due to users having large numbers of windows o...

closing a dialog after a delay

After calling DoModal() on a dialog, and calling a delay function. how do you close the dialog. m_dlg.DoModal(); Sleep(1000); . . . ...

Is it possible to remove CMFCRibbonPanel from CMFCRibbonCategory?

Hi, i'm looking for a trick to remove an CMFCRibbonPanel from CMFCRibbonCategory. There is just AddPanel() function in the CMFCRibbonCategory, but no RemovePanel(). Do I really need to rebuild my whole CMFCRibbonCategory to do this? EDIT: Just for clarification, what i want is to remove panel itself from the category and not the elem...

why doesn't winmain set the errorlevel?

int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { MessageBox(NULL, _T("This should return 90 no?"), _T("OK"), MB_OK); return 90; } Why does the above program correctly display the message box, but does not se...

Monitoring windows processes

I'd like get a notification if a particular process starts. For ex., if xyz.exe starts in the background, I need a messagebox stating the same. I'm a little familiar with Windows Hooks in VC++. Can someone point me to some similar links or methods to achieve my goal? Thanks. ...

COM basic sample

I've been reading Essential COM, it is a very good book, very instructive and simple to understand. Now I want to speed things up and implement a simple COM object, compile it into a .dll and finally use it from a client application. I would really appreciate if anybody could show the most basic sample of how to do that? I've been tryi...

Windows GUI C++ Programming

I want to learn C++ GUI programming using Visual Studio 2008. I'm not sure where to start though. I learned C++ in high school, but not GUI. I've been doing C# for about 3 years now and thats how I "learned" GUI programming. Now I want to learn how to write GUI's without the use of the .NET framework, so where do I start? ...

wxWidgets and VC++

I decided to familiarize myself with wxWidgets today. I downloaded version 2.8.9 (current release), and compiled the library in all the desired modes. I am able to build/run the samples that ship with wxWidgets out of the box. However, when I compile with /Za (i.e., language extensions disabled), I get over 100 build errors on even the ...

Which is the best book to learn visual C++ ?

I've learned the essentials of C++ and would like to learn Visual C++ (VC++) I want to be master in native , MFC and .NET for Windows programming. I already bought a book on VC++ by Ivor Horton. But the language seems hard to understand. Does anyone have any better book recommendations? ...

How to work-around "Object required" error when adding a variable in an ATL Dialog

I'm using Visual Studio .NET 2003 to develop a COM ATL application in unmanaged Visual C++. I've created a ATL Dialag and whenever I try to add a variable for a control the wizard thorws the message "Object required". I've tried the following alternatives: Right click in the control to call "Add variable" from there: this way the wiz...