Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I've got a problem with Play function

Status
Not open for further replies.

baptul

Programmer
Mar 22, 2003
8
0
0
PL
I write a function play, here is a declaration
long __stdcall play(int code,long lparam,long wparam);
{
......
}
And now a want to use this function in SetWindowsHookEx ( I write something like that)
int *hook;
hook=SetWindowsHookEx(2, play ,Application->Handle,0)
And this isn't good idea because the second parameter in SetWindowsHookEx must be this kind int (__stdcall*)() and i have long(__stdcall*)(int,long,long).Can I convert one type to another in some way. Please help !!!!!
 
int x = 2;
long y = 374;

int x = (int) y;

long y = (long) x;

I think its called casting.

tomcruz.net
 
I agree, you just cast it. I'd consider using the types defined in the API though. Also, you shouldn't have a ';' at the end of your parameter list unless it's a prototype.

long __stdcall play(int code,long lparam,long wparam)
{
......
}

HHOOK hook = SetWindowsHookEx(2, (HOOKPROC)play ,Application->Handle,0);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top