윈도우즈 프로세스 킬이 가능한가요?

skypigzz의 이미지

visual c++에서 winexc를 통해 vlc 플레이어(영상 재생)를 재생하고 나서,

이것을 죽일 수 있는 명령어가 있나요?

예를 들어 재생되고 있는 윈도우 창을 버튼을 누름으로써 재생 되던 것을 죽일 수 있나요?

있다면 어떤 식으로 죽일 수 있는지 예를 들어 주실 수 있나요?

cyana의 이미지

msdn, google, codeguru, codeproject 등의 사이트를 돌아다녀 보시면 꽤 많은 정보를 얻을 수 있습니다.

시스템에서 실행중인 프로세스를 오픈하여 각 프로세스의 이름을 체크해서 일치하는 이름이 있는 process handle을 close하면 죽습니다. 관련 API:

CreateToolhelp32Snapshot()
Process32First()
Process32Next()
OpenProcess()
CloseHandle()

다른 방법은(window의 title을 알 경우), FindWindow()로 window handle을 얻어와 SendMessage() 함수로 WM_QUIT 같은 메시지를 보내 죽일 수도 있고, 만일 특정 이벤트를 실행해야 한다면 WM_QUIT 말고도 다른 메시지를 보내 버튼이 눌린 것처럼 할 수도 있죠.

phonon의 이미지

API로 하실려면 cyana님의 답변을 참고하시고, 명령어가 하시려면
tasklist, taskkill을 사용하세요.

--------------------------

c:\>tasklist

--------------------------

ex)process ID 강제종료
c:\>taskkill /F /PID 1234

ex)program name 강제종료
c:\>taskkill /F /IM notepad.exe
--------------------------

ps)한글자판이 아니라...

glay의 이미지

자매품 findstr 을 사용하시면 더욱 좋습니다.

ex) tasklist | findstr cmd

grep 처럼 사용하실수 있어요;;

--------------- 절취선 ------------------------
하늘은 스스로 삽질하는 자를 삽으로 팬다.

http://glay.pe.kr


--------------- 절취선 ------------------------
하늘은 스스로 삽질하는 자를 삽으로 팬다.

http://glay.pe.kr

blueiur의 이미지


윈도우 홈에디션에는 없습니다.
고로 사용하면 큰일날수 있겠죠?

phonon의 이미지

다른 명령어도 있습니다.

ex)tskill 프로그램명/아이디
c:\>tskill notepad

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.