c++

Why are function declarations returning bool not compiling in my C++ project?

I'm using Visual Studio 2008 Express Edition to compile the following code in a header file: bool is_active(widget *w); widget is defined earlier as, typedef void widget; The compiler complains with the error: >c:\projects\engine\engine\engine.h(451) : error C2061: syntax error : identifier 'is_active' 1>c:\projects\engine\engine\...

C++: Dynamically access class properties

Hi, I'm wondering if it is possible to access a property of a class dynamically without knowing the name of the property accessed at run-time. To give you a better understanding of what I'm aiming at, this php code should demonstrate what I want to do: <?php $object = new object(); $property = get_name_out_of_textfile(); echo $object->...

COM calls from multiple threads

If I call the same COM function from multiple threads to an in proc COM Dll, how thread safe is that? Do all my objects in the COM DLL also need to be thread safe for this to work reliably? ...

What is meant with ellipsis and default arguments not affecting the partial ordering of function templates?

The presence of unused ellipsis and default arguments has no effect on the partial ordering of function templates. [Example: template<class T> void f(T); // #1 template<class T> void f(T*, int=1); // #2 template<class T> void g(T); // #3 template<cla...

WebBrowser Control (MFC) created in seperate thread working in Windows 7 and Vista, but Windows XP

Hello. I have CWnd in main thread, and a CWnd with a WebBrower control created in a seperate thread. This is necessary, because the WebBrowser navigates to urls which have javascripts running which will block the WebBrowser. So I with the WebBrowser control in a seperate thread I prevent the GUI Thread vom hang. Also I have done this in...

Good design to build a whole program as a FSM?

I have built a parser using a FSM/Pushdown Automaton approach like here (and it works, well!): http://stackoverflow.com/questions/3176110/c-fsm-design-and-ownership It allows me to exit gracefully and output a helpful error message to the user when something goes wrong at the parser stage. I have been wondering about a good way to get t...

C++ library for time zone handling

I'm looking for a simple C++ library that allows me to convert timezone descriptions like "America/New_York" into an offset to GMT. I'm looking for a lightweight library to add to an existing project. ...

Making UI for console application

How can I make an interface for console applications to make them look like edit.com under Microsoft's operating systems. Target languages are C, C++ and C#.NET. ...

Should I return an iterator or a pointer to an element in a STL container?

I am developing an engine for porting existing code to a different platform. The existing code has been developed using a third party API, and my engine will redefine those third party API functions in terms of my new platform. The following definitions come from the API: typedef unsigned long shape_handle; shape_handle make_new_sh...

How to Widget inside another widget in QT?

hi how to add widget inside widget i created main widget, and for the main widget headerbar come from another widget. here the code below main.cpp #include <QApplication> #include "mainwindow.h" int main(int argl,char *argv[]) { QApplication test(argl,argv); mainWindow *window=new mainWindow(); window->setWindowState(Qt:...

Get a string representation of Constant or Enum in IOKit, possible?

Hello, Is there a way to get a string representation for the Constants and enums defined in IOKit? I making a forage into IOKit and trying to console log out some parameter which USB devices return. But I'm ending up with lists of numbers. Is there another way to list what these mean? For example in IOHIDKeys.h enum IOHIDElementType ...

How to open two dialog boxes at once in C++ MFC?

Hi, Is it possible to open more dialog boxes at the same time in C++ MFC, when I press a button? How? (One for background: full-screen and semi-transparent, and one for a dialog box.) Thank you! ...

Force virtual destructors? C++

I didnt see it in the C++ Faq lite How do i define a base class so every class inheriting it is required to define a destructor? I tried running this program struct VDtor { virtual ~VDtor()=0; }; struct Test:VDtor { virtual ~Test(){} }; int main() { delete new Test; return 0; } http://codepad.org/wFcE71w3 With the error In functi...

Get interrupt counters like /proc/interrupts from code?

Hi, I may miss the obvious, but how/is it possible to retrieve interrupt counters for a specific interrupt without manually parsing /proc/interrupts from inside a C/C++ program? Thanks in advance! Best regards, Martin ...

How to rewrite the function below with ATL?

HRESULT EnumerateVideoInputFilters(void** gottaFilter) { // Once again, code stolen from the DX9 SDK. // Create the System Device Enumerator. ICreateDevEnum *pSysDevEnum = NULL; HRESULT hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, ...

Need help writing "backgroundless" widget for wxWidgets (wxGTK) using GTK2

Hi there. My question is concerned with GTK2 and wxWidgets (actually wxGTK). In wxGTK all controls have grey background by default and it is impossible to remove it. I have a textured panel with custom child controls and each of my controls has an ugly grey border which I can't remove. I can only set some background color and make the ...

How to measure distance to object given two images from two cameras set at a known distance apart

I'm looking for an open source project or library (c++, c) that can give me a method to calculate the distance to a certain object (pixel) in the image, assuming I have all the info about the cameras - The field of view, focal length, distance between cameras, etc.. ...

How to compare BSTR against a string in c/c++?

wprintf(L"Selecting Audio Input Device: %s\n", varName.bstrVal); if(0 == strcmp(varName.bstrVal, "IP Camera [JPEG/MJPEG]"))... The above reports : error C2664: 'strcmp' : cannot convert parameter 1 from 'BSTR' to 'const char *' ...

The standard Namespace problem

Hii , I am relatively new to programming C++ . I do know that the functions cout , cin etc... are defined in the standard name space . But we also include iostream header file for running the program . So , is it like namespace std { declaration of cout declaration of cin ..... some other declarations etc....

How to judge whether a project is a c or c++ project?

wprintf(L"Selecting Audio Input Device: %s\n", varName.bstrVal); if(0 == wcscmp(varName.bstrVal, L"IP Camera [JPEG/MJPEG]")) { ... } hr = CoCreateInstance(CLSID_SampleGrabber, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void **)&pGrabberF); The above is from a .cpp file ,but a...