Hello,

What would be the minimum code to get a valid HWND to pass to DirectDraw and DirectSound, without then having to bother with messageloops?

GetDesktopWindow() would have been a good idea, but it's someway buggy.
Posted on 2002-11-23 05:14:21 by Bugs' Bounty Hunter
There must be some hidden bug somewhere in your code, I've used the GetDesktopMethod() and it always worked (just make sure you always use this HWND, and don't mix it with others, if you do dxdraw & dxsound).

Even Microsoft recommends to use it:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcesdkr/htm/_wcesdk_idirectsound_setcooperativelevel_dsound.asp
Posted on 2002-11-23 06:40:26 by Maverick
HWND FindWindow(
LPCTSTR lpClassName, // class name
LPCTSTR lpWindowName // window name
);

hwnd = FindWindow("YourClassName", NULL);

i think thats what you're trying to do?
Posted on 2002-11-27 00:19:14 by __anti_code_
You can't use DeskTop Window.
Why?
Your application's process doesn't own that window.
Your Application needs at least one window.

In Direct3D it's even weirder, here we need to have a window BEFORE creating a window just for D3D... this means that the main app window is hidden for fullscreen apps, and often the main window message handler does very little !!
Posted on 2002-11-28 04:03:56 by Homer
Thanks for your replies.
The problem is that I don't want to bother with a message-loop, since I want to keep my program structure as much "platform independent" as possible, and message-loops are something very very Win32ish.
So if I create a Window and neglect its message-loop after some time the mouse pointer will turn to "busy", and Windows Task Manager will claim that my application is not responding.
I hate this.. I'd like to make behave Win32 just like all the other OS's on earth (crashes excluded). In substance, even if it would cost little work to call the message-loop from time to time, I'd like to avoid it if possible, so to not include some special Win32-only code in my multiplatform wrapper. For gfx I use DirectDraw, and for mouse and keyboard I use DirectInput anyway.. so I don't feel limited without that message-loop.
Is there any good solution, short of creating a separate thread just to close the loop of those annoying messages I don't care listening to?

It may not be Win32 ideal, but for me Win32 is just one of many platforms, and I don't want to go too specific with it in my coding style.
Posted on 2002-11-28 04:35:08 by Bugs' Bounty Hunter
Afternoon, Bugs' Bounty Hunter.

ummm...
I want to keep my program structure as much "platform independent" as possible

Then you don't plan on using ddraw/dsound/d3d/dinput/etc?

All of these are Microsofts' interfaces for their OSes and only work on Windows platforms.

Cheers,
Scronty
Posted on 2002-11-28 09:12:25 by Scronty
A wrapper around DX? ;)
Posted on 2002-11-28 17:03:57 by Bugs' Bounty Hunter
Afternoon, Bugs' Bounty Hunter.

heh.
I'm still a little confused as to what you're actually plamming to do:).

There are fundamental differences between a Windows program and a *nix program. "Wrapping" won't change this.

For a DX proggy, you've got Win32 or MFC to work with. DX itself is a bunch of COM interfaces. I haven't programmed in linux/etc, however I'm pretty sure Microsoft haven't made Win32/MFC/DX/COM available for that platform:grin: .

Your best bet would be to use OpenGL for the graphics side of things, as this API *is* implemented on both platforms.

And, of course, you can still use asm/C/C++ for your programs modules as long as they don'y use any Win32/MFC/"whatever-linux-has"/etc functions.

Cheers,
Scronty
Posted on 2002-11-29 01:22:33 by Scronty