john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

Graphical directory listing in Win CE (main file)

/* 2010-05 john pfeiffer 
Graphical Dir listing  */

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include <aygshell.h>
#include <math.h>

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

#include "drawPixel.txt"
#include "drawText.txt"
#include "drawRectangle.txt"
#include "clearRect.txt"

#include "lineBufferList.txt"
#include "getListing.txt"

#include "customButton.txt"


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

LRESULT CALLBACK MenuWndProc(                                    HWND hwnd,   UINT message, WPARAM wParam,   LPARAM lParam) 
{  
    char buffer[64]; 
    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:     
            customButtonCheck(  hwnd , LOWORD( lParam ) , HIWORD(lParam) );

            clickHistory[ clickCount ][0] = LOWORD( lParam );
            clickHistory[ clickCount ][1] = HIWORD( lParam );

            clickDownPoints [1][0] = LOWORD( lParam );
            clickDownPoints [1][1] = HIWORD( lParam );

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

         break;
         case WM_MOUSEMOVE:
         break;
    case WM_CHAR:    
    break;
    case WM_COMMAND:         
        switch( LOWORD( wParam ) )    
        {      }      
    break;  
    case WM_DESTROY: 
        PostQuitMessage(0);    
     break;   
    case WM_PAINT:
        BeginPaint(hwnd, &ps);  
            drawMenuButtons (  hwnd   );
        EndPaint(hwnd, &ps);
    break;    
    case WM_CREATE:
        clickCount =0;
        memset( clickHistory , 0, sizeof (  clickHistory));

        initializeMenuButtons (  );

        UpdateWindow(hwnd);
    default:      
        return DefWindowProc(hwnd, message, wParam, lParam);
     break;
       }
    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 = 0;
    wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
    wc.lpszMenuName = NULL;
    wc.lpszClassName = (LPTSTR) L"CEApp";

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

    hwnd = CreateWindow ( L"CEApp",
     L" default app ", 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 */

  • « gcwin bat
  • Custom buttons for Win CE »

Published

Jun 3, 2010

Category

c

~232 words

Tags

  • c 95
  • main 10
  • programming 9
  • win-ce 40