Click to See Complete Forum and Search --> : API - Query


Balaji
April 12th, 1999, 08:37 AM
Hi there

I am calling a clipper executable in my VB program. I am using Win95
APIs for that.
Code as follows

Private Declare Function OpenProcess Lib "kernel32" (ByVal
dwDesiredAccess As Long, ByVal bInheritHandle _
As Long, ByVal dwProcessId As Long) As Long

Private Declare Function GetExitCodeProcess Lib "kernel32" (ByVal
hProcess As Long, lpExitCode As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As
Long)
Const STILL_ACTIVE = &H103
Const PROCESS_QUERY_INFORMATION = &H400


Sub Shell32Bit(ByVal JobToDo As String)
Dim hProcess As Long
Dim RetVal As Long
'The next line launches JobToDo as icon,
'captures process ID
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False,
Shell(JobToDo, 6))
Do
'Get the status of the process
GetExitCodeProcess hProcess, RetVal
'Sleep command recommended as well
'as DoEvents
DoEvents: Sleep 100
'Loop while the process is active
Loop While RetVal = STILL_ACTIVE
MsgBox "Notepad terminated by user"
End Sub

Option Explicit

Private Sub Command1_Click()
Dim JobToDo As String
JobToDo = "d:\sita\convert.exe FEB99 FEB99" ' our exe
Shell32Bit JobToDo
End Sub

The following clipper settings also made in the config.sys
1. set clipper=f:70
2. files=70
3. buffers=80

Now the problem is The above code just opens a DOS windows and it
closes. It doesn't show the clipper screen.This code works with any
other DOS based program. Our clipper executable works well if we
execute thru DOS mode.

How we can solve this problem. Please help us
Waiting for ur reply.
Thanks for your cooperation.
Saju Varghese

LALeonard
April 12th, 1999, 10:51 AM
This is the C++ section. You will have better luck posting this to the VB section.

LA Leonard - Definitive Solutions, Inc.

Masaaki
April 12th, 1999, 11:59 AM
Hi.

I used to study VB at my school, and I almost forgot VB code.

However, this line shows that you code must be executed by DOS mode.

JobToDo = "d:\sita\convert.exe FEB99 FEB99" ' our exe
Shell32Bit JobToDo

FEB99 and FEB99 shows command line arguements is these.
(I'm not sure why you need two arguements.)
So, it is normal situation that exe run on DOS.
I'm not sure that VB support both console application and Windows.
For example, VC has the console app supported MFC.

Next time, you had better post your question at VB section.

Hope for help?
-Masaaki Onishi-