visual-c++

StdAfx + Header file - Order of inclusion in MFC application

I am using Visual Studio 2005. I created an MFC based console application named "StdAfx dependancy". The IDE created the following files for me. Resource.h StdAfx Dependancy.h stdafx.h StdAfx Dependancy.cpp stdafx.cpp I added another class CHelper with Helper.h and Helper.cpp as below. Helper.h: #pragma once class CHelper { public...

Is there a way to make the MFC app work both ways console as well as Window.

Is there a way to make the MFC app work both ways console as well as Window. ...

Abstract id attribute value

Dear Friends, Actually i want to retrieve "id" attribute's value from the source page [Right click on a Webpage->Select 'View Source'].For example - 'id' of PasswordBox . Right now i able to retieve the values of attributes like- 'type','name','image'.But i unable to retieve value of 'id'. I'm using VC++ .Please any one help me out in...

How do I determine the user's language in Visual C++?

I've been searching msdn forever now without a straight answer. Is there a way to simply get the user's language? I don't want to load any resources or anything at this point, I just want to get their language. Is there ANY simple way to do this? I'm using visual C++,and I'm not using MFC or anything like that. Thanks in advance! ...

question about visual c++ 2010

i have download visual c++ 2010 everything is fine but only one problem is that it has not run method- start without debuging why? how can i run project? ...

Warning C4564 when building C++/CLI project that consumes strong-typed dataset

After upgrade to VC++ 2010, Warning C4564 is raised (method defines unsupported default parameter) when building a C++/CLI project that consumes a strong-typed dataset from a C# project. ReadersManager.cpp(311): warning C4564: method 'SetNewRecord' of class 'System::Data::DataTable' defines unsupported default parameter 'action' 3> ...

How to debug a buffer overrun in Visual C++ 9?

I have a huge MMC snapin written in Visual C++ 9. Every once in a while when I hit F5 in MMC mmc.exe crashes. If I attach a debugger to it I see the following message: A buffer overrun has occurred in mmc.exe which has corrupted the program's internal state. Press Break to debug the program or Continue to terminate the program. ...

MessageBox does not work in a catch of an exception

Well I have 2 issues but my main concern right now is my catch exception. Here is the code... int GXRenderManager::Ignite(HINSTANCE * hinst, int * nCmd, GXDEVICE DeviceType, int width, int height) { try { GXRenderManager::hinstance = hinst; GXRenderManager::nCmdShow = nCmd; GXRenderManager::height = height; GXRenderManager::w...

preventing unaligned data on the heap

I am building a class hierarchy that uses SSE intrinsics functions and thus, some of the members of the class need to be 16-byte aligned. For stack instances I can use __declspec(align(#)), like so: typedef __declspec(align(16)) float Vector[4]; class MyClass{ ... private: Vector v; }; Now, since __declspec(align(#)) is a compilation ...

CPU fully engaged when using MsgWaitForMultipleObjects and PeekMessage() loop.

I am using the following function to wait on an event handle for certain amount of time while keep processing the incoming message. However, while I am waiting, the CPU usage goes to almost 50% for a dual-core CPU. Is there anything wrong with my code? MsgWaitForMultipleObjects keeps returning WAIT_OBJECT_0+1 if I trace the code. I see...

LINK : fatal error LNK1104: cannot open file '..\json_spirit\Debug\json_spirit_lib.lib'

Can someone point me in the right direction? I'm not a C++ or VS developer but I'm trying to compile a project and I'm getting the above error. I don't have any clue why the compiler is looking for that file or what the Debug folder is about (though I could guess). Can somebody explain the issue in other words for me and give me some ...

How should I profile visual c++ express?

I've read a lot of the posts here giving profiling advice but I need to ask this. From what I can tell, visual c++ express doesn't generate a debugging file that is used by profiler programs. I tried AMD Codeanalyst and it seemed to work fine except none of the routines in my program were identified. -just a lot of "unidentified mod...

Some example of __assume leading to a faster code other than "no default" in switch?

Documentation for __assume says "The most common use of __assume is with the default case of a switch statement, as shown in the following example.". Is there any other case where __assume can lead to a more efficient (or even a different) code? When inside of if / else , is compiler automatically "assuming" what is already know becau...

Passing CString to IIS ServerSupportFunction function in ISAPI extension

I've been given an ISAPI extension dll compiled in VC6 which calls "ServerSupportFunction" through MFC's CHttpServerContext class. The code looks something like (assume Ctx is object of the class CHttpServerContext) CString str; str = "Content-Type: text/plain\r\n"; str += "Content-Length: 200\r\n"; str += "\r\n"; DWORD len = str.GetL...

How do I force a native application to use an older C runtime

Visual Studio 2010 installs version ...4974 of the VC9 runtime whose .pdbs are unavailable. How can I force my GME.exe to use an older VC9 runtime? I've tried putting this into GME.exe.config: <?xml version="1.0"?> <configuration> <windows> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyIdentity type="w...

how to call a method with string& parameter by using char*?

I have a C++ dll from other company. there is a method with a string& msg parameter, void methodA(string& msg); What I have now is a char* with length which is big enough to take the msg from methodA. I want to call methodA to get message back from methodA. Can I do it? how? thanks, ...

MS C++ linker questions

I have a copy of MS VC++ 6.0 which I do all my development in. I have just received a DLL that has been produced by VC++ 8.0. I need to use some of the functions contained in that DLL in my application. Will I be able to use this DLL in my VC++ 6.0 development environment? ...

Sometimes my windows handle is good, sometimes it bad

I am confused. Sometimes when I initiate my window, the Handle returned is good. and sometimes its not. Here is my code void GXRenderManager::InitWindows() { WNDCLASSEX wndcex; wndcex.cbSize = sizeof(WNDCLASSEX); wndcex.style = CS_HREDRAW | CS_VREDRAW; wndcex.lpfnWndProc = GXRenderManager::WndProc; wndcex.cbCls...

failure to create a DirectX device and swapchain

I am having issues retrieving a swapchain and device from directx. further info is in the code void GXDX::StartUp(HWND* mainWindow,int w, int h) { //width and height are members of GXDX width = w; //contains the width height = h; //contains the height this->mainWindow = mainWindow; // Is a handle to the main window. i...

Visual Studio only runs code analysis on common.cpp

I tried to enable Code Analysis in my Visual C++ 9 project. When I build the project Visual Studio only compiles common.cpp, emits a set of warnings and stops without proceeding to other .cpp files. How do I make Visual Studio analyze all the .cpp files? ...