Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

RagNoRoc

CreateWindowEx and the crap it givs me

This topic is 5480 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
I tried putting the WS_POPUP in the dwstyle parameter and it still gives me the same error.

I still cannot understand how one minute the call works perfectly then changing the file extension can make it not work. I mean C and C++ are so damn close that something trivial like making a standard WINAPI call should work no problem.

I am going to look back into the directX 7 SDK and see if they have any other ways of setting up windows that do not use the CreateWindowEx() call. Normally I do not have these types of problems. Of course I never used DirectX for anything before also.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
If you can't figure out what's going wrong, just do what your
compiler tells you to do: Explicitly cast your function's
parameters. Put the parameter's cast in there with NULL.
From the CreateWindowEx docs, the casting should look like:
(HMENU)NULL

End of complaints.

Reaver

Reaver

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
That's with parameter 9 of course.

Share this post


Link to post
Share on other sites
Actually for the 9th parameter (hWndParent) the correct cast would be (HWND) or (HWND*), though this should not be necessary.

I don't suppose you've tried a Rebuild All lately? Also make sure there are no "ghosts" of your .c still present in that directory.

-fel

(In other words, what Keebler said... didn't hit the submit button fast enough *grin*)

[This message has been edited by felisandria (edited October 27, 1999).]

Share this post


Link to post
Share on other sites
Thanks Dave !

Glad to be here and it was cool meeting you at the conference.

VC++ 6 is anal about casts like that, so things like GetStockObject() etc have to cast their VOID* return values to the type of the Lvalue.

Keeb

Share this post


Link to post
Share on other sites
Oops, that right, just (HWND)NULL will do it. (HMENU)NULL
is for the 10th parameter.

That's what you get you when count from zero and not 1.

Share this post


Link to post
Share on other sites
Well here is what is happening. I got DirectInput to work which is great. Now I have to fiddle with getting my CreateWindowEx() call to work because I converted my main file project.c to project.cpp.

Basically when I call CreateWindowEx() with all the parameters passed like I did in the .c version I get a nice little error.

Here is what the code looks like:

// Create application's main window
hWnd = CreateWindowEx(0, AppName,
AppName,
0,
CW_USEDEFAULT,
CW_USEDEFAULT,
Width,
Height,
NULL,
NULL,
hInstance,
NULL);

Now it worked before when I was using c but now MSVC++ 6 w/ service pack 3 gives me the following error:

error C2664: 'CreateWindowExA' : cannot convert parameter 9 from 'void *' to 'struct HWND__ *'
Conversion from 'void*' to pointer to non-'void' requires an explicit cast

What could be going wrong?
Any suggestions would be helpful. I also tried pulling a CreateWindow() example from the DX7 SDK but it gives me the same error when I drop it into my code.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!