WndProc (Part 1)
By SalimMeghani
- 234 reads
//
// FUNCTION: WndProc(HWND, unsigned, WORD, LONG)
//
// PURPOSE: Processes messages for the main window.
//
// WM_COMMAND - process the application menu
// WM_PAINT - Paint the main window
// WM_DESTROY - post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
HDC hdc;
PAINTSTRUCT ps;
RECT lprect;
static HWND ButtonP;
static HWND ButtonX;
static HWND ButtonY;
static HWND ButtonZ;
short i,a;
short scrlval;
//
TEXTMETRIC tm;
unsigned long pvalue=0;
static HWND hwndEdit;
//
switch (message)
{
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDM_ABOUT:
DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
case 0:
if (wmEvent==BN_CLICKED)
{
SetFocus(hWnd);
repstrx=column;
repstry=row;
InvalidateRect(hWnd, NULL, FALSE);
}
break;
case 1:
if (wmEvent==BN_CLICKED)
{
SetFocus(hWnd);
rependx=column;
rependy=row;
pvalue=(repfrmx-1)*100+repfrmy;
cell=scell+pvalue;
strcpy(dell,"\0");
clr_str(dell);
strcpy(dell,*cell);
pvalue=0;
if ((repstrx)==(rependx))
{
for (y=repstry; y<=rependy;y++)
{
clr_str(nwdll);
columnwiserepl(hWnd, repstrx, repstry, rependx, rependy, repfrmx, repfrmy, y, nwdll, dell);
pvalue=((repstrx-1)*100)+y;
cell=scell+pvalue;
type=stype+pvalue;
*type='F';
*cell=(char *) calloc((unsigned long) 65536, sizeof(char));
clr_str(*cell);
strcpy(*cell,nwdll);
}
}
else
{
if ((repstry)==(rependy))
{
for (y=repstrx; y<=rependx;y++)
{
clr_str(nwdll);
rowwiserepl(hWnd, repstrx, repstry, rependx, rependy, repfrmx, repfrmy, y, nwdll, dell);
pvalue=((y-1)*100)+repstry;
- Log in to post comments