Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 24 Dec 2008
Offline Last Active Apr 11 2016 03:01 PM

Posts I've Made

In Topic: D3d12 in C

01 September 2015 - 10:05 AM

I have no experience with D3D12 but if its headers are like D2D's then the C interface is broken in respect to the interface functions that return structures. And they're not really bothered about fixing it

In Topic: Using bitmap resources (*.rc) in Visual Studio 2010

24 December 2012 - 05:09 PM

These functions don't like BITMAP type resource data, only RCDATA type resource data.


Change the



bit in the rc file to


The second stores a copy of the file as is; the first one strips off the BITMAPFILEHEADER from the start of the file. The WIC functions the D3DX functions use (specifically CreateDecoderFromStream) seem to require that header be present or they fail. It ain't there, so they fail which make the D3DX function fail.

In Topic: Input filtering in Win32

15 December 2012 - 10:25 PM

while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE | PM_QS_PAINT | PM_QS_...))
InputProc(msg.hwnd, msg.message, msg.wParam, msg.lParam);
Still makes the program hang. It never recieves input

Nothing you can give PeekMessage will make it hang, so without being able to see the code it's probably one of a couple things:
1. Like in the first post, invalid flags are being passed to the only / all PeekMessages and the window hangs because no messages are being retrieved at all. You'd also see that if you run the message pump on a different thread to the one that created the window.
2. There's a rogue Sleep / WaitForSingleObject that rarely returns
3. It's working fine except that InputProc isn't calling DefWindowProc for some window or keyboard messages so certain things it does for you (like letting you double click the title bar to move the window or pressing Alt to start the window menu) aren't happening

On a stylistic note, it's not the best idea to call your custom message dispatching function the same thing as the Windows one, especially when they share the same signature. At least, I thought the DispatchMessage in the snippets here was the Windows function before I checked your repo. Or maybe you changed back, and it is!

Does this not imply that there's no need to call DispatchMessage in a PeekMessage loop?

You don't have to call it, but even if you only explicitly create one window things like COM or plugins (if you allow those) can create other windows that run on the same thread. Without a (Windows) DispatchMessage, any messages picked off the queue intended for them will never make it to their WndProc, unless you do it manually. It also does other stuff like translate unicode messages for non-unicode WndProcs and vice versa. It's not anything you couldn't do yourself though.

In Topic: back_inserter or end()

28 November 2012 - 07:21 PM

You could also (ab)use the fact that accumulate is implemented in terms of addition and use that to concat a bunch of strings in a container. The need to provide the starting point takes away some elegance points but it's still serviceable.

// include <numeric>
std::wcout << fieldTitle << L'\t' << std::accumulate(dest.begin(), dest.end(), std::wstring()) << std::endl;

In Topic: VS 2010 is generating .lib and .exp files for a normal project, why?

16 November 2012 - 10:51 AM

If you add
dumpbin /exports $(TargetPath)
as a post-build event for the dll/exe project generating the lib & exp, the build output will tell you what functions are being exported.

I know VS 2008 has a bug where certain build options will cause the project to export std::_Init_locks which in turn will generate an exp & lib for otherwise non-exporting projects. I don't know if they fixed it though.