高进程启动程序在VB里怎么写???? START/HIGH AA.EXE

cbxmir 2003-08-17 05:51:01
高进程启动程序在VB里怎么写????
在COMMAND里是这么写的,
START/HIGH AA.EXE
可是我要在VB里怎么写呢?
SHELL "CMD.EXE - START/HIGH AA.EXE" ????????????????
...全文
32 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
tonylk 2003-08-17
  • 打赏
  • 举报
回复
贴得太难看了,再贴一次:

Attribute VB_Name = "mdlShell"
'/*********************************************************************************
'
' サブプログラムの起動モジュールです。
' 作成者: 
'
'----------------------------------------------------------------------------------
' 修正履歴 修正者 内容
' 作成日: 平成14年7月23日 王 群 新規作成
'
'
'**********************************************************************************/
Option Explicit
Private isShellRight As Boolean
' API関数宣言
Public Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
' フォーム状態の定数宣言
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Public Const SWP_NOMOVE = 2
Public Const SWP_NOSIZE = 1
Public Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
' プロセスについてのAPI関数宣言
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwAccess As Long, ByVal lpCommandLine As Long, ByVal IDProcess As Long) As Long
Private Declare Function GetExitCodeProcess Lib "kernel32" (ByVal lpdExitCode As Long, hHandle As Long) As Boolean
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Boolean
' プロセスについての定数宣言
Private Const PROCESS_QUERY_INFORMATION = &H400
Private Const STILL_ACTIVE = &H103


' SHELLのプロセスを監視して、終了待ちを行う
' @parameter strprogram プログラム名
' @parameter strparameter パラメータ
Public Sub WaitShell(ByVal strprogram As String, ByVal strparameter As String)

isShellRight = True

On Error GoTo ErrWaitShell

Dim hShell As Long
Dim hProc As Long
Dim lExit As Long
Dim bret As Boolean

' プログラムの実行
Dim strcmdline As String
If strparameter = "" Then
strcmdline = strprogram
Else
strcmdline = strprogram & " " & strparameter
End If
hShell = Shell(strcmdline, vbNormalFocus)

' プロセスのオープン
hProc = OpenProcess(PROCESS_QUERY_INFORMATION, False, hShell)

' プロセスの終了待ち
Do
If GetExitCodeProcess(hProc, lExit) = False Then Exit Sub
Call Sleep(100)
DoEvents
Loop While lExit = STILL_ACTIVE

' ハンドルのクローズ
bret = CloseHandle(hProc)

Exit Sub

ErrWaitShell:
isShellRight = False
If Err.Number = 53 Or Err.Number = 76 Then
MsgBox "ウフミ・""" & strprogram & """ ボキィニッ」。", vbCritical
Else
MsgBox Err.Description
End If

End Sub

' OCRについてのSHELLのプロセスを監視して、終了待ちを行う
' @parameter strprogram プログラム名
' @parameter strparameter パラメータ
Public Function OcrWaitShell(ByVal strprogram As String, ByVal strparameter As String) As Boolean
Call WaitShell(strprogram, strparameter)
OcrWaitShell = isShellRight
End Function

tonylk 2003-08-17
  • 打赏
  • 举报
回复
CreateProcess()启动进程,其中有一个参数可以指定进程的优先级。
给你一小段代码:
Attribute VB_Name = "mdlShell"
'/*********************************************************************************
'
' ƒTƒuƒvƒƒOƒ‰ƒ€‚Ì‹N“®ƒ‚ƒWƒ…[ƒ‹‚Å‚·B
' ì¬ŽÒF@‰¤ŒQ
'
'----------------------------------------------------------------------------------
' C³—š—ð C³ŽÒ “à—e
' ì¬“úF@•½¬‚P‚S”N‚VŒŽ‚Q‚R“ú ‰¤@ŒQ V‹Kì¬
'
'
'**********************************************************************************/
Option Explicit
Private isShellRight As Boolean
' ‚`‚o‚hŠÖ”éŒ¾
Public Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
' ƒtƒH[ƒ€ó‘Ԃ̒萔éŒ¾
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Public Const SWP_NOMOVE = 2
Public Const SWP_NOSIZE = 1
Public Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
' ƒvƒƒZƒX‚ɂ‚¢‚Ä‚Ì‚`‚o‚hŠÖ”éŒ¾
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwAccess As Long, ByVal lpCommandLine As Long, ByVal IDProcess As Long) As Long
Private Declare Function GetExitCodeProcess Lib "kernel32" (ByVal lpdExitCode As Long, hHandle As Long) As Boolean
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Boolean
' ƒvƒƒZƒX‚ɂ‚¢‚Ă̒萔éŒ¾
Private Const PROCESS_QUERY_INFORMATION = &H400
Private Const STILL_ACTIVE = &H103


' ‚r‚g‚d‚k‚k‚̃vƒƒZƒX‚ðŠÄŽ‹‚µ‚āAI—¹‘Ò‚¿‚ðs‚¤
' @parameter strprogram ƒvƒƒOƒ‰ƒ€–¼
' @parameter strparameter ƒpƒ‰ƒ[ƒ^
Public Sub WaitShell(ByVal strprogram As String, ByVal strparameter As String)

isShellRight = True

On Error GoTo ErrWaitShell

Dim hShell As Long
Dim hProc As Long
Dim lExit As Long
Dim bret As Boolean

' ƒvƒƒOƒ‰ƒ€‚ÌŽÀs
Dim strcmdline As String
If strparameter = "" Then
strcmdline = strprogram
Else
strcmdline = strprogram & " " & strparameter
End If
hShell = Shell(strcmdline, vbNormalFocus)

' ƒvƒƒZƒX‚̃I[ƒvƒ“
hProc = OpenProcess(PROCESS_QUERY_INFORMATION, False, hShell)

' ƒvƒƒZƒX‚̏I—¹‘Ò‚¿
Do
If GetExitCodeProcess(hProc, lExit) = False Then Exit Sub
Call Sleep(100)
DoEvents
Loop While lExit = STILL_ACTIVE

' ƒnƒ“ƒhƒ‹‚̃Nƒ[ƒY
bret = CloseHandle(hProc)

Exit Sub

ErrWaitShell:
isShellRight = False
If Err.Number = 53 Or Err.Number = 76 Then
MsgBox "³ÌÐò """ & strprogram & """ ÎÞ·¨Æô¶¯£¡", vbCritical
Else
MsgBox Err.Description
End If

End Sub

' ‚n‚b‚q‚ɂ‚¢‚Ä‚Ì‚r‚g‚d‚k‚k‚̃vƒƒZƒX‚ðŠÄŽ‹‚µ‚āAI—¹‘Ò‚¿‚ðs‚¤
' @parameter strprogram ƒvƒƒOƒ‰ƒ€–¼
' @parameter strparameter ƒpƒ‰ƒ[ƒ^
Public Function OcrWaitShell(ByVal strprogram As String, ByVal strparameter As String) As Boolean
Call WaitShell(strprogram, strparameter)
OcrWaitShell = isShellRight
End Function

wumy_ld 2003-08-17
  • 打赏
  • 举报
回复
楼主用SHELL "CMD.EXE - START/HIGH AA.EXE"不行么?

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧