c++

C++ Base Class Design question

When i declare a base class, should i declare all the functions in it as virtual, or should i have a set of virtual functions and a set of non-virtual functions which iam sure are not going to be inherited? ...

VS2008 Express Editions and Resources

Hi all, I am wanting to add resources (such as an icon) into a WinAPI based program in VC++ 2008 EE and am struggling. As there is no resource editor bundled with the IDE, is it possible? My Google searches all seem to related to C# or other managed environments. Thanks all, ...

Throw-catch cause linkage errors

I'm getting linkage errors of the following type: Festival.obj : error LNK2019: unresolved external symbol "public: void __thiscall Tree::add(class Price &)" (?add@?$Tree@VPrice@@@@QAEXAAVPrice@@@Z) referenced in function __catch$?AddBand@Festival@@QAE?AW4StatusType@@HHH@Z$0 I used to think it has to do with try-catch me...

C++0x: a new language?

Hi all. Recently I started reading (just a bit) the current draft for the future C++0x standard. There are lots of new features, some of them already available via Boost Libs. Of course, I'm pretty happy with this new standard and I'd like to play with all the new features as soon as possibile. Anyway, speaking about this draft with ...

Best way to empty stringstream?

One of the possibilities is: somestringstream.str(""); But is it most optimal? Is there any way to preserve stringstream internal buffer, so that following operator<<() calls would not require to reserve memory again? ...

Embedding Flash in 3D-rendering binary

I want to embed Flash (2D GUI) in my 3D game C++ application, and it must be portable. Rendering Flash is not enough, I need user action callbacks. I found Hikari for Ogre3D, but I guess the technique it's based on only works on Windows? (It uses OLE.) Further, from what I've heard (unverified) CryEngine uses Flash. Almost forgot the o...

Options for web scraping - C++ version only

I'm looking for a good C++ library for web scraping. It has to be C/C++ and nothing else so please do not direct me to Options for HTML scraping or other SO questions/answers where C++ is not even mentioned. ...

Create tab blinking effect (like IM programs) using wxNotebook

How can I Create Tab blinking effect like IM programs do using wxNotebook? A good example of this is would be any tabbed IM program that blinks to show the user that they received a new IM. ...

Pros and Cons of the available Visual Studio 2008 c++ project platforms?

If choosing between: ATL Windows Forms MFC Win32 Specifically the application will be: for completely in-house use. Most users lack basic windows/pc knowledge. (consider simple UI) used for automated testing which entails:-bringing in lots of data from external equipment (can choose VXI, USB, or Ethernet)-very heavy on graphics - l...

Problem with desktops

I have this code: #define _WIN32_WINNT 0x0500 #include <cstdlib> #include <iostream> #include <windows.h> using namespace std; int main(int argc, char *argv[]) { Sleep(500); HDESK hOriginalThread; HDESK hOriginalInput; hOriginalThread = GetThreadDesktop(GetCurrentThreadId()); hOriginalInput = OpenInputDesktop(0, FA...

Avoid Deadlock using Non-virtual Public Interface and Scoped Locks in C++

I've run into a problem which seems troubling to me. It seems I've found a situation that's easy enough to work-around, but that could lead to problems if a) I have a lapse in concentration while programming or b) somebody else starts implementing my interfaces and doesn't know how to handle this situation. Here's my basic setup: I've...

Array initialization in Managed C++

I wish to declare and initialize a 1D managed array of items. If it was C# code, I would write it like this: VdbMethodInfo[] methods = new VdbMethodInfo[] { new VdbMethodInfo("Method1"), new VdbMethodInfo("Method2") }; I am trying to write (well, actually, I'm writing a program generate) the same thing in managed C++... So f...

Visual C++ Debug window displaying of CR/LF in Visual Studio 2008

For some time now when I am debugging Visual C++ applications and viewing any CString or char* (or any other ascii char based type) variable in the Local, Auto, or Watch debug windows, the CR/LF characters in my variables are not displayed at all. In other words, if I have a string variable set to "This is a line\r\nThis is another line...

How to send files b/w two machines through socket programming?

Hi, I have requirement to send all the files in the directory to a different machines, the directory may internally contain child directories. Is there any help available on this? One more doubt is: I also heard that we can send the files using FTP, if so which is the best between the two. Is there any help available for this? I nee...

What embedded browser for C++ project?

Is there any browser I could embedd in C++ application on Windows? I need all features typical browser has (HTTP client, cookies support, DOM style HTML parser, JavaScript engine) except rendering. Because I don't need rendering capability (and that's rather big part of a browser) I would prefer a browser with non monolithic design so I...

How to handle passing runtime-sized arrays between classes in C++

Right now I have a simple class that handles the parsing of XML files into ints that are useful to me. Looks something like this: int* DataParser::getInts(){ *objectNumbers = new int[getSize()]; for (int i=0;i<getSize();i++){ objectNumbers[i]=activeNode->GetNextChild()->GetContent(); } return objectNumbers; ...

Bug in Array initialization in Managed C++ (followup)

Following up from my previous question. Can anyone explain why the following code compiles without any errors: typedef array<VdbMethodInfo^> MethodArray; typedef array<VdbParameterInfo^> ParameterArray; ParameterArray^ parameters = gcnew ParameterArray { gcnew VdbParameterInfo("name", "string", "Paul")}; MethodArray^ methods = gcne...

Migrating from old Borland C++ to Visual C++ Express

At the risk of appearing a dinosaur, I have some old C++ code, compiled with Borland C++, which sets registers, and interfaces to an Assembler module, which I would like to modernize. I have just installed MS VC++ Express, and needless to say a lot of things don't work! The default seems to be Win32, which is fine, so I have blanked out...

Export a makefile from codeblocks

Is it possible to export a makefile from a c++ codeblocks project? If so, how is it done? Best Regards ...

MFC CDialog::Create fails

I'm having problems with some code to create a CDialog based window. The code was working fine last week. The only changes I made was replacing a C++ deque with a hash array. I had commented out the line of code with the Create method being called to allow me to skip loading the window. Now the code doesn't create the window at all a...