Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


adeyblue

Member Since 24 Dec 2008
Offline Last Active Jul 17 2014 10:35 AM

Posts I've Made

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

IDB_BITMAP1 BITMAP "Image.bmp";

 

bit in the rc file to

IDB_BITMAP1 RCDATA "Image.bmp";
 

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.

In Topic: CheckInterfaceSupport Method

25 October 2012 - 09:53 AM

There's nothing wrong really. If you convert that number to hex you get:

0x80011000D008E
..8|17| 13| 142


it's just packed into word sized values with the larger value. You can get the individual parts using the high and low parts of the large_integer with the word extraction macros:
std::wostringstream outs;
outs << L"Your computer has " << num_adapters << L" display adapter(s). D3D driver version is " <<
	HIWORD(lrg_int.HighPart) << L'.' <<
	LOWORD(lrg_int.HighPart) << L'.' <<
	HIWORD(lrg_int.LowPart) << L'.' <<
	LOWORD(lrg_int.LowPart);
It would be nice if the CheckInterfaceSupport help page documented this, but maybe it's dependent on what the driver vendor provides so there's no set format for it.

PARTNERS