lr_load_dll and lr_message example

lr_load_dll is used to load user32.dll so that a standard Windows message box can be displayed during script replay, then to load kernel32.dll to use file functions.:

WIN32_FIND_DATA fdFile;
HANDLE hFind = NULL;

char *filepath;
char sPath[2048];

lr_load_dll("user32.dll");
MessageBoxA(NULL, "This is the message body", "message_caption", 0);

filepath = lr_eval_string("{UploadDirectoryPath}");

lr_load_dll("kernel32.dll");

sprintf(sPath, "C:\\TEMP\\*.*");

// see http://www.win7dll.info/kernel32_dll.html 
if((hFind = (void*) FindFirstFileA(sPath, &fdFile)) == INVALID_HANDLE_VALUE)
{
   lr_message("Path not found: [%s]\n", sPath);
   lr_abort();
}

No comments:

Post a Comment