c++

How to add padding bytes to a bitmap?

Lets say I have some raster data I want to write to a file.. Now I want to write it as a bmp file.. This data happens to be not DWORD aligned, which, if I understand correctly, needs to be padded with enough bytes to reach the next DWORD.. However, when I try to pad it with this code: bmFile.Write(0x0, (4-(actualWidth%4))); I get an...

What is the best open source example of a lightweight Windows Application?

I would like to learn how a program can be written and installed without the use of the .net framework. I'm looking for a project that is known to be lightweight and robust. Something like the uTorrent client. ...

How to record keystrokes when keyboard journaling is not available?

Having setup C++ app originally using MS specific keyboard journaling hook (WH_JOURNALRECORD) we find that it does not work on Vista unless run as administrator with uiAccess enabled. MSDN Question - Journaling hooks on Vista? We want to record a key sequence from the user in a friendly way that will be repeated at some later date. The...

C++ 'GET' request or how do you download files to work with in C++?

Alright I've spent a good three days trying this, here's the scenario: I want to download a '.csv' file from Google and then do stuff with the data from the file. It's for a Win32 Console Application. I have the latter down, I just cannot for the life of me figure out how to download the file. I've heard of libcurl, curlpp, ptypes, roll...

Are assertions always bad?

I used to work for a company where some of the lead architect/developers had mandated on various projects that assertions were not to be used, and they would routinely be removed from code and replaced with exceptions. I feel they are extremely important in writing correct code. Can anyone suggest how such a mandate could be justified?...

Is this possible use ellipsis in macro? Can it be converted to template?

Having implemented CLogClass to make decent logging I also defined macro, but it works only with one parameter... class CLogClass { public: static void DoLog(LPCTSTR sMessage, ...); }; #define DebugLog(sMessage, x) ClogClass::DoLog(__FILE__, __LINE__, sMessage, x) Well, it fails when called with more than 2 parameters :( ... I...

DirectDraw question - running the application as a regular Windows application

Hi, I am developing an application for video recording and I want to overlay the video preview with a logo and recording timer. I tried to run the full-screen application and everything worked fine. Then I tried to run the application as a regular Windows application and it returned an error. Could anyone take a look at the code below...

virtual inheritance

What is the meaning of "virtual" inheritance? I saw the following code, and I don't understand what is the meaning of the word "virtual" in the following context: class A {}; class B : public virtual A; Thanks! ...

QNX Object oriented threads in c++

Hello, I want to create a parallel object oriented system in QNX using c++ and threads. How do I do this? I tried: pthread_t our_thread_id; pthread_create(&our_thread_id, NULL, &functionA ,NULL); with function A being a pointer to a function: void *functionA() { //do something } However this function only works in C and not C++. ...

Best crossplatform C++/QT4 development environment

Hi! I would like to develop cross-platform applications using C++ and QT4. I code on both Linux and Windows (MinGW). Currently I'm using KDevelop and it's QMake integration. On Windows I'm trying out Eclipse with QT integration plugin. However moving sources and updating profiles/IDE project files on both systems is tedious. I'm looki...

Is this' type variableofType()' function or object?

#include<iostream> class name { public: int a; name():a(0){}; }; void add(name * pname) { pname = NULL; } int main() { name varName(); name * pName = new name(); add(pName); add(&varName);//error C2664: 'add' : cannot convert parameter 1 from 'name __cdecl *)(void)' to 'name *' } ...

Symbian C++ - Remove or hide component (ie. CEikLabel)

Hi, Seemingly a simple enough question, but I cannot work it out. I want to hide a CEikLabel at a certain point. I want a function like.. myLabel->SetVisible(EFalse); or.. myLabel->RemoveFromView(); I realise I could just use myLabel->SetTextL(_L("")); but that is not what I want to do. Thanks :) ...

Get the value from a fixed memory offset : Visual C++ Programming

I would like to write an simple application able to retrieve some certain data from another process(application)'s allocated memory. Say I already know a process' id and I would like to obtain a value in this process' memory always from a fixed offset (like 0x523F1C), is this doable in the user-mode, or it has to be in kernel-mode? Any...

How to get the version info of a dll in C++

I need to get the version info of a dll I created in VS2008 C++. How do I get it? Thanks, Adam ...

Using boost shared_ptr

I have to use a smart pointer and I found "shared_ptr" from boost looks good. I downloaded the boost library and I can see many files and libraries there. Is there any way to use only the shared_ptr ? ...

C++ ctor question (linux)

environment: linux, userspace-application created via g++ from a couple of C++ files (result is an ELF) there is a problem (SIGSEGV) when traversing the constructor list ( __CTOR_LIST__ ) (note: code called via this list is a kind of system initialisation for every class, not the constructor-code I wrote) when I understan...

Is there around a straightforward way to invert a triangular (upper or lower) matrix?

Hello, I'm trying to implement some basic linear algebra operations and one of these operations is the inversion of a triangular (upper and/or lower) matrix. Is there an easy and stable algorithm to do that? Thank you. ...

How to cast member variable pointer to generic type in C++

I have code similar to this in my application: class A { public: int b; } class C { public: int d; } void DoThings (void *arg1, MYSTERYTYPE arg2); A obj_a; C obj_c; DoThings(&obj_a, &A::b); DoThings(&obj_c, &C::d); The question is - What should MYSTERYTYPE be? neither void* nor int work, despite the value &A::b being printed j...

In C++, can I define a pointer-to-member of a private class outside its scope?

Consider: class C { private: class T {int a, b;}; }; C::T *p; As expected, this produces a compilation error saying that C::T is private in the context of Line 6. Now change this to pointer-to-member: class C { private: class T {int a, b;}; }; int C::T::*p; This time around, gcc version 3.2.3 still makes the same complaint...

reading an application's manifest file?

Is there an easy way to read an application's already embedded manifest file? I was thinking along the lines of an alternate data stream? ...