Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,582 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 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 | 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