c++

Qt: How can I access the actual widgets on a page in WebKit?

Is there a way to access the widgets generated by INPUT and SELECT on a page in WebKit, using Qt? On a related note, does WebKit provide these widgets, or does it delegate back to Qt to generate them? ...

TinyXML and fetching values

Hello, I'm trying to load data from xml-file with TinyXML (c++). int height = rootElem->attrib<int>("height", 480); rootElem is a root element of loaded xml-file. I want to load height value from it (integer). But I have a wrapper function for this stuff: template<typename T> T getValue(const string &key, const string &defaultValue ...

IWebBrowser2: how to force links to open in new window?

The MSDN documentation on WebBrowser Customization explains how to prevent new windows from being opened and how to cancel navigation. In my case, my application is hosting an IWebBrowser2 but I don't want the user to navigate to new pages within my app. Instead, I'd like to open all links in a new IE window. The desired behavior is: use...

C++ STL: Trouble with iterators

I'm having a beginner problem: bool _isPalindrome(const string& str) { return _isPalindrome(str.begin(), str.end()); // won't compile } bool _isPalindrome(string::iterator begin, string::iterator end) { return begin == end || *begin == *end && _isPalindrome(++begin, --end); } What am I doing wrong here? Why doesn't str.begin(...

How to set global hook for WH_CALLWNDPROCRET ?

Hello I want to set global hook that tracks which application is active. In my main program I am doing the foloowing : HMODULE mod=::GetModuleHandle(L"HookProcDll"); HHOOK rslt=(WH_CALLWNDPROCRET,MyCallWndRetProc,mod,0); The hook procedure which is called MyCallWndRetProc exists in separate dll called HookProcDll.dll. The hook proc...

How can I have a Foo* iterator to a vector of Foo?

If I have a class that contains a std::list<Foo> and which has public methods begin() and end() to return iterators for that list, how can I implement additional methods to return iterators to a std::list<Foo*>, preferably without using boost? I'd rather not maintain a parallel container of pointers. Edit: I have a large code base tha...

Can I use #undef this way?

I want to get some settings I store in the registry, and if they differ from a #define I want to redefine it, could I do it this way?: #define DEFINED_X "testSetting" void LoadConfig() { regConfigX = some value previusly stored in the registry; if(regConfigX!=DEFINED_X) { #undef DEFINED_X #define DEFINED_X r...

C++ STL: Trouble with string iterators

I'm making a simple command line Hangman game. void Hangman::printStatus() { cout << "Lives remaining: " << livesRemaining << endl; cout << getFormattedAnswer() << endl; } string Hangman::getFormattedAnswer() { return getFormattedAnswerFrom(correctAnswer.begin(), correctAnswer.end()); } string Hangman::getFormattedAnswerFr...

Win32 DLL importing issues (DllMain)

I have a native DLL that is a plug-in to a different application (one that I have essentially zero control of). Everything works just great until I link with an additional .lib file (links my DLL to another DLL named ABQSMABasCoreUtils.dll). This file contains some additional API from the parent application that I would like to utilize. ...

how a thread can signal when it's finished?

#include <iostream> #include <boost/thread.hpp> using std::endl; using std::cout; using namespace boost; mutex running_mutex; struct dostuff { volatile bool running; dostuff() : running(true) {} void operator()(int x) { cout << "dostuff beginning " << x << endl; this_thread::sleep(posix_time::seconds(2)...

Include pdbs in installer?

Is there any reason to not include pdb files in an installer? I have C++ logging functionality that walks the stack, and reports line numbers and file names. It would be great if my customers could send me logs with this information. However, they would need the pdb files. Is there any downside (other than installer package size) to depl...

Creating a "mountable" File System, where to start?

A friend and I are thinking about creating a simple file system for learning purposes. We're going to write it in C/C++, and try to get it to a mountable state from within linux. We've both been coding or over 16 years (32 combined), so I suppose its just a matter of finding some documentation, and a ton of learning. My question is, w...

In C or C++, is there a way to extend a class without inheritance?

Is there a way to implement functionality like Class Categories (of Objective-C) or Extension Methods (of C# 3.0) in C and/or C++? ...

C++: Templates for static functions?

I have a static Utils class. I want certain methods to be templated, but not the entire class. How do I do this? This fails: #pragma once #include <string> using std::string; class Utils { private: template<class InputIterator, class Predicate> static set<char> findAll_if_rec(InputIterator begin, InputIterator end, Predicate ...

Enums, Constructor overloads with similar conversions.

Why does VisualC++ (2008) get confused 'C2666: 2 overloads have similar conversions' when I specify an enum as the second parameter, but not when I define a bool type? Shouldn't type matching already rule out the second constructor because it is of a 'basic_string' type? #include <string> using namespace std; enum EMyEnum { mbOne, mb...

I would like to add 2 arbitrarily sized integers in C++. How can I go about doing this?

I would like to add 2 arbitrarily sized integers in C++. How can I go about doing this? ...

Arabica's documentation (XML and HTML processing toolkit)

Beyond the doxygen file and the code examples, is there some documentation or tutorials for Arabica ? I just can't find anything. Update I gave up on Arabica. In the mean time I've also tried Xerces, the doc is better but the interface is just awful. So I settled on rapidXML and I'll look into pugixml later. ...

When does a const return type interfere with template instantiation?

From Herb Sutter's GotW #6 Return-by-value should normally be const for non-builtin return types. ... Note: Lakos (pg. 618) argues against returning const value, and notes that it is redundant for builtins anyway (for example, returning "const int"), which he notes may interfere with template instantiation. While Sutte...

Win32 select/poll/eof/ANYTHING!?!?!

Using the standard Win32 file I/O API's (CreateFile/ReadFile/etc), I'm trying to wait for a file to become readable, or for an exception to occur on the file. If Windows had any decent POSIX support, I could just do: select(file_count, files_waiting_for_read, NULL, files_waiting_for_excpt, NULL, NULL); And select will return when the...

Embeddable unit testing framework for mixed Windows app

I want to test portions of a very complex app which includes both a major native Windows component and a substantial WPF GUI. Due to complexities I can't detail, it is impossible to run the native portion independently nor can I isolate the areas I want to test (spare me the lectures, we're talking a huge legacy code base and we do have ...