PDA

Click to See Complete Forum and Search --> : Help me in my first API Application


jamescrasto
May 15th, 2001, 12:31 PM
Hello,

I have a table storing picture filenames (.tif, .jpg, etc) and I am populating it on a DataGrid. The user is expected to double-click a particular row on the DataGrid to open up the selected filename in "Imaging" application (c:\windows\kodakimg.exe) which is shipped with Win98 (Start >Programs >Accessories >Imaging). After the user closes the "Imaging" application, control should return back to our program.

Kindly spare a moment to explain me how this can be accomplished using API calls. You may instruct only the API coding part, the rest is ready with me.

Thank you in advance,

James.

amitabh
May 15th, 2001, 01:23 PM
Use the ShellExecute api call

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
Const SW_SHOWNORMAL = 1
Private Sub Form_Load()
ShellExecute Me.hwnd, vbNullString, "c:\windows\kodakimg.exe", vbNullString, "C:\", SW_SHOWNORMAL
End Sub

Megatron
May 15th, 2001, 02:18 PM
You don't even need API for this. Use VB's Shell method.

Shell "c:\windows\kodakimg.exe MyImgFile.jpg", 1