/* Copyright (c) 2024 PTC Inc. and/or Its Subsidiary Companies. All Rights Reserved. */ /*---------------------- Pro/Toolkit Includes ------------------------*/ #include <ProToolkit.h> #include <ProMenu.h> #include <ProMessage.h> #include <ProUtil.h> #include <ProWstring.h> /*---------------------- Function Prototypes -------------------------*/ int ProUserConfirmationInit(); ProError ProUserQuitWindowConfirm(); int ProUserConfirmationInit() { int menuId; ProError ProUserQuitWindowConfirm(); ProMenuFileRegister("main","main.mnu", &menuId); ProMenubuttonPreactionSet("main","Quit Window", (ProMenubuttonAction)ProUserQuitWindowConfirm, NULL, 0); } ProError ProUserQuitWindowConfirm(ProAppData data, int num) { wchar_t w_answer[4]; char answer[4]; wchar_t msgfil[20]; ProStringToWstring(msgfil, "msg_ugmenu.txt"); ProMessageDisplay(msgfil, "USER Do you really want to Quit Window? [Y] :"); /*------------------------------------------------------------*\ If the user just hit return, go ahead and quit. \*------------------------------------------------------------*/ if(ProMessageStringRead(4,w_answer)) return(0); /*------------------------------------------------------------*\ If the answer starts with 'n' return TRUE to prevent the Quit Window \*------------------------------------------------------------*/ ProWstringToString(answer, w_answer); return(tolower(answer[0]) == 'n'); }