john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

Win CE keys chars main

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include <aygshell.h>
#include "stringToWchar.txt"
#include "drawText.txt"
#define MAXCHARSPERLINE 34 
#define LINEHEIGHT 14


#define  IDC_ExitButton    40099



LRESULT CALLBACK MenuWndProc(                                    HWND hwnd,   UINT message, WPARAM wParam,   LPARAM lParam) 
{

  switch (message)              
       {

case WM_LBUTTONDOWN:     
    printf( "click at: %d,%d \n",
        LOWORD(lParam),HIWORD(lParam) );
  break;
case WM_CHAR:    
printf( "character  at: %d,%d \n",
        LOWORD(lParam),HIWORD(lParam) );

  break;
    case WM_KEYDOWN:    
printf( " key at: %d,%d \n",
        LOWORD(lParam),HIWORD(lParam) );

    break;



     case WM_COMMAND:         
            switch(LOWORD(wParam))    
               {       case IDC_ExitButton:       
                     PostQuitMessage(0);
                     break;
                    default:
                    break;          
     }      
    break;  
     case WM_DESTROY: 
                  PostQuitMessage(0);    
               break;

               case WM_PAINT:
                  initializeBackground( hwnd );
                break;    
  case WM_CREATE:
     initializeBackground( hwnd );
             break;     
                 default:      
                   return DefWindowProc(hwnd, message, wParam, lParam);
       }
    return 0;
}


int APIENTRY WinMain(
    HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPTSTR lpCmdLine, int ncmdshow )
{ 
    HWND hwnd = NULL;  
    HWND ExitButton= NULL;  
    MSG msg;   
    WNDCLASS wc;
     HMENU hMenu;
  RECT        rc;


 wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = (WNDPROC)MenuWndProc; 
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = hInstance;
    wc.hIcon = 0;
    wc.hCursor = 0;
    wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
    wc.lpszMenuName = NULL;
    wc.lpszClassName = (LPTSTR) L"Menu App";

  if(!  RegisterClass (&wc))
{ 
    MessageBox(NULL, TEXT("errors "),
  L"IMPORTANT", MB_OK); 
    return 0;
 }

    hwnd = CreateWindow (L"Menu App", L"display mouse xy", WS_VISIBLE,
        0,30, 300, 200,
        (HWND)NULL, NULL, hInstance, (LPSTR)NULL);

/* -------- -------- -------- -------- */ GetWindowRect(hwnd, &rc);

   ExitButton = CreateWindow( 
L"BUTTON", L"quit", WS_CHILD | 
WS_VISIBLE | BS_PUSHBUTTON, 
0, 30,40,40, hwnd, (HMENU)IDC_ExitButton, 
hInstance, NULL);

ShowWindow(hwnd, ncmdshow); 
UpdateWindow(hwnd);

 while(GetMessage(&msg, NULL, 0, 0))  {       
    TranslateMessage(&msg);                  
    DispatchMessage(&msg); 
   }   
    return msg.wParam;
} /* end WinMain */

  • « Linux gui icons
  • windows copy preserve filetimes permissions robocopy xp 026 »

Published

Mar 3, 2010

Category

c

~195 words

Tags

  • chars 5
  • keys 6
  • keys-chars 3
  • main 10
  • win 19
  • win-ce 40