f_run_outlook.srf 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. $PBExportHeader$f_run_outlook.srf
  2. global type f_run_outlook from function_object
  3. end type
  4. forward prototypes
  5. global subroutine f_run_outlook (string as_email_title, string as_email_add, string as_email_attach)
  6. end prototypes
  7. global subroutine f_run_outlook (string as_email_title, string as_email_add, string as_email_attach);string ls_outlook,ls_attach,ls_addressee,ls_run_string,ls_path
  8. string ls_temp
  9. int li_ret
  10. //Microsoft Outlook 程序所在安全路径
  11. //ls_outlook = "C:\Program Files\Microsoft Office\Office12\outlook.exe"
  12. //office2010
  13. li_ret = RegistryGet("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\14.0\Common\InstallRoot",&
  14. "Path", RegString!, ls_outlook)
  15. if li_ret = 1 then
  16. goto nxt
  17. end if
  18. //office2007
  19. li_ret = RegistryGet("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\12.0\Common\InstallRoot",&
  20. "Path", RegString!, ls_outlook)
  21. if li_ret = 1 then
  22. goto nxt
  23. end if
  24. //office2003
  25. li_ret = RegistryGet("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0\Common\InstallRoot",&
  26. "Path", RegString!, ls_outlook)
  27. if li_ret = 1 then
  28. goto nxt
  29. end if
  30. ls_outlook = "C:\Program Files\Microsoft Office\Office\"
  31. nxt:
  32. ls_outlook += "outlook.exe"
  33. //收件人信箱
  34. //ls_addressee = "ferryman@163.net"
  35. //添加附件
  36. //ls_attach = "c:\test.txt"
  37. //生成完整的执行命令
  38. ls_run_string = '"' + ls_outlook + '" /c IPM.Note '
  39. if ls_addressee <> "" then
  40. ls_run_string += ' /m ' + ls_addressee
  41. end if
  42. if ls_path <> "" then
  43. ls_run_string += ' /a' + ls_path
  44. end if
  45. //执行程序
  46. run(ls_run_string)
  47. end subroutine