g00001
2015-11-19 15:03:23 +08:00
嘿嘿, C 语言还可以这样玩( aardio 代码 )
code = /**
#include <windows.h>
__declspec(dllexport) int Msgbox( HWND hwnd )
{
struct { const char * message;int id; } argument = {
.message = "测试消息来自 C 语言",
.id = GetCurrentThreadId()
};
SendMessage(
hwnd,0xACCE/*_WM_THREAD_CALLBACK*/,
"onMessageChange( { string message;int id } )",
&argument
);
return 0;
}
**/
import tcc;
vm = tcc();
vm.addLib( "user32", "kernel32", "gdi32" )
vm.output( "/bin.dll", code )
import win.ui;
var winform = ..win.form({})
winform.messageOnly();
winform.onMessageChange = function(param){
winform.msgbox("调用:" + param.message );
win.quitMessage();
}
var dll = raw.loadDll( "/bin.dll",, "cdecl" );
dll.Msgbox( winform.hwnd );
win.loopMessage()