질문,답변

글 수 1,629

[re] CVI프로그램에서 컴퓨터 종료

조회 수 1535 추천 수 0 2005.02.04 09:45:15
허창원 *.38.241.65
출장 중이라 자세히 설명드리기가 어렵네요.
Windows API함수 중에 ExitWindowsEx()가 있네요.

Import Library는 user32.lib 이구요,
함수에 대한 설명은 MSDN 도움말에 잘 나와 있는데, 아래에 퍼놓았습니다.
Windows API 함수 사용에 대해서는 강좌 10을 참고하세요.

--------------------------------------------------------
ExitWindowsEx

The ExitWindowsEx function either logs off the current user, shuts down the system, or shuts down and restarts the system. It sends the WM_QUERYENDSESSION message to all applications to determine if they can be terminated.

BOOL ExitWindowsEx(
  UINT uFlags,       // shutdown operation
  DWORD dwReserved   // reserved
);

Parameters
uFlags
Specifies the type of shutdown. This parameter must include one of the following values:

Value Meaning
EWX_LOGOFF Shuts down all processes running in the security context of the process that called the ExitWindowsEx function. Then it logs the user off.

EWX_POWEROFF Shuts down the system and turns off the power. The system must support the power-off feature.
Windows NT: The calling process must have the SE_SHUTDOWN_NAME privilege. For more information, see the following Remarks section.

EWX_REBOOT Shuts down the system and then restarts the system.
Windows NT: The calling process must have the SE_SHUTDOWN_NAME privilege. For more information, see the following Remarks section.

EWX_SHUTDOWN Shuts down the system to a point at which it is safe to turn off the power. All file buffers have been flushed to disk, and all running processes have stopped.
Windows NT: The calling process must have the SE_SHUTDOWN_NAME privilege. For more information, see the following Remarks section.


This parameter can optionally include the following values:
Value Meaning
EWX_FORCE Forces processes to terminate. When this flag is set, the system does not send the WM_QUERYENDSESSION and WM_ENDSESSION messages. This can cause the applications to lose data. Therefore, you should only use this flag in an emergency.

EWX_FORCEIFHUNG Windows NT 5.0 and later: Forces processes to terminate if they do not respond to the WM_QUERYENDSESSION or WM_ENDSESSION message. This flag is ignored if EWX_FORCE is used.


dwReserved
Reserved; this parameter is ignored.
Return Values
If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, callGetLastError.

송성희

2007.02.16 15:07:32
*.38.189.9

LaunchExecutable ("shutdown -s -f -t 0");

전 이렇게 강제 종료를 시켰습니다. 운용체제에 무리를 주는지 알수가 없지만, 잘 실행 되더라고요^^;;
List of Articles
번호 제목 글쓴이 날짜 조회 수
공지 이제부터 질문은 LabWindows/CVI 카페를 이용하면 더 좋겠습니다 운영자 2020-11-11 1235
공지 파일(특히 그림파일)을 올리실 때의 유의사항 운영자 2004-07-16 100157
689 시리얼 통신 종료시 문제에 대한 질문 [2] 조내수 2005-02-22 1564
688 [re] 저역시 동일한 문제로 고민중입니다. ^^; [6] 명관범 2005-02-23 1653
687 [re] InstallComCallback() 를 썼을 때 프로그램 종료시 유의사항 [3] 허창원 2005-02-23 2489
686 win32api 호출시.. [2] 서치영 2005-02-21 1560
685 [re] win32api ReadFile() 호출시 허창원 2005-02-22 1799
684 CVI의 장단점에 대해 자세하게 알고 싶습니다. [1] 육면체 2005-02-18 1641
683 Message 전달관련 질문 서치영 2005-02-16 1544
682 [re] Message 전달하는 대신 콜백함수를 바로 호출 [1] 허창원 2005-02-16 1695
681 강좌L015 해답을 자료실에 올려주시길 바랍니다... file [3] 강상욱 2005-02-12 1536
680 [re] 님이 올리신 걸 약간 수정했습니다 file 허창원 2005-02-12 1529
679 cvi5.0에서 object module loading이 안되는 문제 [1] 함충균 2005-02-11 1478
678 [질문] Cvi프로그램에서 컴퓨터 종료 정성윤 2005-02-02 1626
» [re] CVI프로그램에서 컴퓨터 종료 [1] 허창원 2005-02-04 1535
676 List Box에 폴더및 화일명 수록방법? [1] 유비 2005-01-29 1548
675 Popup창안에 있는 버튼의 글자 바꾸는 방법? [1] 유비 2005-01-28 1634
674 CVI 실행 오류 [2] 김대현 2005-01-27 1540
673 하나의 윈도우로 여러개 프로그램 실행? CVI 질문 2005-01-27 1559
672 [re] 하나의 Application Instance 만 실행하기 허창원 2005-01-27 1551
671 Far Point에서 만든 spread sheet라는 ActiveX에서 질문요... 김정욱 2005-01-27 1626
670 버튼의 한글 세팅 질문 질문 2005-01-26 1721