Advertisement

Problem with hwnd

Started by April 24, 2002 09:20 PM
20 comments, last by Lord Benoit 22 years, 8 months ago
I am having trouble setting my cooperative level. this is my code: lpdd7->SetCooperativeLevel(hwnd, DDSCL_ALLOWREBOOT | DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); and this is the error: error C2664: ''SetCooperativeLevel'' : cannot convert parameter 1 from ''int'' to ''struct HWND__ *'' Please help me Im not Greedy, Im just generous with myself
-------Im not Greedy,Im just generous with myself
Well, uhm you should pass the HWND value you get from your window initialization to the function. Somewhere along line you made the hwnd variable an int. That''s about what I can tell ya without seeing the rest of the code...

-=Lohrno
Advertisement
Really you just need to explicitly cast your HWND, that is what it is complaining about. Do this:

lpdd7->SetCooperativeLevel((HWND)hwnd, DDSCL_ALLOWREBOOT | DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);

And see if it stops complaining.
quote: Original post by Anonymous Poster
Really you just need to explicitly cast your HWND, that is what it is complaining about. Do this:

lpdd7->SetCooperativeLevel((HWND)hwnd, DDSCL_ALLOWREBOOT | DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);

And see if it stops complaining.


hmm.. it shouldn''t be complaining about that in the first place. He should not be using an int to store the hWnd

Lord Benoit: you should probably post your window creation code, and the whole directdraw init function.
Were are you getting hwnd from? If you''ve declared it as an int, which is what seems to be the problem, change it to this:

HWND hwnd; 



/******\
| Nain
| The sky is the only limit, and
| the world is made of dreams.
\******/
/******| Nain| The sky is the only limit, and| the world is made of dreams.******/
I really appreciate your help guys but its still not working.


I am using multiple .cpp files and in my main header file, I put extern hwnd. could this be making it an int?
If so what could I do to fix it.
----

Im not Greedy,
Im just generous with myself
-------Im not Greedy,Im just generous with myself
Advertisement
i''m no expert but if i was you i would try


extern HWND hwnd;

no idea if this will work though!
It would really help us out, if you at least posted the .cpp file in which the SetCooperativeLevel() is called.

----------
Take it to the Xtreme!
----------
Wachar's Eternity <-<-<-<-<- Me own site!
Sorry guys but i couldn''t connect anymore,

anyways, I would like to put my code up but I dont know how to get it into a textbox and it is too big to just post like that.

If someone could tell me how, then I would post it.

--------------

Im not Greedy,
Im just generous with myself
-------Im not Greedy,Im just generous with myself
If this Forum supports HTML tags use the textarea tags.

Anaton
Flying Tigers CFSG

[edited by - Anaton on April 27, 2002 10:13:39 PM]
Anaton

This topic is closed to new replies.

Advertisement