Forum: สอบถามปัญหา Notes ทางด้านพัฒนาโปรแกรม (Note Client) |
Tags1: IBM Lotus Domino/Notes| Created on Aug 4, 2011, 11:19 AM by GeoSpherE/9Notes|Topic Responses: 2 |
&action=openDocument&documentId=A4E |
คือผมเีขียน code ในปุ่ม บังคับให้เปิด PDF ด้วย adobe reader ของเครื่องตัวเอง
เนื่องจาก client มี windows หลาย version จึงต้องเช็คทุก path ที่เป็นไปได้
ถ้าผม hardcode แบบนี้จะเปิดได้
Sub Click(Source As Button)
Dim ret As Integer
file$ = "S:\test.pdf"
path$ = "C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe"
tmp$ = path$ & " " & file$
ret = Shell(tmp$, 1)
End Sub
พอเปลี่ยนมาเป็นแบบนี้ จะ error ครับ
Sub Click(Source As Button)
file$ = "S:\test.pdf"
Dim ret As Integer
Dim s As New NotesSession
Dim stream As NotesStream
Set stream = s.CreateStream
Dim path(0 To 7) As String
Dim fileexe(0) As String
path(0) = "C:\Program Files\Adobe\Reader 7.0\Reader\"
path(1) = "C:\Program Files\Adobe\Reader 8.0\Reader\"
path(2) = "C:\Program Files\Adobe\Reader 9.0\Reader\"
path(3) = "C:\Program Files\Adobe\Reader 10.0\Reader\"
path(4) = "C:\Program Files (x86)\Adobe\Reader 7.0\Reader\"
path(5) = "C:\Program Files (x86)\Adobe\Reader 8.0\Reader\"
path(6) = "C:\Program Files (x86)\Adobe\Reader 9.0\Reader\"
path(7) = "C:\Program Files (x86)\Adobe\Reader 10.0\Reader\"
fileexe(0) = "AcroRd32.exe"
Forall p In path
Forall f In fileexe
If stream.Open(p & f) Then
tmp$ = p & f & " " & file$
ret = Shell(tmp$, 1)
Exit Sub
End If
End Forall
End Forall
Msgbox "Can't find any program for open file PDF on your PC"
End Sub
จะ error "illegal funciton call" ตรงบรรทัด ret = Shell(tmp$ , 1) นะครับ
ไม่เข้าใจจริงๆ มันเป็นเพราะอะไรครับ
ปล.ผมใช้ Notes7 ครับ |
|