수다닷컴

  • 해외여행
    • 괌
    • 태국
    • 유럽
    • 일본
    • 필리핀
    • 미국
    • 중국
    • 기타여행
    • 싱가폴
  • 건강
    • 다이어트
    • 당뇨
    • 헬스
    • 건강음식
    • 건강기타
  • 컴퓨터
    • 프로그램 개발일반
    • C언어
    • 비주얼베이직
  • 결혼생활
    • 출산/육아
    • 결혼준비
    • 엄마이야기방
  • 일상생활
    • 면접
    • 취업
    • 진로선택
  • 교육
    • 교육일반
    • 아이교육
    • 토익
    • 해외연수
    • 영어
  • 취미생활
    • 음악
    • 자전거
    • 수영
    • 바이크
    • 축구
  • 기타
    • 강아지
    • 제주도여행
    • 국내여행
    • 기타일상
    • 애플
    • 휴대폰관련
  • 프로그램 개발일반
  • C언어
  • 비주얼베이직

뭐가문제죠??[급함!!]

두동

2023.04.01


질문 제목 : 이거 실행하고 버튼클릭하면 다른한게가 같이클릭돼고 실행해보시면 알꺼에요 수정좀;;질문 내용 :
#include windows.h
#include tchar.h
lresult callback wndproc(hwnd,uint,wparam,lparam);
hinstance g_hinst;
lpwstr lpszclass=lapibase;
int apientry winmain(hinstance hinstance,hinstance hprevinstance
,lpstr lpszcmdparam,int ncmdshow)
{
hwnd hwnd;
msg message;
wndclass wndclass;
g_hinst=hinstance;
wndclass.cbclsextra=0;
wndclass.cbwndextra=0;
wndclass.hbrbackground=(hbrush)getstockobject(white_brush);
wndclass.hcursor=loadcursor(null,idc_arrow);
wndclass.hicon=loadicon(null,idi_application);
wndclass.hinstance=hinstance;
wndclass.lpfnwndproc=(wndproc)wndproc;
wndclass.lpszclassname=lpszclass;
wndclass.lpszmenuname=null;
wndclass.style=cs_hredraw | cs_vredraw;
registerclass(&wndclass);
hwnd=createwindow(lpszclass,lpszclass,ws_overlappedwindow,
cw_usedefault,cw_usedefault,cw_usedefault,cw_usedefault,
null,(hmenu)null,hinstance,null);
showwindow(hwnd,ncmdshow);
while(getmessage(&message,0,0,0))
{
translatemessage(&message);
dispatchmessage(&message);
}
return message.wparam;
}
#define id_chk_retangle 300
#define id_chk_ellipse 301
lresult callback wndproc(hwnd hwnd,uint imessage,wparam wparam,lparam lparam)
{
hdc hdc;
paintstruct ps;
static hwnd hchkrectangle, hchkellipse;
static bool bellipse = false;
static bool brectangle = false;

switch(imessage) {

case wm_create:
///////// 일반 버튼 생성 /////////
//mymethod()(lbutton,l버튼1,ws_child | ws_visible | bs_pushbutton,
// 20,20,100,25,hwnd,(hmenu)100, g_hinst,null);
createwindow(lbutton,l버튼1,ws_child | ws_visible | bs_pushbutton,
20,20,100,25,hwnd,(hmenu)100, g_hinst,null);
createwindow(lbutton,l버튼2,ws_child | ws_visible | bs_pushbutton,
20,60,100,25,hwnd,(hmenu)200, g_hinst,null);

//////////// 체크 박스 생성 ///////////
hchkrectangle = createwindow(lbutton,l사각형,ws_child | ws_visible | bs_checkbox,
20,120,80,25,hwnd,(hmenu)id_chk_retangle, g_hinst,null);
hchkellipse = createwindow(lbutton,l타원,ws_child | ws_visible | bs_checkbox,
20,160,80,25,hwnd,(hmenu)id_chk_ellipse, g_hinst,null);
case wm_command:
switch(loword(wparam))
{
case 100:
messagebox(hwnd, l버튼1에 이벤트를 발생시켰습니다., lbutton, mb_ok);
break;
case 200:
messagebox(hwnd, l버튼2에 이벤트를 발생시켰습니다., lbutton, mb_ok);
break;
}
case id_chk_ellipse:
if(sendmessage(hchkellipse, bm_getcheck, 0, 0) == bst_unchecked)
{
sendmessage(hchkellipse, bm_setcheck , bst_checked, 0);
bellipse = true;
}
else
{
sendmessage(hchkellipse, bm_setcheck, bst_unchecked, 0);
bellipse = false;
}
invalidaterect(hwnd, null, true);
break;

case id_chk_retangle:
if(sendmessage(hchkrectangle, bm_getcheck, 0,0 ) == bst_unchecked)
{
sendmessage(hchkrectangle, bm_setcheck, bst_checked, 0);
brectangle = true;
}
else
{
sendmessage(hchkrectangle, bm_setcheck, bst_unchecked, 0);
brectangle = false;
}
invalidaterect(hwnd, null, true);
break;

case wm_paint:
hdc=beginpaint(hwnd, &ps);
if(brectangle == true)
rectangle(hdc, 150, 120, 250, 200);
if(bellipse == true)
ellipse(hdc, 150, 120, 250, 200);
endpaint(hwnd, &ps);
return 0;
case wm_destroy:
postquitmessage(0);
return 0;
}
return(defwindowproc(hwnd,imessage,wparam,lparam));
}

신청하기





COMMENT

댓글을 입력해주세요. 비속어와 욕설은 삼가해주세요.

번호 제 목 글쓴이 날짜
2698829 학점계산기 (7) MyWay 2025-06-20
2698782 기초적인 함수 질문이요ㅠㅠㅠㅠ 내담 2025-06-20
2698749 프로그램 짜던 도중 패닉입니다...ㅜ 파랑 2025-06-19
2698719 조건부컴파일 질문입니다.~ (2) 큐트 2025-06-19
2698693 재귀 함수 에러 바닐라 2025-06-19
2698673 고민이있는데 들어좀주세요!! (1) 초코맛캔디 2025-06-19
2698644 1부터 n까지의 합을 구하는데 엄청긴숫자의 합을 구할때는 어떻게 해야하나요? (4) 슬우 2025-06-18
2698616 다른 함수로 안넘어갑니다..;;; 도1도캣 2025-06-18
2698587 배열하다 막혀서... (3) WhiteCat 2025-06-18
2698559 문자열을 비우는방법 (2) 하늘 2025-06-18
2698528 착하고 친절한 선생씌구해염~ㅋㅋ (4) 옆집언니야 2025-06-17
2698502 자료구조 큐 캔서 2025-06-17
2698477 실행화면 배경문의요 선아 2025-06-17
2698430 변수의 값이 저장이 않되네요;; (4) 피네 2025-06-16
2698404 C#을 배울려고 하는데 C나 C++을 알아야 하나요 ?? (1) 신당 2025-06-16
2698342 프로그램 질문점녀 (4) 데빌의눈물 2025-06-16
2698318 파일 입출력 질문입니다~ (2) 꽃 2025-06-15
2698291 문자 출력 함수 : putchar, fputc에 관하여. 으뜸 2025-06-15
2698261 씨언어 (1) 마리 2025-06-15
2698212 구조체, 포인터가 같이 들어간 프로그램 소스코드 있으신분? (4) 그림자 2025-06-14
<<  이전  1 2 3 4 5 6 7 8 9 10  다음  >>

수다닷컴 | 여러분과 함께하는 수다토크 커뮤니티 수다닷컴에 오신것을 환영합니다.
사업자등록번호 : 117-07-92748 상호 : 진달래여행사 대표자 : 명현재 서울시 강서구 방화동 890번지 푸르지오 107동 306호
copyright 2011 게시글 삭제 및 기타 문의 : clairacademy@naver.com