1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| Dim ret As Long
Dim Scr_hDC As Long
Try
Scr_hDC = GetDesktopWindow()
MessageBox.Show(filename, "Exper-PDF", MessageBoxButtons.OK, MessageBoxIcon.Error)
ret = ShellExecute(Scr_hDC, "Open", filename, "", "C:\TEMP\", 1)
Dim msg As String
If ret <= 32 Then
'There was an error
Select Case ret
Case SE_ERR_FNF
msg = "File not found"
Case SE_ERR_PNF
msg = "Path not found"
Case SE_ERR_ACCESSDENIED
msg = "Access denied"
Case SE_ERR_OOM
msg = "Out of memory"
Case SE_ERR_DLLNOTFOUND
msg = "DLL not found"
Case SE_ERR_SHARE
msg = "A sharing violation occurred"
Case SE_ERR_ASSOCINCOMPLETE
msg = "Incomplete or invalid file association"
Case SE_ERR_DDETIMEOUT
msg = "DDE Time out"
Case SE_ERR_DDEFAIL
msg = "DDE transaction failed"
Case SE_ERR_DDEBUSY
msg = "DDE busy"
Case SE_ERR_NOASSOC
msg = "No association for file extension"
Case ERROR_BAD_FORMAT
msg = "Invalid EXE file or error in EXE image"
Case Else
msg = "Unknown error"
End Select
MessageBox.Show(msg, "Exper-PDF", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
MessageBox.Show(CStr(ret), "Exper-PDF", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
Catch ex As Exception
MessageBox.Show(ex.ToString & "ret :" & CStr(ret), "Exper-PDF", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try |
Partager