john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

Win CE create window main

/* 2010-07 john pfeiffer 
*/

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
#include <windowsx.h>
#include <commctrl.h>
#include <aygshell.h>
*/

#define _countof( array )  ( sizeof( array) / sizeof( array[0] )  )

#define HISTORYMAX 512 
int clickCount;
int clickHistory [ HISTORYMAX ][2];

/* wm_down x,y  wm_up x,y */
int clickDownPoints[2][2];

#include "initializeColor.txt"
#include "drawPixel.txt"
#include "drawText.txt"
#include "drawRectangle.txt"
#include "clearDisplay.txt"


/*
#include "wmemset.txt"



#include "displayobjectList.txt"
#include "configureMenu.txt"   
#include "inputKeyboard.txt"  
#include "verticalRect.txt"


#include "displayobjectAction.txt"
*/

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

    switch (message)              
    {   
        case WM_KEYDOWN:   
        break;
        case WM_LBUTTONDOWN:       
            clickDownPoints[0][0] = LOWORD( lParam );
            clickDownPoints[0][1] = HIWORD( lParam );
        break;
        case WM_LBUTTONUP:   
            clickDownPoints [1][0] = LOWORD( lParam );
            clickDownPoints [1][1] = HIWORD( lParam );

            clickCount++;
            if( clickCount == HISTORYMAX )
            {    clickCount = 0;    }

            clickHistory[ clickCount ][0] = LOWORD( lParam );
            clickHistory[ clickCount ][1] = HIWORD( lParam );
/*
            detectClickAllDisplayObjectLists (  hwnd ,  LOWORD( lParam ) , HIWORD( lParam )  );
*/            
        break;
        case WM_MOUSEMOVE:
        break;
        case WM_CHAR:    
/*        
            inputKeyboard (  hwnd , wParam  );
*/            
        break;
        case WM_COMMAND:         
            switch( LOWORD( wParam ) )    
            {      }      
        break;  
        case WM_DESTROY: 
/*
            emptyAllDisplayObjectLists ( );
*/    
            PostQuitMessage(0);    
         break;   
        case WM_PAINT:
            BeginPaint(hwnd, &ps);
/*            
            showAllDisplayObjectLists ( hwnd );
*/            
            EndPaint(hwnd, &ps);  
        break;    
        case WM_CREATE:
            clickCount =0;
            memset( clickHistory , 0, sizeof (  clickHistory));
            currentForegroundColorIndex = 0;
            currentBackgroundColorIndex = 0;
            colorInitialize ( currentForegroundColor);
            colorInitialize ( currentBackgroundColor);
/*
            populateAllDisplayObjectLists ( );
*/            
            UpdateWindow(hwnd);
         break; 
         default:      
            return DefWindowProc( hwnd, message, wParam, lParam );
         break;

     }  /* end switch */
    return 0;
} /* end function MenuWndProc */


/* ##### ##### ##### ##### */

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

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

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

    hwnd = CreateWindow ( "CEApp",
     " defaultapp ", WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 
 CW_USEDEFAULT, CW_USEDEFAULT,        (HWND)NULL, NULL, hInstance, (LPSTR)NULL);

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

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

  • « file cat hex
  • Linux temperature monitoring centos 5 3 hp proliant »

Published

Jul 1, 2010

Category

c

~265 words

Tags

  • convert-to-win32 13
  • cwm 2
  • win-ce 40