MFC on the form create an event

I have simple FMC dialog form. Can't find how to manage event that should be called on form create moment. Something like onFormCreate like it is in VB or Delphi. How to create such functionality? My simple form header: #pragma once // CMFCApplicatio

How should I delete objects in a vector

I am making a program that uses an std::vector to hold a bunch of objects. std::vector<Ball> balls; for (int i = 0; i < ball.size(); ++i){ if (...some condition...){ //How should I delete balls[i] } If I did this std::vector<Ball> balls; //

In VS2010, error VC ++ LNK 2019 with CoolProp 5.0.0

I am an amateur VC++ developer. I want to use CoolProp ( in my academic VC++ project as a static library in a win 32 app using a VS2010 Ultimate running in x64 laptop machine. So i have downloaded , 1.CoolProp.lib from http:/

Is the result of a distribution a value?

Let int a = 0; Then is (int)a an rvalue in standard C++? Different compilers show different results for this code: #include <iostream> using namespace std; void f(int& x) { cout << "l value" << endl; } void f(int&&

Visual Studio c ++ static analysis plugin for sonar feed

Is there any way to feed visual studio static analysis on c++ code base into sonar? ThanksDid you check out the VSSonarExtension? Some hints on how to use it your can find here. Update: The other way around there may be a plugin by jmecosta called VS

if the instructions are based on the user input

I am trying to use different if statements based on user input. However it only seems to use the final set. any help would be great thanks. char type[20]; double weight; double feed; cout<< "Enter horse type: "; cin>>type; cout <&

The sequence returns 49 but should return 36

The following code is designed to specifically return the value 36 instead it returns 49 but can't see how or why. Any help would be appreciated. #include "stdafx.h" #include<stdio.h> #include<stdlib.h> #define MUL(a,b) a*b #define A

Type of MFC member variable

I have MFC dialog that contains Edit Text control. With form wizard I have generated m_edit variable for this control. Variable type is CEdit. How to get string value from m_edit? I found in some samples from internet that member variable might be CS

access __m128 fields through compilers

I've noticed that accessing __m128 fields by index is possible in gcc, without using the union trick. __m128 t; float r(t[0] + t[1] + t[2] + t[3]); I can also load a __m128 just like an array: __m128 t{1.f, 2.f, 3.f, 4.f}; This is all in line with gc

Is Vptr ever located at the beginning of the object?

According to MSDN, __RTDynamicCast() function is used to implement dynamic_cast in Visual C++. One of its parameters is LONG VfDelta that is described as "offset of virtual function pointer in object". AFAIK the vptr is always located at start o

LNK1104 Error in Visual C ++ 2010

I keep getting this comiler error. Compiling was working and then just suddenly stopped and is giving me this error and warning: 1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppClean.targets(74,5): warning : Access to the path 'C:\Us

What is the main difference between C ++ and C ++. NET?

Possible Duplicate: What is the difference between Managed C++ and C++/CLI? What is CLI/C++ exactly? How does it differ to 'normal' c++? I am in doubt of distinguishing between C++ and C++.NET. Is that right C++ is unmanaged code and C++.NET is manag

Why is the C4062 Visual C ++ warning disabled by default?

According to MSDN, Visual C++ can emit C4062 warning when and enumeration is used in switch and there's no label for at least one element of that enumeration and there's no default: label in the switch Now to me such situation certainly deserves a wa

Visual Studio C ++ IntelliSense problem

I seem to be having two issues with my project after I converted from VS 2005 to VS 2010. IntelliSense: command-line error: invalid macro definition: _WIN32_WINNT>=0x0501 And I also cant seem to be able to do a "Call Hierarchy" on any of the

Why cvWaitKey (0) does not work?

I'm not sure why, but for a mysterious reason my c++ application doesn't wait anymore when it reaches cvWaitKey(0) it just passes this line, like this function doesn't do anything! I also tried cvWaitKey(100000) it doesn't work either... void main()

support for each loop in the classes

how can i add "for each" support for my class in c++0x and visual studio 2010?I think the best way would be to add iterator support, with begin() and end() functions. The ranged-based for-loop uses them, and this also gives your class the richer

How to structure an application framework

I want to write something that will take care of: If possible the int main() loop, as in, I want the code for the main function located in this file Some mundane tasks like creating windows, initializing various things like opengl, opencv and what no

Incomplete type of memory leak?

Microsoft Visual Studio 2008 is giving me the following warning: warning C4150: deletion of pointer to incomplete type 'GLCM::Component'; no destructor called This is probably because I have defined Handles to forward declared types in several places

Unable to launch the work program from Visual Studio IDE

If I start my self written app from the explorer it works fine. If I try to start it in visual studio(F5), it crashes at some point. It is also not dependant on the working directory! It is quite annoying, because I cannot debug that way. (I could tr

How to call C ++ functions from a Lua script?

I'm using Visual Studio 2005. ------------------------[ luapassing.cpp ]-------------------- #include "lua.h" static int myCfunc (Lua_State *L){ double trouble = lua_tonumber(L,1); lua_pushnumber(L,16.0 -trouble); return 1; } int luaopen_luapass

c ++ string insertion error

WordChosenDuplicate.insert(0,WordChosen.length," _ "); cout <<WordChosenDuplicate<< endl; I get the following error when I try to run this code error C3867: 'std::basic_string<_Elem,_Traits,_Ax>::length': function call missing

How to detect VC ++ 2008 redistributable?

Is there a Registry setting that I can look for to determine whether or not the Visual C++ redistributable is installed, whether standalone or as part of Visual Studio 2008? I know that I could launch the VC++ 2008 redistributable installer and let i

Why can not I debug my web application?

When I add a breakpoint and hit F5 to run in the debugger (I am using my debug build), a dialog pops up telling my my web.config file does not have debug=true in it (which is does) and I get 2 choices a) run without the debugger or b) let visual stud