c++

Dialog of my Word add-in not using visual styles

I have written a Word add-in in C++ using plain Win32 API. It opens some dialogs but these are always shown without commctl6 visual styles on Vista+. The manifest is in place as RT_MANIFEST and resource ID - 2 (as shown below). When I invoke the same functionality/dialogs from my own test app, visual styles are OK. Any idea how Word is ...

C++ Tracking primitive type value change

i have a complex program with weird bug that some int value is down to zero unexpectedly. so i want tracking this built-in type value, then i could debug easily. to do that, i made following ValueWatcher template class so i could track almost changes of value except when ValueWatcher is dereferencing. (i made these dereferencing operat...

Is it possible to map an address to the result of a function?

Hey guy, I'm writing a NES emulator in C/C++ for Mac OS (I've already written one, so I know the basics). Since many hardware registers are mapped to memory locations, I was wondering if there was some syscall I could use to map an address to the result of a function: when it would be accessed, the function would be called. (I'm pretty ...

boost::asio handshake through http proxy?

quite new to boost and asio, need help connect to proxy asio::ip::tcp::socket socket_; send CONNECT host: ssl server to the proxy receive response 200 asio::ssl::context ctx(io_service, asio::ssl::context::sslv23); sslsocket_(socket_,context) try handshake sslsocket_.async_handshake(asio::ssl::stream_base::client, boost::bind(&clien...

Restoring any type

Hello, are there any ways to restore type of packed into boost::any object? If now, can I store some association map for it? I need something like (pseudocode): map<key, any> someMap; someMap["Key"] = some own object; getType("Key"); ...

Storing a derived object inside another object as a base pointer (C++)

So here's the deal: I have a concrete class Window, representing an operating system window which will be be used for drawing. Window can take on many types, such as fullscreen, fixed window, resizable window, borderless window etc. This is implemented using an interface IWindowType, in which the specific types derive from (classes are ...

c++ static won't link

Can you help? The following code: class MT { public: static int ms_number; }; int MT::ms_number; yields: Error 8 error LNK2005: "public: static int MT::ms_number" (?ms_number@MT@@2HA) already defined in ProjName.obj Why? ...

Making Vista / 7 User Frame control? (WinAPI)

I notice Vista/7 uses this type of control as well as Windows Live Messenger. This is the control: How can this control be programably added to a WinAPI application? Thanks ...

Calling a function from a derived template class

My base class: //Element.h class Element { public: Element(); virtual ~Element(){}; // not sure if I need this virtual Element& plus(const Element&); virtual Element& minus(const Element&); }; Derived template class: //Vector.h #include "Element.h" template <class T> class Vector: public Element { T x, y, z; public: //constructors...

Should i always use GL_ARGB format for all textures in OpenGL?

This has been bothering me a while... and it's really hard to really see any difference in performance, so i ask here: If my images doesnt use alpha channel, should i use 'GL_RGB' for saving them in GFX card memory, or 'GL_ARGB' as if that would be faster in processing since its full 32 bit block? Or does GFX cards automatically conver...

Troubles with STL list iterators

After a thousand of attempts to Google/bypass that using pointers, I decided myself to post this question to you guys. Here's the problem: I'm trying to create a minimum spanning tree from a graph that I previously made. I'm using Kruscal's Algorithm for that, which is about checking every arc from the shorter to the longest and taking ...

what is the formula of increasing the brightness of a bitmap?

what is the formula of increasing the brightness of a bitmap? i m working in MFC ...

What is wrong with this code?

int main() { char *name = new char[7]; name = "Dolphin"; cout << "Your name is : " << name <<endl; delete [] name; } Why doesn't the VC++ compiler complain? ...

How do I link in functions from a .cpp source file that also has a 'main'?

I want to use some functions from a .cpp source file that has a main function in my .cpp source file. (I'm building with make and gcc.) Here's the rule from my Makefile: $(CXX) $(CXXFLAGS) $(INCLUDES) $(SRCS) $(LIBS) -o $@ And here's the output (with some names changed to prevent distraction): $ make foo g++ -g -Wall -m32 -Ilinux/i...

How to link to existing boost python module

I have wondered about this on and off but I never really got a definite answer. Is it possible within the boost.python framework to link against another boost.python module. For example I have exported class A within boost_python_module(libA) and function B(A a) within boost_python_module(libB). Is it possible to specify in libB to lin...

Window Style for shading?

When a menu item or context menu is made, it has a shadow, if I create a window with WS_POPUP instead of WS_CHILD it has no shadow. How can I get the shadow? Thanks ...

Ways to parse XML in C++ (Win32)

Hi, I'm looking for a way to parse XML in C++ in Windows and I've found a few such as MSXML, Xerces, TinyXml etc but I'm wondering which is best in terms of performance and features. My requirements are that it must be able to be static linked or have the source included in the project itself and must not require any additional toolits ...

Initialize and return a struct in one line in C++

Is this possible? I know that you can initialize structs using list syntax. IE struct Foo f = { a, b, c}; return f; is a possible to do this in one line as you would be with classes and constructors? Thanks ...

Class member calls function template with callback function

I'm having trouble passing a callback function from within a class, when calling a template function. Here's a sample code: sortedlist.h #ifndef _sortedlist_h #define _sortedlist_h #include <vector> template <typename ElemType> class SortedList { public: SortedList(int (*compare)(ElemType a, ElemType b)); ~SortedList(); ...

Nesting of Structs and Classes

#include<iostream> using namespace std; struct My_Class{ class My_struct{ int am_i_in_class_or_struct; }; }; int main(){ cout<<sizeof(My_Class)<<endl; cout<<sizeof(My_struct)<<endl; cout<<sizeof(int); } Please Explain: when i executed the above program on Turbo C i got output: 1 2 2 Now shouldn't the size be same in...