📄 utilmessage.c
字号:
/*====================================================================*\FILE : UtilMessage.cPURPOSE : Utilities for keyboard inputHISTORY..DATE BUILD AUTHOR MODIFICATIONS05-Feb-96 G-03-03 Alistair $$114-Mar-96 G-03-06 Michael $$2 Added ProUtilStringGet22-Apr-96 G-03-11 mgs $$3 Changed header scheme24-Sep-96 H-01-10 Xuekai $$4 Remove "protk.h"15-Sep-97 H-03-22 Pavel $$5 replace Pro/D on Pro/E01-Jun-99 I-03-11 mka $$6 Delete unused variable\*====================================================================*//*--------------------------------------------------------------------*\Pro/TOOLKIT includes\*--------------------------------------------------------------------*/#include <ProToolkit.h>/*--------------------------------------------------------------------*\System includes\*--------------------------------------------------------------------*/#include <stdarg.h>/*--------------------------------------------------------------------*\Application includes\*--------------------------------------------------------------------*/#include "UtilMessage.h"#include "UtilString.h"/*====================================================================*\ FUNCTION : ProUtilMsgPrint() PURPOSE : Generalized form of ProMessageDisplay()\*====================================================================*/void ProUtilMsgPrint( char *ftype, char *title, ...){ int i; char file[PRO_NAME_SIZE]; wchar_t wstr[PRO_NAME_SIZE]; void *a[10]; va_list ap; strcpy(file, ftype); strcat(file,"_msg.txt"); va_start(ap, title); for(i=0;i<10;i++) a[i] = va_arg(ap, void*); ProMessageDisplay(ProStringToWstring(wstr, file), title, a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9]); va_end(ap);}/*====================================================================*\ FUNCTION : ProUtilYesnoGet() PURPOSE : Ask for a yes/no answer from the user.\*====================================================================*/int ProUtilYesnoGet( char *def) /* INPUT : default answer */ /* Return: 1 = yes, 0 = no */{ wchar_t wreply[4]; char reply[4]; while(1==1) { if(ProMessageStringRead(4, wreply)) strcpy(reply,def); else ProWstringToString(reply,wreply); ProUtilStringUpper(reply,reply); if(reply[0] == 'Y') return(1); if(reply[0] == 'N') return(0); ProUtilMsgPrint("gen","UTIL Please answer Y or N : "); }}/*====================================================================*\ FUNCTION : ProUtilIntGet() PURPOSE : Read a double from the keyboard, given a default\*====================================================================*/int ProUtilIntGet( int range[2], /* I - Min and Max values */ int *def, /* I - Default value - if NULL, default is QUIT */ int *input) /* O - The value read */ /* Return 1 - a value was read, 0 - default was NULL and a <CR> was entered */{ int i; if(ProMessageIntegerRead(range, &i)) { if(def == NULL) return(0); *input = *def; return(1); } *input = i; return(1);}/*====================================================================*\ FUNCTION : ProUtilDoubleGet() PURPOSE : Read a double from the keyboard, given a default\*====================================================================*/int ProUtilDoubleGet( double range[2], /* I - Min and Max values */ double *def, /* I - Default value - if NULL, default is QUIT */ double *input) /* O - The value read */ /* Return 1 - a value was read, 0 - default was NULL and a <CR> was entered */{ double d; if(ProMessageDoubleRead(range, &d)!=0) { if(def == NULL) return(0); *input = *def; return(1); } *input = d; return(1);}/*====================================================================*\FUNCTION : ProUtilStringGetPURPOSE : Read a string from the keyboard, given a default\*====================================================================*/int ProUtilStringGet(wchar_t *p_wstr, wchar_t *p_default, int max_len){ wchar_t str[PRO_PATH_SIZE]; if(ProMessageStringRead(max_len, str)!=0) { if (p_default == NULL) return (0); ProUtilWstrcpy(p_wstr, p_default); return (1); } ProUtilWstrcpy(p_wstr, str); return (1);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -