c++

I can't get the transparency in my images to work.

Stemming from this question of mine: http://stackoverflow.com/questions/1191093/im-seeing-artifacts-when-i-attempt-to-rotate-an-image In the source code there, I am loading a TIF because I can't for the life of me get any other image format to load the transparency parts correctly. I've tried PNG, GIF, & TGA. I'd would like to be able t...

Hello World from cython wiki not working

Hi, I'm trying to follow this tutorial from Cython: http://docs.cython.org/docs/tutorial.html#the-basics-of-cython and I'm having a problem. The files are very simple. I have a helloworld.pyx: print "Hello World" and a setup.py: from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import...

Is there a way to access the private parts of a different instantiation of the same class template?

Hi all, In my continuing adventure with templates, I've templated my Container class not just on the ItemType it holds, but also on a Functor argument that determines how it should order the items. So far, so good. A little problem I've run into occurs when I want to copy the contents of one Container to another: If the two Container...

Do subclasses allocate memory and methods of their ancestors?

In C++, when a class inherits other class, if I create an object for the subclass, then will the subclass object create memory for all data members and member functions for the superclass, too? ...

'D3DRS_SEPARATEDESTALPHAENABLE' : undeclared identifier - even though it's mentioned in the DirectX comments?

In d3d9types.h in the _D3DRENDERSTATETYPE struct the last 3 types are: D3DRS_SRCBLENDALPHA = 207, /* SRC blend factor for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE */ D3DRS_DESTBLENDALPHA = 208, /* DST blend factor for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE */ D3DRS_BLEN...

Good Readings on Unix/Linux Socket Programming?

Hi all, though I haven't worked with sockets professionally, I find them interesting. I read some part of Unix Network Programming by Richard Stevens (considered to be the Bible I suppose as it is referred by everyone I ask) but the problem is the examples require a universal header unp.h which is a PIA to use. Can some of you suggest ...

SetProcessWorkingSetSize usage

Has any one used SetProcessWorkingSetSize ? I am thinking of using it as my application runs out of Virtual Memory ? ...

MFC feature pack - How to get the font, style and size using CMFCPropertyGridProperty::GetValue

Hi All, By using CMFCPropertyGridProperty::GetValue I'm able to get the contents of the property grid. I have one property though that gets the font, where when you click on it, shows a dialog box to select the font, size and style. Using this code: CMFCPropertyGridProperty* pCurSel = m_wndPropList.GetCurSel(); CString test = pCurSe...

Is this code thread-safe?

This is a simplified version of some code I'm currently maintaining: int SomeFunc() { const long lIndex = m_lCurrentIndex; int nSum = 0; nSum += m_someArray[lIndex]; nSum += m_someArray[lIndex]; return nSum; } lCurrentIndex is updated periodically by another thread. The question is; will making a local copy of m_CurrentInd...

Are there any tools for verifying coding standards?

Hello, I'm having some trouble finding a tool for verifying if a code respects certain coding rules. For example I want to make sure of things like the following: class names start with a C class member names start with m_ global variables should start with g_ static variables should start with s_ comments should follow the doxygen r...

About WM_MOUSEHOVER, controls and Balloons

Hi, I have this code in the switch (msg) loop inside WindowProc on my GUI App. case WM_MOUSEMOVE: TRACKMOUSEEVENT tme; tme.cbSize = sizeof(TRACKMOUSEEVENT); tme.dwFlags = TME_HOVER; tme.dwHoverTime = 100; tme.hwndTrack = hwnd; TrackMouseEvent(&tme); break; case WM_MOUSEHOV...

win32 project designer

anyone know of some good software that can help me design the form for my win32 project? or is there a way to get the form designer in visual c++ for win32 projects? ...

Is downcasting this during construction safe?

I have a class hierarchy where I know that a given class (B) will always be derived into a second one (D). In B's constructor, is it safe to statically cast the this pointer into a D* if I'm sure that nobody will ever try to use it before the entire construction is finished? In my case, I want to pass a reference to the object to yet ano...

Virtual base class data members

Why it is recommended not to have data members in virtual base class? What about function members? If I have a task common to all derived classes is it OK for virtual base class to do the task or should the derived inherit from two classed - from virtual interface and plain base that do the task? Thanks. ...

how to import a tlb file programatically in c++??

Currently I am using the statement: #import "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\test.tlb" named_guids But I am getting the folder path programatically. i.e., "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727" I have to load test.tlb from this path which resides in a variable say, folderpath. I have to import the tlb programa...

in c++ how can I find the maximum system date?

I'm trying to find the maximum allowed system date in cpp, but I can't find the function to do that... Can anyone help me? ...

Screen capture ignores some windows

Hello, I am working in MFC and I am trying to capture a bmp of the desktop. I am using GetDC(NULL) to do this but it seems it ignores special skinned windows. It seems to ignore windows drawn with UpdateLayeredWindow. This behaviour seems to be happening only on Vista x64 and XP. I have also tried GetWindowDC with the desktop HWND but t...

access violation error when using map in dll

I tried to create a win32 dll using c++. It has a map declared globally. But when I try to access the map using the dll its giving a run time error that: WindowsError: exception: access violation reading 0x00000008. How to solve it? Declaration: static map<int,urllib> url_container; The urllib is a class. Error occurance: url_co...

How does multiplication work for C++ enums?

We have a template conversion function intended for use with numeric datatypes. Inside it contains a construct that makes it not compile with types like pointers. template<class To, class From> To ConvertTo( From what ) { assert( 2 * what == what * 2 ); // this will not compile for pointers //skipped } This function compiles a...

Behaviour of static variables in dynamically linked libraries (C/C++)

As discussed here, a static variable is stored in the .BSS or .DATA segment. Where is this memory stored if the static variable is inside a function that's in a dynamically linked library ? Does storage for this variable get allocated in the .BSS or .DATA segment of the linking process at the time of linkage ? ...