질문,답변

글 수 1,629

[re] 하나의 Application Instance 만 실행하기

조회 수 1552 추천 수 0 2005.01.27 12:59:41
허창원 *.19.44.231
CheckForDuplicateAppInstance() 함수를 이용하면, 똑같은 프로그램의 다른 instance가 실행되어 있는지를 체크할 수 있습니다.
이것은 각각의 프로그램 안에 넣어주어야되겠습니다.

아래는 CVI의 도움말을 옮겼습니다. 예제를 보시면 활용하실 수 있을 겁니다.

-------------------------------------------------------------------
CheckForDuplicateAppInstance

int CheckForDuplicateAppInstance (int activateOtherInstance, int *thereIsAnotherInstance);

Purpose
Determines if another copy of the same executable is running, but only if the other copy has already called this function. You can pass ACTIVATE_OTHER_INSTANCE in activateOtherInstance to bring the other copy to the foreground.

Use CheckForDuplicateAppInstance to prevent two instances of your application from running at the same time.

Example
#include <cvirte.h>
int main (int argc, char *argv[])
{

    int thereIsAnother;

    if (InitCVIRTE (0, argv, 0) == 0)
        return -1; /* out of memory */

    if (CheckForDuplicateAppInstance (ACTIVATE_OTHER_INSTANCE, &thereIsAnother) < 0)
        return -1; /* out of memory, or not Win 2000/NT/9x */
    
    if (thereIsAnother)
        return 0; /* prevent duplicate instance */
    
    return 0;

}

Prototype
int CheckForDuplicateAppInstance (int Activate_Other_Instance, int *There_Is_Another_Instance);
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
677 [re] CVI프로그램에서 컴퓨터 종료 [1] 허창원 2005-02-04 1535
676 List Box에 폴더및 화일명 수록방법? [1] 유비 2005-01-29 1549
675 Popup창안에 있는 버튼의 글자 바꾸는 방법? [1] 유비 2005-01-28 1635
674 CVI 실행 오류 [2] 김대현 2005-01-27 1541
673 하나의 윈도우로 여러개 프로그램 실행? CVI 질문 2005-01-27 1560
» [re] 하나의 Application Instance 만 실행하기 허창원 2005-01-27 1552
671 Far Point에서 만든 spread sheet라는 ActiveX에서 질문요... 김정욱 2005-01-27 1626
670 버튼의 한글 세팅 질문 질문 2005-01-26 1721