visual-c++

Conditional compiling according to VC++ compiler version

I am in the process of migrating our VC++ project from Visual Studio 2005 (VC8) to Visual Studio 2008 (VC9). Some of the projects in the solution have paths to third party libraries in their 'Additional Library Directories' field in the project settings. The paths look something like this: ..\SomeLibrary\Lib\vc9\x86 It would be really u...

How to code a responsive progress bar that uses callback functions?

I have this progress bar that uses callback functions from a third party driver, to display a traditional progress bar in a window called CFProgress. CFProgress *cFM=new CFProgress(); theApp.m_cFM = cFM; cFM->Create(CFProgress::IDD); cFM->ShowWindow(SW_SHOW); thirdpartydriver->set_OnProgress(ProgressFuncC, (void *) cFM); thirdpartydrive...

Can I use std::basic_string with things that aren't character types?

I've got a loop in my code that uses std::basic_string<HANDLE>, and then waits on it like this: DWORD dwWaitResult = WaitForMultipleObjects((DWORD)handles.size(), handles.data(), FALSE, POLL_INTERVAL_MS); It works fine, but when I turn on /W4 and /...

No-MFC equivalent of AfxGetThreadState in vc++

Hi; I am porting a MFC application to Win32 one, I need to get AfxGetThreadState()->m_lastSentMsg value in Win32, I searched but could not find anything, your help is appreciated. ...

Statically linking against library built with different version of C Runtime Library, ok or bad?

Consider this scenario: An application links to 3rd party library A. A is built using MSVC 2008 and is statically linking (ie. built with /MT) to the C Runtime Library v9.0. The application is built using MSVC 2005 and is statically linking to A and (using /MT) to the C Runtime Library v8.0. I can see trouble with this - for instance ...

Create thread with specific privilege c++

hello I have multi-thread application that I want to create a thread with different user privilege (for example : multi domain admin privilege). but I can't find any Win32 API CreateThread to do that. How to create thread with specific user privileges? thanks. ...

How to get started with game programming using VC++,C++,DirectX quickly?

Hi I am working in VC++ and I am quite interested in game programming and I have few queries. 1).What one must know before starting game programming ? 2).Can anybody give me info @ resources like tutorial ,links ,etc. which would help me to start as fast as possible ? 3).Also give me info @ some good books on game programming ? Any h...

How to use GNU gettext with MS Visual C++?

Is it possible to use GNU gettext with MS Visual C++? Does someone know where to find a sample project that compiles under Visual C++? Update: Thanks to Sorin Sbarnea for his comments which help me to put all the pieces together: I'm used to the Delphi version of gettext where you simply compile the unit gnugettext.pas with your projec...

Best place to store reference directories for unit tests in boost?

I'm trying to write a library which unzips a zip file contents to an existing directory, replacing the content of only the folders which exist in the zip file. In order to do this I am employing the use of the Boost Unit Testing framework. Before each test I wish make a copy of an existing directory, the copy of which will serve as the...

Problem with class template specialisations

I'm trying to port some code from VC9 to G++, however Ive run into a problem with template specialisations apparently not being allowed for class members. The following code is an example of these errors for the getValue specialisations of the class methods. In all cases the error is "error: explicit specialization in non-namespace scop...

Why am I getting an assertion error?

#include <iostream> using namespace std; int main () { int size = 0; int* myArray = new int [size + 1]; cout << "Enter the exponent of the first term: "; cin >> size; cout << endl; for (int i = size; i >= 0; --i) { cout << "Enter the coefficient of the term with exponent " << i << ": "; cin >> myArray[i]; } for (int i =...

Socket communication on a machine with more than 1 IP address

I have a service which listens for incoming connections on a TCP\IP port number say 7000. Also my machine is having more than 1 NIC cards and more than 1 IP address.( in other words i am having 2 LANs, LAN and LAN2 and 2 Ips). Now I have configured my client application(in another machine with only 1 IP) to establish a connection to my ...

visual c++ include and link libraries

I have a old install of visual c++ 6.0. I'd like to bring things more nearly up to date particularly for include files. Here is a list of what my TOOLS->OPTIONS->DIRECTORIES->INCLUDE FILES shows... c:\program files\microsoft visual studio\vc98\include c:\program files\microsoft visual studio\vc98\mfc\include c:\program files\microso...

Bold labels in MFC

I want to create labels in MFC (Static text) that have both bold and non-bold text. Something like this: "I would like my label to look like this, for example" Any thoughts of how to do this? I know that I can change the font of the entire label and have it either bold or not, but is there any way of merging more than one style, o...

Issues with C++ template arguments for inheritance

Dear developers, I have a questions about C++ templates. More specifally, by using template arguments for inheritance. I am facing strange behaviour in a closed-source 3rd party library. There is a C method factoryReg(const char*, ICallback*) which allows to register a subclass of ICallback and overwrite the (simplified) methods: cl...

How to resolve linking error for GetSystemMetrics()?

I'm attempting to use the following to get the height & width of the main display: #include <winuser.h> size_t width = (size_t)GetSystemMetrics(SM_CXBORDER); size_t height = (size_t)GetSystemMetrics(SM_CYBORDER); However, it's failing on an unresolved externals link error (LNK1120). I've tried linking to user32.lib (as documented here...

Prevent MSVC from creating debug symbols by source code pragma?

While compiling a large c++ program with msvc .net 2003 and with debug information, I ran into C1067, the fatal compiler error for to big or to large debug symbols. As it is in boost, and I don't want to fiddle around with the source code, the easiest thing would be, if there is a pragma or something that could switch off the generation ...

how to hook control closing in an MFC custom control class

I am interested in allocating pointers, storing those in the LPARAM data of a comboboxex control, and making that control responsible for deleting those pointers when it is destroyed. Since I am working in MFC, I can subclass a CComboBoxEx, and add either a message handler or a virtual member function. The question is: Is this pattern ...

How to enter Text other than english and process the entered text

I have a doubt is it possible to give text other than English in my latest project I need to support Hindi ,Tamil and French so if user selects language as Hindi or Tamil or French so what ever value the user is giving in the textbox it must be displayed in the corresponding language selected . My Programming environment is vc++ ...

How do I implement layer with GDI?

I want to implement a rubber function just like photoshop, but I hope the rubber just to erase the shapes that drawed on background without modifying the background. Now the background is a image so I can't use the brush with the single color. ...