First, a piece of crap, thanks to my compilation Foundation (Foundation Foundation) solid, otherwise this problem really disgusting to me
The point because there are special requirements, you need to write an interface-like function, but because of the number of times used in addition to C + + write interface a variety of trouble
So I want to call this function through the address of the function, and can pass the parameter normally. But the calling procedure and the called function are not in a class, and calling up is a kind of trouble.
These days I have broken Baidu, have not found a method, what function callback Ah, through function address call function Ah, there is what interface and so on
Days......
Finally remember that I used the easy language before someone wrote this function, intend to copy it, but there is insufficient (later said), first translated into C + + code, Easy language is not posted
int ___call (int a, int *b=null, int *c=null, int* d=null, int* e=null, int* f=null, int* g=null, int* h=null, int* I=NULL, int* j=null)//a is the function address, the following variables are the parameters required by the function, redundant can be omitted as Null{__asm{leavepop Eaxxchg[esp], eaxjmp Eax}return 0;}
This method has been proved by me in many ways, it can be used (in VS2015 C + + MFC), there will be a warning that ESP is called by unknown in debug, there is no other problem in release
However, when the parameter of a function is 1 extra (the number of arguments is >1), this returns the wrong one.
In this way, we use a variety of inconvenient, when the number of parameters is greater than or equal to 2 times, this method is completely unable to use
And there's no right solution on the web.
Because of the previous experience of writing a small plug-in, a little bit of understanding of the Assembly, in the call function (subroutine, method), as long as the stack balance before and after the guarantee, there will be almost no error
So, in a fury on their own to write a function out, put on the outside, for everyone to use ~ hope to reprint the time please indicate my copyright
Wind fluttering red Technology center qq:515973568
Here's the code (CSDN code I'll fill in later, MSDN Code upload and Refresh with a delay)
Calling function C + + MFC with the address of a function