一个方法是调用LaunchAppAndWait函数: function OnBegin() STRING szProgram, szCmdLine; begin szProgram = "rundll32"; szCmdLine = "rnaui.dll,RnaWizard"; LaunchAppAndWait(szProgram, szCmdLine, WAIT); end一个是调用API函数: Discussion Prototype the function as shown below: prototype Shell32.ShellExecuteA( HWND,LPSTR, LPSTR, LPSTR, LPSTR, INT);Call the function as you would any other. For example: ShellExecuteA(hInstallHwnd, pszOperation, pszFile, pszParameter, pszPath, SW_SHOWMAXIMIZED); Below is a sample script that will launch a file, "Test.doc" (that is in the C:\Windows\Temp directory), using Notepad.exe:#define DLL_FILE "Shell32.dll" // Prototype ShellExecuteA in Shell32.DLL. prototype Shell32.ShellExecuteA( HWND,LPSTR, LPSTR, LPSTR, LPSTR, INT); function OnBegin() NUMBER nHwndFlag, nResult; HWND hInstallHwnd; STRING szOperation, szFile, szPath, szDLL, szParameter; POINTER pszOperation, pszFile, pszPath, pszParameter; begin nHwndFlag = HWND_INSTALL; // GetWindowHandle retrieves the handle of the installation main window hInstallHwnd = GetWindowHandle(nHwndFlag); // Load shell32.DLL into memory. szDLL = DLL_FILE; nResult = UseDLL (szDLL); if (nResult != 0) then MessageBox ("UseDLL failed.\n\nCouldn't load .DLL file.", INFORMATION); abort; endif; szOperation="OPEN"; pszOperation=&szOperation; szFile="Notepad.exe"; pszFile=&szFile; szPath="C:\\Windows"; pszPath=&szPath; szParameter="C:\\Windows\\Temp\\Test.doc"; pszParameter=&szParameter; ShellExecuteA( hInstallHwnd, pszOperation, pszFile, pszParameter, pszPath, SW_SHOWMAXIMIZED); // The following removes Shell32.dll from memory. if (UnUseDLL (szDLL) < 0) then MessageBox("UnUseDLL failed.\n\nDLL still in memory.", SEVERE); endif; end; Note: The file extension associated with the program can also be used to launch a file. So, to use the file association for the .doc extension rather than using Notepad.exe as shown above, modify the appropriate lines in the sample script as shown below:szFile="Test.doc"; pszFile=&szFile; szPath="C:\\Windows\\Temp"; pszPath=&szPath; szParameter="";
function OnBegin()
STRING szProgram, szCmdLine;
begin
szProgram = "rundll32";
szCmdLine = "rnaui.dll,RnaWizard";
LaunchAppAndWait(szProgram, szCmdLine, WAIT);
end一个是调用API函数:
Discussion
Prototype the function as shown below: prototype Shell32.ShellExecuteA( HWND,LPSTR, LPSTR, LPSTR, LPSTR, INT);Call the function as you would any other. For example: ShellExecuteA(hInstallHwnd, pszOperation, pszFile, pszParameter, pszPath, SW_SHOWMAXIMIZED);
Below is a sample script that will launch a file, "Test.doc" (that is in the C:\Windows\Temp directory), using Notepad.exe:#define DLL_FILE "Shell32.dll"
// Prototype ShellExecuteA in Shell32.DLL.
prototype Shell32.ShellExecuteA( HWND,LPSTR, LPSTR, LPSTR, LPSTR, INT);
function OnBegin()
NUMBER nHwndFlag, nResult;
HWND hInstallHwnd;
STRING szOperation, szFile, szPath, szDLL, szParameter;
POINTER pszOperation, pszFile, pszPath, pszParameter;
begin
nHwndFlag = HWND_INSTALL;
// GetWindowHandle retrieves the handle of the installation main window
hInstallHwnd = GetWindowHandle(nHwndFlag);
// Load shell32.DLL into memory.
szDLL = DLL_FILE;
nResult = UseDLL (szDLL);
if (nResult != 0) then
MessageBox ("UseDLL failed.\n\nCouldn't load .DLL file.", INFORMATION);
abort;
endif;
szOperation="OPEN";
pszOperation=&szOperation;
szFile="Notepad.exe";
pszFile=&szFile;
szPath="C:\\Windows";
pszPath=&szPath;
szParameter="C:\\Windows\\Temp\\Test.doc";
pszParameter=&szParameter;
ShellExecuteA( hInstallHwnd, pszOperation, pszFile, pszParameter, pszPath, SW_SHOWMAXIMIZED);
// The following removes Shell32.dll from memory.
if (UnUseDLL (szDLL) < 0) then
MessageBox("UnUseDLL failed.\n\nDLL still in memory.", SEVERE);
endif;
end;
Note: The file extension associated with the program can also be used to launch a file. So, to use the file association for the .doc extension rather than using Notepad.exe as shown above, modify the appropriate lines in the sample script as shown below:szFile="Test.doc";
pszFile=&szFile;
szPath="C:\\Windows\\Temp";
pszPath=&szPath;
szParameter="";
如DLL为
DEMO.DLL
其中函数 TEST()为你想调用的函数,win api的调用或执行其他程序都
可以在这里实现
则调用方法为
CallDLLFx(SUPPORTDIR^"DEMO.DLL", "TEST" , nValue, SUPPORTDIR);
其中使用的默认路径为SUPPORTDIR,是安装时生成的临时路径
你也可以使用其他路径,只要调用它时能在这个路径找到该DLL