c++

Should I 'delete' this CDC?

Folks, I'm trying to track down an intermittant bug that's showing up on site. I've a feeling it's in some GDI code I'd to cobble together to get a tally printer working. I'm connfused over how to delete this CDC, my code looks OK to me, but is this correct. // Create a device context for printing CDC* dc = new CDC(); if(! dc-...

C++ Header Guard issues

I am making a small C++ framework, which contains many .h and .cpp. I have created a general include which include all my .h file such as: framework.h #include "A.h" #include "B.h" #include "C.h" each .h header are protected with include guard such as #ifndef A_HEADER #define A_HEADER ... #endif The issues is, I would like to be...

Call a function when "event.GetFrom(m_cpVoice)==S_OK" (ergo when event happens) [SAPI 5.1 and C++]

Hello, I'm doing a project with a 3D model, that speaks. So, I'm using SAPI 5.1, and I want to call a function asynchronously when there's a Viseme event (in order to play the animation related to). How could I do it? Thank you very much. Note: I use : hRes = m_cpVoice->Speak(L"All I want is to solve this problem", SPF_ASYNC , NULL...

C++, Searching and returning value.

For example, lets say I have this string: "Name, Name2, <b>Name3</b>, Name4, <b>Name5</b>" I am trying to get whatever value / name is inside the <b> tags. So when I search the char, I get the following in an array: Name3 Name5 Any ideas? Thanks ...

IE Address bar search. I need to grab what the user types to offer him added results.

Is there a way to grab (in real time, like a onKeyPressed, return what is pressed) what the user types in the address bar. Currently in IE, it offers you a matching list from history depending of what you type. I'm looking for a way to get some sort of handle to the address bar and then listen to what the user is typing. I'm doing a BHO(...

alternative for jasperreport in c++

hi, from a c++ program i need to print a simple label. the label contains a text, an image and a barcode.(in my project the label is more complex, this is just for example) my customer need a way to customize che label layout. in the past in java I solve this problem using a report created with jasperreport. my customer customize the r...

C++ hash table w/o using STL

I need to create a hash table that has a key as a string, and value as an int. I cannot use STL containers on my target. Is there a suitable hash table class for this purpose? ...

what happens when you copy vector<boost::share_ptr> to another vector

Do we get multiple copies of the pointers yet the data members are still being shared? boost::shared_ptr<string> a1(new string("Hello")); vector<boost::shared_ptr<string> > a; a.push_back(a1); vector<boost::shared_ptr<string> > b; b = a; cout<<a[0]->c_str()<<b[0]->c_str()<<endl; a1->append(" World"); cout<...

What am I calling?

Is there a way to check inside a fnc what is this fnc name? I'm working currently on LargeInt class and I've realized that code for oparator> and operator< is almost identical so I would like to know what operator is calling me and react accordingly. Thank you. ...

c++ : list(vector) definition with array

I have Class Email, there is parameter "bcc" in her constructor. Its actually list of emails for copies. There is no fixed number of these emails and later i have to have possibility to extend this list. //constructor prototype Email::Email(vector<string> bcc) So i want to use type vector or list for that and function push_back(). H...

C++ performance of global variables

For clarification: I know how evil globals are and when not to use them :) Is there any performance penalty when accessing/setting a global variable vs. a local one in a compiled C++ program? ...

Is is possible to make a shaped, alpha-blended dialog?

I'm making a non-rectangular dialog, modelled over an image from Photoshop (the image is the background of the dialog, and the user will see trough the transparent part of the image). I'ts like a dashboard-style window for a media-app with a few custom-drawn controls. Most of the background-image is either opaque or 100% transparent - bu...

Const Functions and Interfaces in C++

I'll use the following (trivial) interface as an example: struct IObject { virtual ~IObject() {} virtual std::string GetName() const = 0; virtual void ChangeState() = 0; }; Logic dictates that GetName should be a const member function while ChangeState shouldn't. All code that I've seen so far doesn't follow this logic, though...

Performance when accessing class members

I'm writing something performance-critical and wanted to know if it could make a difference if I use: int test( int a, int b, int c ) { // Do millions of calculations with a, b, c } or class myStorage { public: int a, b, c; }; int test( myStorage values ) { // Do millions of calculations with values.a, values.b, values.c } ...

C++: Filling vector from the pipe.

Hello, I would like to fill my vector<float> from command line: more my.txt | myexe.x > result.txt What is the best way to open the pipe in C++? Thanks Arman. ...

What does IUrlHistoryStg::BindToObject Method do ?

I'm looking for a way to access the address bar search so that i can append some personnal url at the end of the current list, and i found 'IUrlHistoryStg::BindToObject' but there is no documention linked to it. Anyone knows what this method does ? On msdn: http://msdn.microsoft.com/en-us/library/aa767718%28VS.85%29.aspx ...

How to generate a LONG guid?

I would like to generate a long UUID - something like the session key used by gmail. It should be at least 256 chars and no more than 512. It can contain all alpha-numeric chars and a few special chars (the ones below the function keys on the keyboard). Has this been done already or is there a sample out there? C++ or C# Update: A GUI...

C++ arrays as function arguments

Can I pass arrays to functions just as I would do with primitives such as int and bool? Can I pass them by value? How does the function know of the size of the array it is passed? ...

C++ boost::lambda::ret equivalent in phoenix

hello. Boost lambda allows to overwrite deduced return type using ret<T> template. I have tried searching for equivalent in phoenix but could not find one. Is there an equivalent in phoenix? I know how to make my own Replacement but I would rather not. thank you ...

What is the problem with this code?

#include<stdio.h> class A { public: int a;}; class B: public A { public: static int b; B(){ b++; printf("B:%d\n",b); } }; int main() { A* a1 = new B[100]; A* a2 = new B(); return 0; } Error: In function `main': undefined reference to `B::b' undefined reference to `B::b' undefined referenc...