visual-c++

Most portable and reliable way to get the address of variable in C++

Using & to get an address of a variable can be problematic if the variable type has overloaded operator&(). For example, _com_ptr_ has operator&() overloaded with a side effect of modifying the object. Now I have a complicated set of templates with functions like this: template<class T> void process( const T* object ) { //whatever ...

Using Regular Expression in VC++

Hi , I am finding Email ids in mu project, where I am preprocessing the input using some Regular Expression. RegExpPhone6.RegComp("[\[\{\(][ -]?[s][h][i][f][t][ -]?[+-][2][ -]?[\]\}\)]"); Here while I am compiling i am getting a warning msg like Warning 39 warning C4129: ')' : unrecognized character escape sequence How can i...

To Convert MicrosoftOffice Docs+PDF+Images++Audio/Video into Swf file

HI, I want to convert MicrosoftOffice Docs(.doc,.docx,ppt,xlsx,xls) +PDF+Images++Audio/Video into an swf file. The idea behind this project is to open the documents on any machine which have a flash plugin. I want to do this in VC++. ...

Is it possible to implment a COM interface without creating a custom interface?

I am learning c++ and I am trying to better understand it. I was reading the msdn documents on how to use xml lite. it said that I must use a class that implements the IStream interface. It said to declare and instantiate my class that extends Istream and use CComPtr when declaring the varible. then it showed me the following. CComPtr<I...

visual C++ express 2010 and setting env variables solution wide

Hello, I'm C++ dev migrating to visual 2010 c++ from vim/g++. Here blog I've read that VC++ directories are no more and that I should use property pages in vs 2010 but I don't know how... Here is what I need to do. I have w solution (50 projects strong) and all of them use boost, pthreads, xercesc and few other libs. I have env variables...

Best tools for analyzing dll loads conditions in Visual Studio for C++

I am using Visual Studio 2008 to run an application, which loads a number of DLL's at startup, that immediately exits with "The program '[3668] cb_tcl.exe: Native' has exited with code -1072365566 (0xc0150002)." Unfortunately I get no other clues about the source of the problem and the exit occurs before the program starts, but I suspec...

Displaying byte values in the picturebox control

Hi, i am currently working on a project which deals with the reading of satellite images of ".0FM" format and its size is around 8Mb. Now i have been successful in converting the file("*.0FM") content into a byte array. Now the byte array has integer values ranging from 0 - 255. I have to display this byte array in a picturebox control....

How to generate .sln/.vcproj using qmake

Hi! I have main.cpp in c:\test folder and do the following: qmake -project qmake -tp vc test.pro The answer is: WARNING: Unable to generate output for: C:/test//Makefile.Debug [TEMPLATE vcapp] WARNING: Unable to generate output for: C:/test//Makefile.Release [TEMPLATE vcapp] But, I don't need make files. I need .vcproj! Environme...

Problem using static library project in WinForm

I have a third party sample sdk havind static library objects and header files in two folders. I have made my own static library project and referred them, after adding my own code i build the project and it succeed. Now i added another project in the same solution but of windows form type. Now when i just add the header file of my class...

Does function-level linking in VC++ have any negative effects?

Visual C++ has function-level linking. Looks like it's a great thing - it can reduce the size of generated executables. Does it have any negative effects? Will I have to pay anything for the advantages of this option or can I just turn it on and enjoy the benefits? ...

Check if writing to a file is finished

Hi, I am currently writing a plugin in C++. For my functionality I ask the API to save out a file. The API gives me a return value when the file is written... or so it seemd. The problem is, that this return value is returned too early so that I can not be sure, that the file is written completely. Is there a possibility of checking t...

visual c++ rc.exe

hello i have a problem i use visual studio 2008, and i chose a .cpp in visual c++ at first i copied a tutorial sample #include <stdio.h> int main() { int x=1; int n =1; printf("Wie viele Zahlen wollen sie ausgeben lassen?: "); for(int i=0; i < n; ++i) { x*=i; // x=x*i printf("%d: %d\n", i, x); } return 0; } but i get ...

Weird C++ compilation problem under Visual Studio 2008

Hi, There was a program what I could compile under 2008 for a while. Note I can compile the program using cl and in Ultimate++ IDE. It is a fairly large program , so I am not going to post it here. I cannot compile it in Studio. THere error is 1>c:\program files\microsoft visual studio 9.0\vc\include\xstring(1735) : error C2856: #pra...

error C2065: 'AfxBeginThread' : undeclared identifier

I have a simple ATL Service in which I have included the following statement. AfxBeginThread(WorkerThread, this, THREAD_PRIORITY_NORMAL, 0, 0); But the compiler complains that error C2065: 'AfxBeginThread' : undeclared identifier But in MSDN i found that AfxBeginThread is found in AFXWIN.H If I include AFXWIN.H, the compiler...

Extracting rgb color components from integer value

Hi, if there is an integer value, eg. 86 then how can i extraact the r,g,b components from this integer value....? I am working on Visual C++ 2008 express edition. Thanks.. ...

Visual C++ static library

I am writing a c++ static library A.lib in visual studio 2008. In my static library, I am using few APIs exposed by another static library B.lib(.lib). I have a written an application that uses A.lib. Since few header files in A.lib are using headers from B.lib, my application wants a path of B.lib header files. How can I avoid my appli...

I'm getting error C2664 on some I/O code.

void BinaryTree::InitializeFromFile(string Filename){ ifstream inFile; inFile.open(Filename, fstream::binary); if(inFile.fail()){ cout<<"Error in opening file "<<Filename; return; } for(int i=0;i<=255;i++) Freq[i]=0; char c; inFile.get(c); while(!inFile.eof()){ Freq[c] ++; inFile.get(c); } } HuffmanTree.cpp(...

properly implmenting Dll's and libs in VC++

I want to get this straight. I know what DLL's are. I have done research on them. they are like executable except they can not be access directly. Their main purposes are to provide additional resources such as functions and variables for your application. What I do not understand is. Do you have to include the header for both libs and ...

Create derived class instance from a base class instance without knowing the class members.

Is this scenario even possible? class Base { int someBaseMemer; }; template<class T> class Derived : public T { int someNonBaseMemer; Derived(T* baseInstance); }; Goal: Base* pBase = new Base(); pBase->someBaseMemer = 123; // Some value set Derived<Base>* pDerived = new Derived<Base>(pBase); The value of pDerived->someBase...

How does function-level linking propagate in VC++?

When I use function-level linking in VC++ for a simple project it's more or less clear how it works. But what if I build an executable that depends on a static library and both are compiled with VC++? For example, if the static library had function-level linking enabled and the executable has it disabled or vice versa - how will it work...