c++

Bitwise operations

Hello A) (Int32)X | ((Int32)Y << 16); B) (Int32)X + (Int32)Y * (Int32)Int16.MaxValue; Shouldn't both be equivalent? I know from testing that the first works as expected, but for some reason the second doesn't. Both X and Y are shorts (Int16), and the return type is an integer (Int32). Shouldn't Y << 16 <=> Y * Int16.MaxValue? ...

accessing windows taskbar icons in c++

I am looking for a way to programmatically get the current taskbar icons (not the system tray) for each program that is in the taskbar. I haven't had much luck with MSDN or Google, because all of the results relate to the system tray. Any suggestions or pointers would be helpful. EDIT: I tried Keegan Hernandez's idea but I think I mi...

c++ Input from text file help

My test file has data like this: 1 2 3 0 1, 2 3, 4 0, 0 4, 3 2, 1 0, 0 How would I separate the data by line but also separate each section of data by the zeros. ifstream data("testData.txt"); string line, a, b; while(getline(data,line)) { stringstream str(line); istringstream ins; ins.str(line); ins >> a >> b; hold.push_...

Using Eclipse C++ CDT in Linux

I want to use Eclipse to develop C++ projects on Linux. Particularly I want to modify stable and widely used open source projects using the Eclipse CDT. One of them is Intel Opencv. There are tutorials to create simple c++ projects like here: http://www.ibm.com/developerworks/opensource/library/os-eclipse-stlcdt/ . I have seen plent...

read a int from a file wrote by java's writeInt method in C++?

How would one go about doing this? Also, is there an easy way to do it? Using a lib like Boost or something? ...

How to Convert a gdi+ Bitmap-like struct into an HDC?

How to Convert a Bitmap-like struct into an HDC? I am now writting image processing program in c++, gdi. If I got a HDC. I can draw whatever I like on the HDC in gdi by the following code. // HDC is handy. HDC dc; dc.DrawXXX // I can draw using gdi method. Graphics gr(dc); // now I can also draw on the dc using gdi+ method. My...

Get ID of excel worksheet in focus using OLE

Using C++ and OLE, how might I go about obtaining the ID of the worksheet that is currently in focus? For example, I have the following code: Variant excelSheets; Variant excelSheet; excelSheets.OleProcedure("Add"); excelSheet= excelSheets.OlePropertyGet("Item", 1); I would like to add a sheet and then get the sheet ...

WM_KEYDOWN : how to use it?

Hello. I'm trying to send a key stroke to one application, through PostMessage. I am using too Spy++ to try to understand how to send the message, as I do not fully understand its inner workings. In this picture, the first item(selected item) was made with an actual key stroke made by myself. The one with a red elipse around it(below)...

Having a problem with placement-new!

I am having a problem placing an instance of my reference-counting Pointer<Type> class into my Array class. Using the debugger, it seems that the constructor is never called (which messes up the reference-count and causes a segfault down the line)! My push_back function is: void push_back(const T& element) { if (length >= max) reall...

Global memory management in C++ in stack or heap?

If I declare a data structure globally in a C++ application , does it consume stack memory or heap memory ? For eg struct AAA { .../.../. ../../.. }arr[59652323]; ...

How to mark a list control item as selected?

In a Win32 application I have a dialog with a list control which is defined is the dialog template: CONTROL "",IDC_LIST_Attributes,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,7,36,246,110 In the runtime I retrieve the handle to that control and perform different operations with it - remove ...

Which c++ book should I read after finishing 'accelerated c++' ?

hi, I've just finished reading 'accelerated c++', which i really enjoyed, but i am wondering which book will make a good 'next step' ? I would like a book that emphasizes writing idiomatic c++ over and above simply learning language features (in the style of accelerated c++) thanks, ...

What is Compatible "int" type in both 32Bit & 64Bit windows in C++?

Hi Guys, What is the compatible "int" datatype in C++ that can resize itself to 4 bytes on 32bit & 8 bytes on 64bit windows? Although INT_PTR works fine but it reduces the readability as well as its description tells us to use it for pointer arithmetic. Thanks ...

How to find whether the .NET installed or not in the System by using c++??

Hi Is there any API available to find the whether the .NET framework installed or not in the system. or atlest can any one give me idea how to do this our own in c++ and also how to find the path where .NET installed if it is installed?? How can i do this ... Any Help in this regard will Be Appreciated Greately..... ...

NTLM authentication for a web server side application

My Windows based application written in C++ ( basically an HTTP/1.1 proxy server) listens for requests from various users. Presently it is able to send a 407 Basic Challenge, and process the response from the Headers. I know I must modify the challenge headers, so that the client browsers make an NTLM based response for the purpose of au...

Visual Studio C++ - unresolved symbol __environ

Hi, I'm using VS 2008 and compile my application with Multi-threaded Debug (/MTd). At link time I receive the following error: error LNK2001: unresolved external symbol __environ Where the symbol is defined? Thanks Dima ...

Problem compiling C++ template code

I have the following template: template<class Matrix> Matrix horizontal_join (const Matrix& m1, const Matrix& m2) { ASSERT (rows (m1) == rows (m2), "unequal number of rows"); typedef typename Matrix::value_type Scalar; Matrix r (rows (m1), nbcol (m1) + nbcol (m2)); for (unsigned i=0; i<nbrow(m1); i++) { for (unsigned j=0; j<nb...

c ++ String array issue.

Hi guys, I'm just learning c++ coming from a Java background. Just playing around with simple classes now, but for some reason the following won't compile, when the same syntax compiles fine elsewhere: class CardDealer { private: string suits[4]; string values[13]; bool cardTaken[4][13]; int getRan...

How to make this template code work ?

the template code is like this: template <class type1> struct DefaultInstanceCreator { type1 * operator ()() { return new type1; } }; template < class type1 , class InstanceCreator = DefaultInstanceCreator<type1> > class objectCache { public: objectCache (InstanceCreator & instCreator) :instCreator_ (...

MFC LoadString in dll fails

I have a static function in dll which loads string from resource using LoadString(). When I call this function from that dll everything works OK. But, when I call this function from other module (activeX control) LoadString fails with error ERROR_RESOURCE_NAME_NOT_FOUND. I tried with AFX_MANAGE_STATE macro but it didn't help. Does anybod...