Example #1
0
/*------------------------------------------------------------------------
Procedure:     CreateSBar ID:1
Purpose:       Calls CreateStatusWindow to create the status bar
Input:         hwndParent: the parent window
initial text: the initial contents of the status bar
Output:
Errors:
------------------------------------------------------------------------*/
static BOOL CreateSBar(HWND hwndParent,char *initialText,int nrOfParts)
{
	hWndStatusbar = CreateStatusWindow(WS_CHILD | WS_VISIBLE | WS_BORDER|SBARS_SIZEGRIP,
		initialText,
		hwndParent,
		IDM_STATUSBAR);
	if(hWndStatusbar)
	{
		InitializeStatusBar(hwndParent,nrOfParts);
		return TRUE;
	}

	return FALSE;
}
Example #2
0
/*------------------------------------------------------------------------
Procedure:     MainWndProc ID:1
Purpose:       Window procedure for the frame window, that contains
the menu. The messages handled are:
WM_CREATE: Creates the mdi child window
WM_SIZE: resizes the status bar and the mdi child
window
WM_COMMAND: Sends the command to the dispatcher
WM_CLOSE: If the user confirms, it exists the program
WM_QUITOCAML: Stops the program unconditionally.
Input:         Standard windows callback
Output:
Errors:
------------------------------------------------------------------------*/
static LRESULT CALLBACK MainWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
	switch (msg) {
		// Create the MDI client invisible window
		case WM_CREATE:
			hwndMDIClient = CreateMdiClient(hwnd);
			TimerId = SetTimer((HWND) 0, 0, 100, (TIMERPROC) TimerProc);
			break;
			// Move the child windows
		case WM_SIZE:
			SendMessage(hWndStatusbar,msg,wParam,lParam);
			InitializeStatusBar(hWndStatusbar,1);
			// Position the MDI client window between the tool and status bars
			if (wParam != SIZE_MINIMIZED) {
				RECT rc, rcClient;

				GetClientRect(hwnd, &rcClient);
				GetWindowRect(hWndStatusbar, &rc);
				ScreenToClient(hwnd, (LPPOINT)&rc.left);
				rcClient.bottom = rc.top;
				MoveWindow(hwndMDIClient,rcClient.left,rcClient.top,rcClient.right-rcClient.left, rcClient.bottom-rcClient.top, TRUE);
			}

			return 0;
			// Dispatch the menu commands
		case WM_COMMAND:
			HandleCommand(hwnd, wParam,lParam);
			return 0;
			// If user confirms close
		case WM_CLOSE:
			if (!AskYesOrNo("Quit OCamlWinPlus?"))
				return 0;
			break;
			// End application
		case WM_DESTROY:
			PostQuitMessage(0);
			break;
			// The interpreter has exited. Force close of the application
		case WM_QUITOCAML:
			DestroyWindow(hwnd);
			return 0;
		case WM_USER+1000:
			// TestGraphics();
			break;
		default:
			return DefFrameProc(hwnd,hwndMDIClient,msg,wParam,lParam);
	}
	return DefFrameProc(hwnd,hwndMDIClient,msg,wParam,lParam);
}
Example #3
0
/*@@2->@@*/
LRESULT CALLBACK MainWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
	switch (msg) {

        int x, y;
        char message[50];
        char b[33];

    	case WM_SIZE:
    		SendMessage(hWndStatusbar,msg,wParam,lParam);
    		InitializeStatusBar(hWndStatusbar,1);
    		break;
    	case WM_MENUSELECT:
    		return MsgMenuSelect(hwnd,msg,wParam,lParam);
    	case WM_COMMAND:
    		HANDLE_WM_COMMAND(hwnd,wParam,lParam,MainWndProc_OnCommand);
    		break;
    	case WM_DESTROY:
    		PostQuitMessage(0);
    		break;
        case WM_LBUTTONDOWN:

             x = GET_X_LPARAM(lParam);
             y = GET_Y_LPARAM(lParam);
             itoa(x,b,10);
             strcpy(message,b);
             itoa(y,b,10);
             strcat(message, " ");
             strcat(message, b);
            UpdateStatusBar( message , 0, 0);
            break;

        case WM_LBUTTONUP:
            UpdateStatusBar( "" , 0, 0);
            break;
        
    	default:
    		return DefWindowProc(hwnd,msg,wParam,lParam);
	}

	return 0;
}