Let's say if I have a Static called : "st1", I would like to set the text(value) for it. How can I accomplish that? How to do that to an EDIT? To a Command Button? Also, how to set a reaction when the user clicks a button, edit, or a static?
Printable View
Let's say if I have a Static called : "st1", I would like to set the text(value) for it. How can I accomplish that? How to do that to an EDIT? To a Command Button? Also, how to set a reaction when the user clicks a button, edit, or a static?
Get/SetDlgItemText or Get/SetWindowText for all of them. It depends whether you have the id or the hwnd.
I don't know how to load CURSOR1... nor ICON1...Code:/*======================================================
COPYRIGHT(C) 1999 - 2002
TOM ZHANG, 9, 1, 7, 4, 8
{'P','R','O','G','T','O','M'}
||||||||||||||||||||||||
||||||||||||||||||||||||
///////////\\\\\\\\\\\\\
\\\\\\\\\\\/////////////
========================
=======================================================*/
#include <windows.h>
#include "resource.h"
HWND dlg;
BOOL CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam){
HICON hCursor;
switch(msg){
case WM_CREATE:
hCursor=LoadCursor(NULL,MAKEINTRESOURCE(CURSOR1));
SetCursor(hCursor);
break;
case WM_INITDIALOG:
hCursor=LoadCursor(NULL,MAKEINTRESOURCE(CURSOR1));
SetCursor(hCursor);
break;
case WM_CLOSE:
DestroyWindow(hwnd);
PostQuitMessage(0);
break;
case WM_RBUTTONUP:
SendMessage(hwnd,WM_CLOSE,0,0);
break;
default:
break;
}
return 0;
}
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShowCmd){
MSG msg;
HICON hCursor;
dlg=CreateDialog(hInstance,MAKEINTRESOURCE(DIALOG1),NULL,WndProc);
LoadIcon(hInstance,MAKEINTRESOURCE(ICON1));
hCursor=LoadCursor(hInstance,MAKEINTRESOURCE(CURSOR1));
SetCursor(hCursor);
if(dlg==NULL){
MessageBox(NULL,"Error","",0);
return 0;
}
ShowWindow(dlg,SW_SHOWNORMAL);
while(GetMessage(&msg,NULL,NULL,NULL)){
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}