Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, ozgur), 1,415 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Setting on_message from C++, storing old on_message, EVENT*? #295715
10/27/09 03:39
10/27/09 03:39
Joined: Oct 2009
Posts: 33
A
AlexH Offline OP
Newbie
AlexH  Offline OP
Newbie
A

Joined: Oct 2009
Posts: 33
So I'm doing stuff like this (in C++):
Code:
//Pointer to a standard windows processing function
typedef LRESULT (CALLBACK* MsgFuncPtr)(HWND, UINT, WPARAM, LPARAM);

MsgFuncPtr def_on_message;
LRESULT CALLBACK eng_on_message(HWND win, UINT msg, WPARAM p1, LPARAM p2);

int APIENTRY WinMain([...])
{
  ENGINE_VARS* ev = engine_open();
  [...]
  //I want to do something like this
  def_on_message = (MsgFuncPtr)v(on_message);
  v(on_message) = (EVENT)eng_on_message;
}



As you can see I'm trying to simply store a pointer (in C++) to the default on_message function (defined in the environment variables) inside a variable called def_on_message.

The problem is, ev->on_message is of the type EVENT* (which is just a pointer to a byte array).

How do I store the default ev->on_message so that I can call it from some other function later?

(by the way when I run the above code I get an access violation when eng_on_message is run probably because I'm storying def_on_message wrong).

Last edited by AlexH; 10/27/09 04:06.
Re: Setting on_message from C++, storing old on_message, EVENT*? [Re: AlexH] #295721
10/27/09 04:37
10/27/09 04:37
Joined: Oct 2009
Posts: 33
A
AlexH Offline OP
Newbie
AlexH  Offline OP
Newbie
A

Joined: Oct 2009
Posts: 33
Sorry, I think my trouble is coming from something else.

I'm having issues with extern and static, because I need to use 1 variables in two cpp files. I think I can resolve this myself.


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1