#include  <windows.h>


#define ID_ICON 1000
int psp ;

char *szAppName   =   "TasmWin";
char *stitle	    =  "A windows program in TASM";
char *string1     =  "Tasm is great";
char *string2     =  "C is for wimps";
char *about       =  "ABOUT";
char *menuname    =  "GenericMenu";
int flag ;
HWND hWnd ;
MSG msgx;
WNDCLASS  wc ;



int PASCAL AboutBoxProc (HWND hWnd, int wmsg, int wParam, int lParam)
{
	switch(wmsg) {
		case WM_INITDIALOG:
			return 0;
		case WM_COMMAND:
			switch(LOWORD(wParam)) {
				case 100:
					EndDialog(hWnd,1) ;
					break ;
			} 
	}
	return 0 ;
}
int PASCAL WndProc (HWND hWnd, int wmsg, int wParam, int lParam)
{
	switch(wmsg) {
		case WM_CREATE:
			SetTimer(hWnd,1,1000,0) ;
			break ;
		case WM_TIMER:
			if (wParam == 1) {
				if (!flag)
					SetWindowText(hWnd,string1) ;
				else
					SetWindowText(hWnd,string2);
				flag = !flag ;
			}
			break ;
		case WM_PAINT:
			{
				PAINTSTRUCT ps ;
				BeginPaint(hWnd,&ps);
				EndPaint(hWnd,&ps) ;
			}
			break ;
		case WM_COMMAND:
			switch(LOWORD(wParam)) {
				case 200:
//					DialogBox(hInstance,about,hWnd,AboutBoxProc) ;
					break ;
			}
			break ;
		case WM_DESTROY:
			PostQuitMessage(0) ;
			break ;
		default:
			return DefWindowProc(hWnd,wmsg,wParam,lParam);	
	}
	return 0 ;
}

int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine,
                    int nCmdShow )
{
	if (!hPrevInstance) {
		wc.style = CS_HREDRAW + CS_VREDRAW ;
		wc.lpfnWndProc = WndProc ;
		wc.cbClsExtra = 0 ;
		wc.cbWndExtra = 0 ;
		wc.hInstance = hInstance ;
		wc.hIcon = 0 ; // LoadIcon(hInstance, ID_ICON) ;
		wc.hCursor = LoadCursor(0,IDC_ARROW) ;
		wc.hbrBackground = GetStockObject(WHITE_BRUSH) ;
		wc.lpszMenuName = 0 ; // menuname ;
		wc.lpszClassName = szAppName ;
		if (!RegisterClass(&wc))
			return 0 ;
	}
	hWnd= CreateWindow(szAppName,stitle,WS_OVERLAPPEDWINDOW + WS_VISIBLE,
			CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
			0,0,hInstance,0) ;
	ShowWindow(hWnd,nCmdShow) ;
	UpdateWindow(hWnd) ;
	while (GetMessage(&msgx,0,0,0)) {
		TranslateMessage(&msgx);
		DispatchMessage(&msgx) ;
	}
	return msgx.wParam ;
}