????? ??????? ExitWindowsExec() ?? VB ??? ????? ??? ???? MS-DOS

?????? ????????? ?????? ?????????
???? ???????: 147806 - ??? ???????? ???? ????? ????? ??? ???????.
??? ????? ??? ???????. ????? "??? ??" ??? ??? ??????? ??? ????.
????? ???? | ?? ????

?? ??? ??????

??????

???? ExitWindowsExec() ????? Windows ??? ????? ????? MS-DOS ???? ??? ?? ????? ????? Windows. ????? ????????? ???????? ?? ??? ??????? ????? ??????? ??? ?????? ?? Microsoft Visual Basic.

??????? ????

??? ??????? ?????? ExitWindowsExec() ???? ?????? ????? ??????? ???????? ?????? Windows ????? ???? ??? ????? Windows. ???? ????? ???????? ???? ?? ????? ??? ???? MS-DOS ???? ???? ?????? ??? ??? ????? ??? ?????? ????? ????? Windows. ????? ExitWindowsExec() ??? ???:
   ' Place the following declaration on one, single line:

  Private Declare Function ExitWindowsExec Lib "User" (ByVal lpszExe As String,
      ByVal lpszParams As Any) As Integer
				

??????? ??????: $ lpszExe

??? ?? ???? ??????? ?????? ?? ExitWindowsExec() $ lpszExe ????? ????? ??? ?????? ?????? ???? ???? ??? ????? ?????? ??????? ???? ???? ??????. ??? ?? ????? ??? ??? ??????? ??? ???? ?? 127 ?????. ??????? ???????, ?????? ??? ????? COMMAND.COM ????--C:\DOS\COMMAND.COM. ?????? ??? ???? ???? ???? ???? ?? Visual Basic ??? COMMAND.COM ? ????? ??????? ?????? $ ???? ?????? Environ:
   lpszExe$ = Environ$("COMSPEC")
				

?????? ??? ???? ?? ????????? ??? ?????? $ ???? ?????? Environ ?????? ?????? ??? ???? ??? Microsoft Visual Basic ?? ??????? "???????".

??????? ???????: $ lpszParams

??? ?? ???? ??????? ??????? ?? ??? ExitWindowsExec() $ lpszParams ????? ????? ??? ??? ?????? ???????? ????? ?????? ???????. ?? ???? ??????? ??? ?????? ????? ??? ???? ???? 0 ??? 0 &.

?????? ??? ???? ??? ????? ?? ???? ??? ?? ???? ????? ?????? ??? ????? ?????? ????? ?? ?????? ????? ?????. ??? ????? ????? ??????? ?? ??? ??????? /c ???? ???? MS-DOS ??????? ???? COMMAND.COM. ????? ??? ????:
   lpszParams$ = "/C C:\DIRNAME\GENERIC.BAT  PARAMETER1 PARAMETER2"
				

???? ??????? ?????? ??? ?? False ??? ??? ??????.

???? ???? ?????

  1. ???????? ??? ????? ?? MS-DOS ?? ?????? "???????" ?? Windows ? ?? ?????? ??? ???? ?? ?????? ????? ????? ?????? ???? C:\RUNIT.BAT. ????? ????????? ???????:
       @echo off
       echo Making Backup of autoexec.bat
       copy c:\autoexec.bat c:\*.bak
       echo Done
    
    						
  2. ??? ????? ???? ?? Visual Basic (Alt F? N). ??? ????? Form1 ???? ???????.
  3. ????? ????? ??????? ??? ?????? Declarations ??? ?? ???????:
       ' Place the following declaration on one, single line:
    
       Private Declare Function ExitWindowsExec Lib "User" (ByVal lpszExe As String, _
          ByVal lpszParams As Any) As Integer
    
    						
  4. ????? ?? ??? (Command1) ??? ??????? ?? ??? ???????? ???????? ??????? ?? ????? Click().
       Private Sub Command1_Click ()
          sComspec$ = Environ$("COMSPEC")
          ret% = ExitWindowsExec(sComspec$,  "/c c:\runit.bat")
       End Sub
    
    						
  5. ??? ??????? (Alt F? ???????). ?? ???? ??????? F5 ?????? ????????. ???? ??? ?? ????? ????? Windows ?? ????? ??? ???? ?? ??? ????? Windows.

???????

???? ???????: 147806 - ????? ??? ??????: 04/???? ??????/1435 - ??????: 1.1
????? ???
  • Microsoft Visual Basic 4.0 Professional Edition
  • Microsoft Visual Basic 4.0 16-bit Enterprise Edition
????? ??????: 
kbnosurvey kbarchive kbmt kbwndw KB147806 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????147806

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com