visual-c++

CMap with string as key and structure as value

hi, My requirement is given a string as key to the map i should be able to retrive a structure. Can any one please post a sample code for this. Ex: struct { int a; int b; int c; }struct_sample; string1 -> strcut_sample ...

error LNK2019: unresolved external symbol Visual C++

I've got this MFC application i'm working on that needs to have an embedded database. so, i went on hunting for a slick,fast "embeddable" db 4 it and stumbled accross SQLite. now, i've created a DB with it, and i created a static library project with VS2k8.the library project will be used in another main project . in the library projec...

How do you add conditional breaking based on another breakpoint being hit? Visual C++

Hi, I have a bunch of generic code that is used a lot, which i'd like to poke into in order to deal with a bug in a certain specific case. So I'd like to break on a set of breakpoints only if some other breakpoint has been hit. Is there a way to do this in Visual 2005? I'm using C++ code. Thanks! ...

How to exclude MFC bar from dock state

Is there an easy way to exclude a control bar from the dock state saved by an MFC frame window? We have a dock bar whose visibility is controlled by some other state and the loading of dock state is interfering with the desired behavior. ...

Getting the current ip address from within a application (VC++ 2005)

Hi, I would like to send an email from an application that contains the current ip address of the machine. I have the email code in place and it works. I just need to add the ipaddress to the body of the email (ie I am not doing anything programmatically with the IP address). I was hoping there was a really simple way like running ipc...

Recursive nmake target

When recursively invoking nmake, via the $(MAKE) macro, how can I pass on the target specified on the command line to the new instance? So, say I execute the following from the command line: c:\nmake clean I want the recursive call to nmake to pass the 'clean' target to the new nmake instance. ...

Refresh Window in Visual C++

I've a Visual C++ project but I don't be able to refresh the window and redraw itself. I've used RedrawWindow(); m_ProgressDlg->RedrawWindow(); and also UpdateData(false); m_ProgressDlg->UpdateData(false); but never seems go well. How can I do? ...

How to handle messages from dynamically created controls in an MFC app?

Imagine I have a CDialog which creates controls dynamically when the user clicks a button. It could be like this: // We don't know which is the first id for the new buttons until runtime (!) MyDialog::MyDialog(/*whatever parameters needed*/, first_id) : next_id_(first_id) { /*...*/ } BOOL MyDialog::OnSomeButtonClicked() { CButton*...

How to compile a program using .NET Framework compilers at command line.?

Hi i want to compile a c++ program using .NET2.0 compiler. so i navigate to c:\windows\Microsoft.Netframework\2.0.57\ and uses csc compiler to compile. It shows lot of errors. But it compiles csharp file. But in visual studio it compiles. so i think that in visual studio c++ copiler installed i think so. filename test.cpp using name...

Do i need .NET framework 2.0 SDK to compile from command line with .NET based compiler

HI i write a code like filename test.cpp #include<stdio.h> void main() { printf("Hello"); } } I have .Net Framework 2.0 installed in my computer. Compiling using MSBuild.exe when i try to compile this from command line and navigated to .NET frameworl 2.0 folder using msbuild.exe it shows warning and error that VCBuild.exe not ...

Alternatives to MS strncpy_s

What are some alternatives to the Microsoft security enhanced functions such as strncpy_s or _itoa_s? Although developing in MS environment the goal is to write code that could be ported easily to other platforms. ...

convert CString to const char*

How do I convert a CString to const char* in my Unicode MFC application? ...

Ignore #pragma comment(lib, ...) ?

I'm attempting to perform a link of previously generated .obj files (using the latest version of MSVC). When those .obj's were created, the source code specified: #pragma comment(lib, ...) As such, the linker is attempting to link against static libraries specified in the source. Is there a way to instruct the linker to ignore these...

[c#, c++] Why does a compiler dislike implicitly casting to uint's?

I have run into a couple of similar quirks regarding uint usage in both C++ and C#, and now I'm wondering on the reasoning (which may be completely different for each example). For both of these examples, note that I am compiling with the warning levels set to maximum. (1) gcc complains about comparing an int to a uint in the following...

Is it possible to statically include MSVCR90.DLL in managed apps?

Here is the situation - I developed my application in VC++ 2008, using Windows Forms/Managed Code. It runs fine. However, I need it to run on a Windows 2000 machine, and, if possible, not need any additional DLLs/installs aside from the 2.0 framework. I looked around, and most of the answers I got were about not needing MSVCR90.dll on ...

Managed C++ - Importing different DLLs based on configuration file

I am currently writing an application that will serve a similar purpose for multiple clients, but requires adaptations to how it will handle the data it is feed. In essence it will serve the same purpose, but hand out data totally differently. So I decided to prodeed like this: -Make common engine library that will hold the common funct...

OpenMP in Visual Studio 2005 Standard

I have used OpenMP with gcc for writing parallel code. I am now using Visual C++ 2005 and am trying to figure out how to use OpenMP. There is a compiler option in the Properties->C/C++/Language menu but then it complains the library is missing. Is there a 3rd party implementation for OpenMP or am i just configuring Visual C++ incorrectly...

Memory allocation in VC++

I am working with VC++ 2005 I have overloaded the new and delete operators. All is fine. My question is related to some of the magic VC++ is adding to the memory allocation. When I use the C++ call: data = new _T [size]; The return (for example) from the global memory allocation is 071f2ea0 but data is set to 071f2ea4 When overlo...

Drawing on ActiveX control

I've created an ActiveX control using Microsoft Visual C++ and I know I can use the CDC object provided on the onDraw method to draw on it, but these are raster graphics which don't look good. Is there a vector drawing api which I could use? ...

Passing double-byte (WCHAR) strings from C++ to Java via JNI.

I have a Java application that uses a C++ DLL via JNI. A few of the DLL's methods take string arguments, and some of them return objects that contain strings as well. Currently the DLL does not support Unicode, so the string handling is rather easy: Java calls String.getBytes() and passes the resulting array to the DLL, which simply ...