C++直接调用外部函数(二)

2014-11-24 12:32:27 · 作者: · 浏览: 1
f("ret %d/n", ret);

ret = cdll.cFunc("strstr")(2, "Caller has already cleaned the stack", "has");

printf("ret %s/n", ret);

A a;

ret = Function(addressof(A::show), &a, DC_STADCALL)(1, "Class function call");

printf("ret %d/n", ret);

ret = user32.winFunc("FindWindowW")(2, NULL, L"Google - 谷歌浏览器");

printf("ret %d/n", ret);

srand(cdll.cFunc("time")(1, NULL));

int r = rand();

ret = user32.winFunc("ShowWindow")(2, ret, (r % 2) == 0);

printf("r = %d, ret %d/n", r, ret);

return 0;

}

摘自 lqefn的专栏