c++

CStatusBarCtrl GetItemRect XP Manifest

When using a CStatusBarCtrl in MFC I use GetItemRect to get the bounds of each item within the CStatusBar. However I am seeing a problem now I use an XP manifest in the exe. That it will not return a correct rectangle so I no longer identify correctly when the mouse is in the far right of the control. The problem can be tested with a m...

how does array[100] = {0} set the entire array to 0?

How does the compiler fill values in char array[100] = {0};? What's the magic behind it? I wanted to know how internally compiler initializes. Thanks in advances. Looking more such sorts of tricks. ...

Advantage of porting vc6 to vc2005/vc2008?

I was asking my team to port our vc6 application to vc2005, they are ready to allot sometime to do the same.Now they need to know what is the advantage of porting. I don't thing they really understand what does it mean to adhere to standard compliance. Help me list out the advantage to do the porting. Problem I am facing are 1)No deb...

Supporting GPL based plugins.

I'm working on a C++ gStreamer 'like' engine that, at some point in the future, I'd like to make some money out of (wouldn't we all!). After many hours reading up on the GPL licence, I still can't find a real answer to the implications of 'supporting' a plugin that is covered under the GPL. Since I'm only producing an engine that does ...

unresolved external symbol _CLSID_ScenicIntentUIFramework with GUID

I'm trying to build a ribbon app in visual studio and I got that linker error. After looking through the headers, I noticed that CLSID_ScenicIntentFramework is defined as extern const CLSID. The think is, I can't seem to figure out which library I need to link to (or other header i need to import?). I'd really appreciated some help too....

why bit-fields for same data types have less in size compared to bit-fields for mix-data types

I am curious to know why bit fields with same data type takes less size than with mixed data types. struct xyz { int x : 1; int y : 1; int z : 1; }; struct abc { char x : 1; int y : 1; bool z : 1; }; sizeof(xyz) = 4 sizeof(abc) = 12. I am using VS 2005, 64bit x86 machine. A bit machine/compiler level answe...

Need help to display Japanese Text using GDI+ without installing East Asian Language pack in Windows XP

I am writing a Japanese language quiz program and I don't want to require people to install the East Asian language pack for Windows XP. I am using GDI+ for drawing text. I tried downloading a free Unicode font and using that to draw text. I tested it on my computer (with East asian pack installed) and it displayed the Japanese charac...

How to initialize nested structures in C++?

Hi, I have created a couple of different structures in a program. I now have a structure with nested structures however I cannot work out how to initalize them correctly.The structures are listed below. Btw, thanks in advance for reading my post or posting an answer :-) : /***POINT STRUCTURE***/ struct Point{ float x; //x ...

A weird memory leak problem

I use an ActiveX control which is just a HTTP handler. It sends out an HTTP request, gets the response and fires an event to the user. When the user is not requesting the ActiveX control is pretty much dormant. It just waits for a user request to send another HTTP request. As long as the window in which the OCX resides does not change (...

How to initialize a IMimeMessage object from IStream

Given an empty MimeMessage created with e.g. MimeOleCreateMessage function, how can I initialize it from an IStream / data buffer, which contains the complete message text? ...

What version of GNU GCC supports the TR1 extern templates?

What is the earliest GNU GCC (g++) version to support the TR1 extern templates? For example, is it already supported in version 4.0? ...

Function-LeveL Linking (/Gy switch in VC++) - What is it good for?

What is there to gain from the use of this switch in a large VS solution (200 VC projects)? From what I understand this mainly effects the size of the resulting binaries; but aside from smaller binaries, could FLL also help in reducing dependencies between projects? How does FLL usually effect build times? I'd also appreciate an educa...

How do you get the ip address from a remote machine?

I'm writing c++ code that I need to run on both windows and linux and I'm looking for a function call that will return the ip address of the box the app is running on. Is there such one? ...

Where can I find a ZwCreateFile example for C++?

I am looking for an example to read an already opened COM port, the only thing that I have found is an application called PORTMON that refers to a method called ZwCreateFile. ...

Material on Software design and architecture

I am trying to compile a good library [within a company] on software design and architecture. I have looked at few posts on Stack Overflow, assuming this sort of question is very popular, however the best I found was Best books to learn about design, and it talks about graphic design, which is NOT particularly helpful to me. We are de...

Store pointers to member function in the map.

I'd like to map string to an instance member functions, and store each mapping in the map. What is the clean way of doing something like that? class MyClass { //........ virtual double GetX(); virtual double GetSomethingElse(); virtual double GetT(); virtual double GetRR(); //........ }; class Processor { private:...

C++ errors in code

I have this code (question from exam) and there are many errors in the code, here is the code: class A { int z; static int y; public: A() {(*this).incrementY();} int x () { y=y+2; return z;} static int getY(){ return z;} void incrementY() {y++} }; class B: A { public: B (): A() {(*this).incrementY()...

Pure virtual destructor in C++

Is it wrong to write: class A { public: virtual ~A() = 0; }; for an abstract base class? At least that compiles in MSVC... Will it crash at run time? ...

Changing image of a menu button in a CMFCToolbar

Hello, I have a menu button inside a CMFCToolbar and I would like to replace the bitmap of the button each time a different entry is selected in the menu as each entry has its own icon. I succeed in changing the icon using CMFCToolBarMenuButton::SetImage but it changes the icon in the menu entry too... Too bad. Here is a sample...

Why param needs two arguments in following case:

I am sort of confused by this: istream_iterator<string> ii(is); istream_iterator<string> eos; vector<string> param (ii, eos); ...