visual-c++

MS Visual c++ 2008 char buffer longer than defined

I've got a char* buffer to hold a file that i read in binary mode. I know the length of the file is 70 bytes and this is the value being used to produce a buffer of the correct size. The problem is, there is 17 or 18 extra spaces in the array so some random characters are being added to the end. Could the be a unicode issue? ulFLen stor...

Using member of template class to instantiate template default parameter in MSVC++

The following piece of code is a reduced sample from the large project I'm trying to port from GCC/G++ to Microsoft Visual C++ 2010. It compiles fine with G++, but with MSVC++, it throws errors, and I'm having trouble understanding why. template <typename A, typename B = typename A::C::D> // line 1 struct foo { typedef int type; }...

Creating a thread hangs MFC dialog app on termination

Hi. I've narrowed down a problem. I create a simple Dialog app with VC++ 6.0. I start a thread before the main dialog DoModal() is called I exit the application - sometimes the app shuts down immediately, other times it hangs for 10 seconds or so What causes this? I have tried _beginthread(), _beginthreadex() and AfxBeginThread(). T...

How to make my toolbar button to use my own icons/images?

Currently the code here is using IE6's button icons. How can I point this button to use other image/icon that I create myself? TBBUTTONINFO inf; inf.cbSize=sizeof(inf); inf.dwMask = TBIF_IMAGE; inf.iImage = 1; SendMessage(tmp, TB_SETBUTTONINFO, m_buttonID, (LPARAM)(&inf)); ...

Create Hidden (CWnd derived class ) class in a regular dll and unable to post the messages to it from it

i had written code for creating hidden window, but in a dll & messages are not getting posted to the hidden window. my requirement is to post the messsages to the hidden window from the hidden window itself. i'll just call start function of this hidden window then it will create & process the user defined message (this is my requirement...

Storing debug session (breakpoint/bookmarks) in Visual Studio (C++)

Hi! When I'm debugging something, I would like to store breakpoints/bookmarks related to bug* I'm currently working on. So when I switch to another bug*, I don't want every time to manually disable breakpoints/bookmarks related to previous bug, and create another one for the new bug. It would be great that is possible to tag breakpoint ...

tried to run on windows xp sp3 ( exe from windows server os)

Hi, I compiled mfc program using vc2008 on windows server os. I tried to run exe on windows xp sp3. I am getting error as "This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.". what do i do for solve this. Thanks, KAM ...

Writing the Windows Event Log using Visual Studio C++ 6

Hi All, I am attempting to write a simple function using VC++6 to write to the event log. It must be in this version of studio because it is being added to a legacy application. The problem that I am having is that it writes the message similar to below. The only thing that is valid here is the "This is a test" string. I don't need this...

How do I run my code from the command line?

i have following code #include <iostream> using namespace std; int main(int argc,char arg[]){ int a=arg[1]; int b=arg[2]; int c=a+b; cout<<c<<endl; return 0; } i am using windows 7 microsoft visual c++ 2010 how run it from command line? ...

Book on C++ explaining advance concepts like autoptr

Possible Duplicate: The Definitive C++ Book Guide and List Can somebody recommend me advance c++ book explaining RAII, autoptrs? Thank you ...

Run managed code on secure desktop

I am working on creating an application which must interact with the user on the secure desktop (i.e. locked computer screen), but does not specifically provide authentication. From my research, it seems that the only way to get code running on the secure desktop is to use the Credentials Provider API. However, you can only write a crede...

How to appear my own icon on the toolbar button?

I want to make my button to appear my own icon. But somehow, it still refers to IE6's icons. Help me... Here's the the code I am currently working on: HINSTANCE module = _AtlBaseModule.GetResourceInstance(); HICON myicon = LoadIcon(module, MAKEINTRESOURCE(IDI_ICON1)); HIMAGELIST hImageList = ImageList_Create(16,16, ILC_...

Problem in Reading a Stream

Hi, I'm using fstream to read a stream from a binary file. I use the method get(). fstream f1("Log.dat", ios::in | ios::binary); char zMsgSize[MSG_SIZE]; zMsgSize[0] = '\0'; f1.get(zMsg, CHR_END); CHR_END is a special terminating character that I have put in the file earlier. There are null characters in the file I'm reading, that'...

Viewing cl.exe response file

Visual Studio (2005/2008/2010) appears to create a response file containing flags for the C/C++ compiler, cl.exe. As soon as compilation finishes, the response file is deleted. Is there a way to force Visual Studio not to delete the response file? Is there some other way to view the contents of the response file? ...

Arranging Cascade the CDialogs in MFC with CascadeWindows function

how to arrange dialogs programmatically in MFC in cascade format, other than simply using SetWindowPos based upon the position of the previous displayed window. The Dialog position is to be loaded from the registry(in my app) so we use SetWindowPos(NULL,x,y,cx,cy,SWP_NOZORDER); for the dialog , Ater then if we use CascadeWindows func...

Developing common applications working on both Windows OS and Linux OS with Visual C++ 2008

I wish to develop applications which should work both on Windows and Linux Operating Systems. Please help me how to proceed. ...

exception during destruction of CComPtr

I have created a member variable in class as CComPtr<IXMLDOMDocument2> m_spXMLDoc; XML document is created as CoCreateInstance(CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER, IID_IXMLDOMDocument2, (void**)&m_spXMLDoc)); Now when application exits ,exception is occurring.Callstack is pointing to p->Release() ~CComPtrBase() throw() ...

How to write console data into a text file in C++?

Hi All, I'm working on a file sharing application in C++. I want to write console output into a separate file and at the same time I want to see the output in console also. Can anybody help me...Thanks in advance. ...

static link mapi32.lib with my vc++ project in vs.net2005

Hello All, I want to static link mapi32.lib with my vc++ project in vs.net2005 project. I am using the following import statement inside my testdll.cpp project which is my entry point of the application. #import "mapi32.lib" I have put references for C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Lib path inside c/c++ -> ...

Windows Service Multi Core Utilisation

We have an number of old visual C++ 6 windows services that are currently running on a single server. The problem seems to be that all of the service seem to utilise only a single core. (There are 4 cores) Isn't the multi core utilisation (on windows server 2003) supposed to be optimised by the OS? ...