Why does CreateDevice() fail?

Started by
20 comments, last by Ice-T 20 years, 8 months ago
HRESULT InitD3D( HWND hWnd );

Try HRESULT InitD3D( HWND *hWnd );

Sometimes, the hWnd can be the problem, that depends ofcause on your application.
Advertisement
okay, a few things::


Where do you register your win class?

ALso, dont try to init D3D until you Show Window.


RegisterClass (& windowClass);

ShowWindow;
Updatewindow;

NOW init d3d.
TechleadEnilno, the Ultima 2 projectwww.dr-code.org/enilno
> No luck with that either.

Can you be more descriptive? The debug output almost always tells you exactly what you''re doing wrong. Are you getting any debug output at all?
Donavon KeithleyNo, Inky Death Vole!
First off, you should make your WindowClass Global.

char * WndClass="WindowClass";


Then pass WndClass to your create window, and also to the RegisterClass function.


Then do the rest:

ShowWindow;
UpdateWindow;

NOW createD3D;
TechleadEnilno, the Ultima 2 projectwww.dr-code.org/enilno
At some computer this happened to me.
After some investigation someone has disabled the 3D accelaration and this fails to create the device.
be yourself.
quote:Original post by Ice-T No luck with that either. So does anybody have any suggestions?


No luck getting the debug stuff to work? Or no luck with the output? The Debug output is incredibly useful and it should at the very least give you a hint about why it can''t create a device.
Stay Casual,KenDrunken Hyena
I tried all the suggestions like creating and registering before creating the deviece and I keep getting the same error. When I ran D3DSpy, I got the same message, that CreateDevice returned "Invalid Call". That is the Debug Output part right? Worst part about this whole thing is that it''s one of the samples with the SDK so it makes no sense for it not to work. I even re-installed DirectX 9 but CreateDevice() fails. I even tried another sample from another site and that failed too. Is it possible I didnt install some part of DirectX improperly? What''s odd is that this is the only call that fails. I tried some samples in the SDK like lighting and water for Direct3D adn they all work fine, its whenever an app uses CreateDevice() that it fails.
Ugh...

I am almost positive you have to set the hDeviceWindow in your present parameters if you want to use windowed mode. Make your HWND global and try setting it to that.
____________________________________________________________AAAAA: American Association Against Adobe AcrobatYou know you hate PDFs...
Thanks for all the help guys but I figured it out. My weird PC was on 24bit mode instead of 32 bit because that was the highest bit-depth I had and when I changed it to 16 bit, it worked.
quote:Original post by Raloth
Ugh...

I am almost positive you have to set the hDeviceWindow in your present parameters if you want to use windowed mode. Make your HWND global and try setting it to that.


IIRC, if you leave the HWND as NULL, then Direct3D selects the foreground window as the render target.

This topic is closed to new replies.

Advertisement