//Windoze 95 title/close tests. #include #include #include #include #include byte get_title[80]; byte get_vmtitle[80]; byte new_title[]="Win95 Test Program"; byte new_vmtitle[]="Q LIB"; byte wc=0,t,c; void quit(void) { win95_vmtitle_set(get_vmtitle); //restore VM title (you should do this!) printf("\nWin95 VMtitle restored\n"); //if you do not restore the VM title then the app the lauched this prg // will have it's VM title changed forever unless it changes it back. // A good example of this is if you run Win95.EXE from a DOS BOX and // if the VM is changed and not restore then the DOS BOX will have the // new name, even if the DOS BOX is closed and reopened! exit(0); } void main(void) { if (win95_close_enable()==ERROR) { printf("Win95 Close Notification not available\n"); } else wc=1; if (win95_title_get(get_title,80)==ERROR) printf("Win95 Get Program Title failed\n"); else printf("Old Program Name:%s\n",get_title); if (win95_title_set(new_title)==ERROR) printf("Win95 Set Program Title failed\n"); else printf("New Program Name:%s\n",new_title); if (win95_vmtitle_get(get_vmtitle,80)==ERROR) printf("Win95 Get VM Title failed\n"); else printf("Old VM Name:%s\n",get_vmtitle); if (win95_vmtitle_set(new_vmtitle)==ERROR) printf("Win95 Set VM Title failed\n"); else printf("New VM Name:%s\n",new_vmtitle); printf("Press 'q' to quit...\n"); while (1){ if (toupper(getche())=='Q') quit(); if (wc) { t=win95_close_query(); if (t==WIN95_CLOSE_NOACK) win95_close_ack(); if (t==WIN95_CLOSE_ACK) { printf("\nProgram Exit Requested!\n Press 'q' to quit or 'c' to cancel...\n"); while (1) { c=toupper(getch()); if (c=='C') { win95_close_cancel(); break;} if (c=='Q') quit(); } } } } }