Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Converting from custom struct to LPARAM

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
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

PostPosted: Sun May 25, 2008 6:10 pm    Post subject: Converting from custom struct to LPARAM Reply with quote

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
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sun May 25, 2008 6:32 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
HalfPrime
Grandmaster Cheater
Reputation: 0

Joined: 12 Mar 2008
Posts: 532
Location: Right there...On your monitor

PostPosted: Sun May 25, 2008 7:39 pm    Post subject: Reply with quote

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
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Sun May 25, 2008 7:54 pm    Post subject: Reply with quote

Cast it as an LPARAM?
_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Sun May 25, 2008 7:55 pm    Post subject: Reply with quote

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
View user's profile Send private message
HalfPrime
Grandmaster Cheater
Reputation: 0

Joined: 12 Mar 2008
Posts: 532
Location: Right there...On your monitor

PostPosted: Sun May 25, 2008 8:23 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites