۱۲-اسفند-۱۳۸۶, ۱۸:۳۲:۵۹
سلام
اين دستور كه خيلي تو برنامه نويسي به درد من خورده. اميد وارم به درد شما هم بخوره . مثلا براي نوشتن يك اتوماسيون اداري و براي ديدن فايلهاي پيوست يك نامه
با دوتا كامند و يك تكست ويك كامند ديالوگ و با استفاده از دستوري كه براتون مي زارم
اميد وارم خوشتون بياد.
'***********************************************************
#If Win32 Then
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile _
As String, ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
#Else
Private Declare Function ShellExecute Lib "SHELL" (ByVal hwnd%, _
ByVal lpszOp$, ByVal lpszFile$, ByVal lpszParams$, _
ByVal lpszDir$, ByVal fsShowCmd%) As Integer
Private Declare Function GetDesktopWindow Lib "USER" () As Integer
#End If
Const SW_SHOWNORMAL = 1
Dim r As Long
'Insert this code to your form:
Private Function StartDoc(DocName As String) As Long
Dim Scr_hDC As Long
Scr_hDC = GetDesktopWindow()
StartDoc = ShellExecute(Scr_hDC, "Open", DocName, "", Left$(Text1.Text, 3), SW_SHOWNORMAL)
End Function
Private Sub Command1_Click()
Dim pr As String
pr = Text1.Text
r = StartDoc(pr)
End Sub
Private Sub Command2_Click()
Dialog1.fliter = "(*.*)|*.*"
Dialog1.ShowOpen
If Dialog1.FileName <> "" Then
Text1.Text = Dialog1.FileName
End If
End Sub
اين دستور كه خيلي تو برنامه نويسي به درد من خورده. اميد وارم به درد شما هم بخوره . مثلا براي نوشتن يك اتوماسيون اداري و براي ديدن فايلهاي پيوست يك نامه
با دوتا كامند و يك تكست ويك كامند ديالوگ و با استفاده از دستوري كه براتون مي زارم
اميد وارم خوشتون بياد.
'***********************************************************
#If Win32 Then
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile _
As String, ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
#Else
Private Declare Function ShellExecute Lib "SHELL" (ByVal hwnd%, _
ByVal lpszOp$, ByVal lpszFile$, ByVal lpszParams$, _
ByVal lpszDir$, ByVal fsShowCmd%) As Integer
Private Declare Function GetDesktopWindow Lib "USER" () As Integer
#End If
Const SW_SHOWNORMAL = 1
Dim r As Long
'Insert this code to your form:
Private Function StartDoc(DocName As String) As Long
Dim Scr_hDC As Long
Scr_hDC = GetDesktopWindow()
StartDoc = ShellExecute(Scr_hDC, "Open", DocName, "", Left$(Text1.Text, 3), SW_SHOWNORMAL)
End Function
Private Sub Command1_Click()
Dim pr As String
pr = Text1.Text
r = StartDoc(pr)
End Sub
Private Sub Command2_Click()
Dialog1.fliter = "(*.*)|*.*"
Dialog1.ShowOpen
If Dialog1.FileName <> "" Then
Text1.Text = Dialog1.FileName
End If
End Sub