这是我在PB中实现的,用于根据扩展名打开相应的程序,你可参考
用的是API函数ShellExecuteA 
Function ulong ShellExecuteA ( ulong hwnd , string lpOperation, string lpFile, string lpParameters, string lpDirectory, ulong nShowCmd )  library "shell32.dll"//ADD gaolan:打开文件(window系统可识别的文件)
//Return 0 不成功
//       1 成功ulong lu_hwnd, lu_nShowCmd, lu_rtn
string ls_lpOperation, ls_lpFile, ls_lpParameters, ls_lpDirectoryif isnull(as_documentname) or trim(as_documentname) = "" then
MessageBox('错误','无效的文件名!',StopSign!)
return 0
end ifif isnull(as_path) or trim(as_path) = "" then
as_path = is_AppPath
end ifif IsValid(aw_currentwin) then
lu_hwnd = Handle(aw_currentwin)
//ADD gaolan:open文件方式为可读写活动窗口
lu_nShowCmd = 5
ls_lpOperation= "open"
ls_lpFile = as_documentname
ls_lpDirectory = as_path
setnull(ls_lpparameters)
lu_rtn = ShellExecuteA( lu_hwnd, ls_lpOperation, ls_lpFile, ls_lpParameters, ls_lpDirectory, lu_nShowCmd)
Choose Case lu_rtn
Case 2
MessageBox('错误','指定的文件或路径不存在!',StopSign!)
return 0
Case 3
MessageBox('错误','指定的文件路径不存在!',StopSign!)
return 0
Case 5
MessageBox('错误','操作系统无法识别该文件!',StopSign!)
return 0
case 8
MessageBox('错误','系统内存不足,无法完成操作!',StopSign!)
return 0
case 11
MessageBox('错误','非法的WIN32文件!',StopSign!)
return 0
case 26
MessageBox('错误','该文件正在被其他文件使用!',StopSign!)
return 0
case 27
MessageBox('错误','错误的文件名!',StopSign!)
return 0
case 31
MessageBox('错误','系统无法识别该文件类型!',StopSign!)
return 0
case 32
MessageBox('错误','该文件动态连接库不存在!',StopSign!)
return 0
case is > 32
Return 1
case else
MessageBox('错误','打开文件错误!',StopSign!)
return 0
end Choose
end if