View previous topic :: View next topic |
Author |
Message |
HalfPrime Grandmaster Cheater
Reputation: 0
Joined: 12 Mar 2008 Posts: 532 Location: Right there...On your monitor
|
Posted: Sun May 25, 2008 6:10 pm Post subject: Converting from custom struct to LPARAM |
|
|
I've got a struct
Code: | struct lpar{char a, b, c, d;}; |
and I need to pass it to a function as a LPARAM.
Whenever I try, I get
Quote: | `struct lpar' used where a `LPARAM' was expected |
I've tried several different ways to get it to take it, but none of them are accepted. How can I make this work?
_________________
|
|
Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sun May 25, 2008 6:32 pm Post subject: |
|
|
Besides the structure, code would help.
_________________
8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
Back to top |
|
 |
HalfPrime Grandmaster Cheater
Reputation: 0
Joined: 12 Mar 2008 Posts: 532 Location: Right there...On your monitor
|
Posted: Sun May 25, 2008 7:39 pm Post subject: |
|
|
Code: | #include <windows.h>
struct lpar{char a, b, c, d;};
void AFunc(LPARAM c){return;}
int main(){
lpar var;
AFunc(var);
return 0;} |
_________________
|
|
Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Sun May 25, 2008 7:54 pm Post subject: |
|
|
Cast it as an LPARAM?
_________________
|
|
Back to top |
|
 |
Flyte Peanuts!!!!
Reputation: 6
Joined: 19 Apr 2006 Posts: 1887 Location: Canada
|
Posted: Sun May 25, 2008 7:55 pm Post subject: |
|
|
It's rather hackish, but here:
Code: | #include <windows.h>
typedef struct lpar {
char a, b, c, d;
} LPAR;
void AFunc(LPARAM c)
{
return;
}
int main()
{
LPAR var = { 1, 0, 0, 2 };
AFunc((LPARAM)*((DWORD*)&var));
return 0;
} |
|
|
Back to top |
|
 |
HalfPrime Grandmaster Cheater
Reputation: 0
Joined: 12 Mar 2008 Posts: 532 Location: Right there...On your monitor
|
Posted: Sun May 25, 2008 8:23 pm Post subject: |
|
|
Rofl. Thanks, Flyte, that's actually working.
@samuri25404
Same thing happened when I tried casting. Tried casting to LPARAM, as DWORD then LPARAM, as LONG then LPARAM. Tried making a function that took the lpar and returned it as an LPARAM. No luck with any of it.
_________________
|
|
Back to top |
|
 |
|