view window_test.c @ 75:0083b2f7b3c7

Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
author Mike Pavone <pavone@retrodev.com>
date Tue, 06 Jul 2010 07:52:59 -0400
parents 76568becd6d6
children
line wrap: on
line source

#include <windows.h>

LRESULT CALLBACK WindowProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message)
	{
	/*	case WM_CREATE:
			CreateChildControls(hwnd);
			break;

		case WM_COMMAND:
			if( HIWORD( wParam ) == BN_CLICKED )
			{
				ProcessButtonClick( (char)LOWORD( wParam ) );
			}
			break;*/

		case WM_DESTROY:
			PostQuitMessage (0); 
			break;
	}
	return DefWindowProc (hwnd, message, wParam, lParam);
}
char g_szClassName[ ] = "WindowsApp";
HINSTANCE glob_instance;
int glob_cmdshow;
BOOL wind_created=FALSE;

DWORD WINAPI message_thread(void * param)
{
	WSADATA wsa_data;
	/* Define the Window Class and try to register it */
	WNDCLASSEX wc;
	HWND hwnd;
	MSG messages; 
	wc.cbSize        = sizeof (WNDCLASSEX);
	wc.style         = 0; 
	wc.lpfnWndProc   = WindowProc;
	wc.cbClsExtra    = 0;
    wc.cbWndExtra    = 0;
    wc.hInstance     = glob_instance;
    wc.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
	wc.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
    wc.lpszMenuName  = NULL;
    wc.lpszClassName = g_szClassName;
    wc.hIconSm       = LoadIcon(NULL, IDI_APPLICATION);
	if (!RegisterClassEx (&wc)) return 0;

	/* Create and Show the Window */
	hwnd = CreateWindowEx (
		0, g_szClassName, "The OMGWTF Calculator",
		WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 
		220, 270, 
		HWND_DESKTOP, NULL, glob_instance, NULL);
	
	CreateWindow("STATIC", "test", SS_BLACKFRAME | SS_WHITERECT | SS_LEFT,
		10, 10, 100, 20, hwnd, NULL, GetModuleHandle(NULL), NULL);
		
	ShowWindow (hwnd, glob_cmdshow);
	
	while (GetMessage (&messages, NULL, 0, 0))
	{
		TranslateMessage(&messages);
		DispatchMessage(&messages);
	}
	MessageBox(NULL, "No More messages!", "Blah", MB_OK);
	wind_created = TRUE;
	return 0;
}

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	WSADATA wsa_data;
	/* Define the Window Class and try to register it */
	WNDCLASSEX wc;
	HWND hwnd;
	MSG messages; 
	/*wc.cbSize        = sizeof (WNDCLASSEX);
	wc.style         = 0; 
	wc.lpfnWndProc   = WindowProc;
	wc.cbClsExtra    = 0;
    wc.cbWndExtra    = 0;
    wc.hInstance     = hInstance;
    wc.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
	wc.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
    wc.lpszMenuName  = NULL;
    wc.lpszClassName = g_szClassName;
    wc.hIconSm       = LoadIcon(NULL, IDI_APPLICATION);
	if (!RegisterClassEx (&wc)) return 0;


	hwnd = CreateWindowEx (
		0, g_szClassName, "The OMGWTF Calculator",
		WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 
		220, 270, 
		HWND_DESKTOP, NULL, hInstance, NULL);
	ShowWindow (hwnd, nCmdShow);*/
	glob_instance = hInstance;
	glob_cmdshow = nCmdShow;
	CreateThread(NULL, 0, message_thread, NULL, 0, NULL);
	/* Process the Message Loop  */
	while(!wind_created)
		Sleep(0);
	/*while (GetMessage (&messages, NULL, 0, 0))
	{
		TranslateMessage(&messages);
		DispatchMessage(&messages);
	}*/

	return (int)messages.wParam;
}