이 예제에서는 이 메서드를 사용하여 Shell 메모장 애플리케이션을 시작한 다음 My.Computer.Keyboard.SendKeys 메서드를 사용하여 키 입력을 전송하여 문장을 인쇄합니다.
예시
Dim ProcID As Integer
' Start the Notepad application, and store the process id.
ProcID = Shell("NOTEPAD.EXE", AppWinStyle.NormalFocus)
' Activate the Notepad application.
AppActivate(ProcID)
' Send the keystrokes to the Notepad application.
My.Computer.Keyboard.SendKeys("I ", True)
My.Computer.Keyboard.SendKeys("♥", True)
My.Computer.Keyboard.SendKeys(" Visual Basic!", True)
' The sentence I ♥ Visual Basic! is printed on Notepad.
강력한 프로그래밍
ArgumentException 요청된 프로세스 식별자가 있는 애플리케이션을 찾을 수 없는 경우 예외가 발생합니다.
.NET Framework 보안
함수를 Shell
호출하려면 완전 신뢰(SecurityException 클래스)가 필요합니다.
참고하십시오
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET