ok... iv made a program with a switch that has a char like this
PHP Code:
char k[128]// one byte
switch(k)
{
case "help":
{
//print something
}break;
default:
{
//do something
}break;
}
but i need to make it so that I can send a msg to a switch with out it being a char(as it only does int) and carry out a function kinder like the following code
PHP Code:
LRESULT CALLBACK WindowProc(HWND hwnd,
UINT msg,
WPARAM wparam,
LPARAM lparam)
{
PAINTSTRUCT ps;
HDC hdc;
switch(msg)
{
case WM_CREATE:
{
return(0);
}break;
case WM_PAINT:
{
// simply validate the window
hdc = BeginPaint(hwnd,&ps);
EndPaint(hwnd,&ps);
// return success
return(0);
} break;
case WM_CHAR:
{
int ascii_code = wparam;
int Key_state =lparam;
#define ESC_STATE 0x10001
if(Key_state & ESC_STATE)
{
msg = WM_CLOSE;
}
}
case WM_DESTROY:
{
PostQuitMessage(0);//quiting the program
return(0);
}break;
return(DefWindowProc(hwnd, msg, wparam, lparam));
}