Browse Subversion Repository
Contents of /old/luacall.cpp
Parent Directory
| Revision Log
Revision 51 -
( show annotations)
( download)
Thu Mar 27 00:00:01 2008 UTC
(16 years, 2 months ago)
by tabasa
File MIME type: text/plain
File size: 1022 byte(s)
| 1 |
#include "defextern.h" |
| 2 |
|
| 3 |
#ifndef STRICT |
| 4 |
#define STRICT |
| 5 |
#endif |
| 6 |
#include <stdio.h> |
| 7 |
#include <windows.h> |
| 8 |
#include "mes.h" |
| 9 |
|
| 10 |
namespace lua |
| 11 |
{ |
| 12 |
char buffer[1000]; |
| 13 |
} |
| 14 |
using lua::buffer; |
| 15 |
|
| 16 |
void printError(const char *name, int err) |
| 17 |
{ |
| 18 |
LPVOID pbuf; |
| 19 |
FormatMessage( |
| 20 |
FORMAT_MESSAGE_ALLOCATE_BUFFER | |
| 21 |
FORMAT_MESSAGE_FROM_SYSTEM | |
| 22 |
FORMAT_MESSAGE_IGNORE_INSERTS, |
| 23 |
NULL, |
| 24 |
err, |
| 25 |
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), |
| 26 |
(char*)&pbuf, |
| 27 |
0, |
| 28 |
NULL |
| 29 |
); |
| 30 |
sprintf(buffer,"%s: %d:%s\n", name, err, pbuf); |
| 31 |
Mes(buffer); |
| 32 |
LocalFree(pbuf); |
| 33 |
} |
| 34 |
|
| 35 |
typedef ( __stdcall *luac)(char* ,char*,char*); |
| 36 |
|
| 37 |
void luacall(char *val,char *str,char *luafile) |
| 38 |
{ |
| 39 |
luac tes; |
| 40 |
HINSTANCE hLib=NULL; |
| 41 |
hLib = LoadLibrary("moflua.dll"); |
| 42 |
if(hLib!=NULL) |
| 43 |
{ |
| 44 |
tes = (luac) GetProcAddress(hLib, "_tes@12"); |
| 45 |
if(tes==NULL) printError("GetProcAddress", GetLastError()); |
| 46 |
else |
| 47 |
{ |
| 48 |
if(tes(val,str,luafile)==-1) |
| 49 |
{ |
| 50 |
wsprintf(buffer,"%s/%s‚ªŒ©‚‚©‚è‚Ü‚¹‚ñ",str,luafile); |
| 51 |
Mes(buffer); |
| 52 |
} |
| 53 |
} |
| 54 |
} |
| 55 |
else |
| 56 |
{ |
| 57 |
printError("LoadLibrary", GetLastError()); |
| 58 |
} |
| 59 |
} |
Properties
| svn:eol-style |
native
|
| svn:keywords |
Id Revision
|
| svn:mime-type |
text/plain
|
| |