2.
一个方法是调用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="";
一个方法是调用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="";
解决方案 »
- 我想让各大搜索引擎都能搜索我的网站http://www.5158h.com,请问怎么才能做到?
- 主线程忙,会影响子线程吗?
- Unhandled exception in Poepoem.exe :0xC0000005 :Access Violation不知是什么意思
- MDI应用中,ar<<保存的文件是什么?
- 怎么利用VC新建一个XML文档呢?
- 初级问题,马上结贴
- ####从数据库日期问题
- 帮我出出题目
- 求助哪里可以下载windows CE toolkits for visual C++6.0
- 求:ReadFile与HID compliant device(自定义HID的设备驱动)通讯时有时超时的原因?
- VC的最新版本是多少?.net吗?
- 各位大虾,谁能帮我看看这个程序!
另外,能否将调用API函数:一段给讲解以下,谢谢
这个dll放着除了第一个对话框外的所有资源,随便用什么资源编辑器就可以了,