/* * Start Web * --------- * This program shows how to start Netscape at a * specific web address from inside a GraphApp program. * Note: this will only work with the X-Windows version * of Netscape. It won't work with Explorer. */ #include void go_to_web_page(char *page) { char *format = "netscape -raise -remote \"openURL\\(%s\\)\""; char *command; int size; size = strlen(format) + strlen(page); command = (char *) malloc(sizeof(char) * size); sprintf(command, format, page); system(command); free(command); } void open_home_page(menuitem m) { go_to_web_page("http://www.cs.usyd.edu.au/~loki/graphapp/"); } void open_web_page(menuitem m) { char *page = askstring("Open Web Page", "http://"); if (page) go_to_web_page(page); } void quit(menu m) { exitapp(); } void main(void) { window w; w = newwindow("Try the Menu", rect(100,100,500,400), StandardWindow); newmenubar(NULL); newmenu("File"); newmenuitem("GraphApp Home Page", 0, open_home_page); newmenuitem("Open Web Page", 'O', open_web_page); newmenuitem("-", 0, NULL); newmenuitem("Quit", 'Q', quit); show(w); mainloop(); }