뭐가문제죠??[급함!!]
두동
질문 제목 : 이거 실행하고 버튼클릭하면 다른한게가 같이클릭돼고 실행해보시면 알꺼에요 수정좀;;질문 내용 :
#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));
}
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2693788 | 이런 함수는 없나요? (3) | 앤드류 | 2025-05-05 |
2693758 | txt파일 불러와서 행렬로 저장 | 큰애 | 2025-05-05 |
2693727 | scanf 오류 문제!! (2) | 큰나래 | 2025-05-04 |
2693704 | 구조체 주소록 문제인데 도와주세요 (2) | 도1도캣 | 2025-05-04 |
2693676 | 열혈강의 c언어 질문입니다 | 하양이 | 2025-05-04 |
2693647 | 12.620000 을요 12.620 으로 어떻게 표현해요? (2) | 파도 | 2025-05-04 |
2693619 | 타이틀 코드.. | 단순드립 | 2025-05-03 |
2693591 | 컴파일 에러에서 질문드립니다 (3) | 게자리 | 2025-05-03 |
2693463 | 동적할당 이용시 fwrite사용을 어떻게 해야하나요..? (10) | 일본어못해요 | 2025-05-02 |
2693387 | 배열문제입니다 수정오류캡쳐했습니다 (6) | 연하얀 | 2025-05-01 |
2693356 | text 입출력 내림차순 질문입니다 ㅠ | 빛글 | 2025-05-01 |
2693328 | C언어를이용해서 .txt파일 외에 다른 확장자 파일 삭제가 가능한지.. (2) | 대나무 | 2025-05-01 |
2693299 | 파일입출력 바이너리파일 | 독특한 | 2025-04-30 |
2693273 | 오류 (1) | 귀1여운렩 | 2025-04-30 |
2693080 | visual studio 2008 express edition 등록키 말인데요 | 얀별 | 2025-04-28 |
2693053 | 배열, 구조체 관련 프로그래밍 질문드립니다. | 싸리 | 2025-04-28 |
2693025 | 프로그램을 짜봤는데요 ㅠㅠ | 상처입은마음 | 2025-04-28 |
2693001 | 워닝문제, 세그멘트결함문제 (1) | 월식 | 2025-04-28 |
2692979 | 라인한줄 이랑.. 소스 설명좀 부탁드려요.. | 이루리 | 2025-04-27 |
2692947 | 이 문제좀 풀어 주세요..ㅜㅜ (1) | 소리 | 2025-04-27 |