- CVI 정보나눔(www.cvi.kr)
- 스터디
- 질문답변
질문,답변
글 수 1,629
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);
이것은 각각의 프로그램 안에 넣어주어야되겠습니다.
아래는 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);