Exemple #1
0
int PASCAL 
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)
{

	/* make a test window */
	tw = text_new();

	if (!hPrevInstance) {
	    HICON hicon = LoadIcon(NULL, IDI_APPLICATION);
	    text_register_class(hicon);
	}
	text_font(tw, "Courier New", 10);
	text_size(tw, 80, 80);
	text_drag(tw, "(", ") run\r");

	/* show the text window */
	if (!text_create(tw, "Application Name", nCmdShow)) {
	    /* do the real work here */
	    /* TESTING */
	    int ch;
	    int len;
	    char *line = new char[256];
	    while ( (len = text_read_line(tw, line, 256-1)) != 0 ) {
		text_write_buf(tw, line, len);
	    }
/*
	    while ( text_gets(tw, line, 256-1) ) {
		text_puts(tw, line);
	    }
*/
/*
	    while ( (ch = text_getch(tw, )) != 4 )
		text_putch(tw, ch);
*/
	}
	else {
	    
	}

	/* clean up */
	text_destroy(tw);
	
	/* end program */
	return 0;
}
Exemple #2
0
/* Put string to window */
void
text_puts(TW *tw, const char *str)
{
    text_write_buf(tw, str, strlen(str));
}