티스토리 툴바

달력

012012  이전 다음

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  •  
  •  
  •  
  •  
코드 상에서 shellexecute , createprocess 를 이용하면 프로세스를 만들자마자 바로 리턴해버리므로 생성된 프로세스가 아직 제대로 초기화되기 전이라서 내린 지시를 받아들이지 못하는 일이 생길 수 있다. 그런 경우  아래의 함수를 이용하면 해당 프로세스가 초기화를 마치고 사용자의 Input 을 처리할 수 있을 때 까지 기다렸다가 리턴을 해준다.



DWORD WINAPI WaitForInputIdle(
  __in  HANDLE hProcess,
  __in  DWORD dwMilliseconds
);

Parameters

hProcess [in]

A handle to the process. If this process is a console application or does not have a message queue, WaitForInputIdle returns immediately.

dwMilliseconds [in]

The time-out interval, in milliseconds. If dwMilliseconds is INFINITE, the function does not return until the process is idle.

Return Value

The following table shows the possible return values for this function.

Return code/valueDescription
0

The wait was satisfied successfully.

WAIT_TIMEOUT

The wait was terminated because the time-out interval elapsed.

WAIT_FAILED

An error occurred.

 




저작자 표시 비영리
Posted by 철없는아이