FindWindow API, 사용자로 부터 입력받고싶습니다.
새늘
2023.04.01
질문 제목 : FindWindow API, 사용자로 부터 입력받고싶습니다.질문 요약 :printf로 윈도우네임을 입력받고 입력받은 윈도우네임을 변수에 집어넣고싶습니다.그리고 있는지 없는지 반환하는거구요.질문 내용 : 소스는 다음과 같습니다
#include Windows.h
#include stdio.h
int main(){
HWND hFind;
char* WN = TEXT(제목 없음 - 메모장);
hFind = FindWindow(NULL,WN);
if (hFind NULL){
printf(있음);
}else{
printf(없음);
}
return 0;}
변수안에다 바로 초기화한상태에서는 되더군요.허나,
#include Windows.h
#include stdio.h
int main(){
HWND hFind;
char* WN;
printf(Window Name : );
scanf(TEXT(%c), &WN);hFind = FindWindow(NULL,WN);
if (hFind NULL){
printf(있음);
}else{
printf(없음);
}
return 0;}
로 고치면 프로그램의 응답이 없습니다, 해결책을 마련해주세요.