⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dialog2.c

📁 NASA 开发使用的一个专家系统
💻 C
📖 第 1 页 / 共 4 页
字号:
			       /*--------*/	    case IDC_CBOX1:    /* Trace  */	    case IDC_PBUTTON1: /* Remove */	    case IDC_PBUTTON4: /* PPrint */	    case IDC_LISTBOX:  /*--------*/	    {  int index = (int) SendMessage ( hListBox, LB_GETCURSEL, 0, 0L );	       int stringsize = (int) SendMessage(hListBox, LB_GETTEXTLEN, index, 0);	       VOID *DeffunctionPtr;			 HANDLE hString;#if WIN_32			 char *string;#else			 char far *string;#endif			 if (stringsize == LB_ERR)		  break;	       hString = GlobalAlloc(GMEM_FIXED, (WORD) stringsize+1);	       if ( hString == NULL)	       {  EndDialog( hDlg, IDOK);		  ExitToShell();	       }	       string = GlobalLock ( hString );	       SendMessage( hListBox, LB_GETTEXT, index,(LPARAM)((LPSTR) string) );	       DeffunctionPtr = FindDeffunction ( string );	       /*-------------------+	       | Remove Deffunction |	       +-------------------*/	       if ( wParam == IDC_PBUTTON1 )			 {   int count;		  extern SCREEN WinDialog;		  Undeffunction ( DeffunctionPtr );		  SendMessage (hListBox, LB_DELETESTRING, index, 0L );		  count = (int) SendMessage (hListBox, LB_GETCOUNT, 0, 0);		  sprintf ( DialogName,"Deffunction Manager - %4d Items",count);		  SetWindowText ( hDlg, (LPSTR)DialogName );		  PrintCLIPS ("wclips", "(undeffunction ");		  PrintCLIPS ("wclips", string );		  PrintCLIPS ("wclips", ")\n");		  PrintPrompt ();		  InvalidateRect ( WinDialog.hWnd, NULL, TRUE );		  SetFocus ( hListBox );		  GlobalUnlock ( hString );		  GlobalFree ( hString );		  break;	       }	       /*-------------------+	       | PPrint Deffunction |	       +-------------------*/	       if ( wParam == IDC_PBUTTON4 )	       {  extern SCREEN WinDialog;		  PrintCLIPS ("wclips", "(ppdeffunction ");		  PrintCLIPS ("wclips", string );		  PrintCLIPS ("wclips", ")\n");		  PrintCLIPS ("wclips", GetDeffunctionPPForm ( DeffunctionPtr ));		  PrintPrompt ();		  InvalidateRect (WinDialog.hWnd, NULL, TRUE);		  SetFocus ( hListBox );	       }	       /*-----------------+	       | Set-Remove Trace |	       +-----------------*/	       if ( wParam == IDC_CBOX1 )	       {  SetDeffunctionWatch (!GetDeffunctionWatch(DeffunctionPtr), DeffunctionPtr);		  SetFocus (hListBox);	       }	       /*-------------------+	       | Toggle Check Boxes |	       +-------------------*/	       ShowButtons ( hDlg,		   IsDeffunctionDeletable( DeffunctionPtr), HIDE, HIDE,		   (GetDeffunctionPPForm ( DeffunctionPtr ) != NULL), HIDE,		   GetDeffunctionWatch(DeffunctionPtr), HIDE, HIDE, ENABLE );	       GlobalUnlock ( hString );	       GlobalFree ( hString );	       return (TRUE);	    }	 }	 break;      }   }#endif   return (FALSE);}/************************************************************* DefMethodsManager: Callback Function for the*   DefMethods List Box Manager.************************************************************/BOOL FAR PASCAL _export DefMethodsManager (hDlg, message, wParam, lParam)   HWND       hDlg;   unsigned   message;   WORD       wParam;   LONG       lParam;{#if OBJECT_SYSTEM   HWND hListBox = GetDlgItem ( hDlg, IDC_LISTBOX);   static VOID *defgenericPtr;   switch (message)   {  case WM_INITDIALOG:      {  unsigned theMethod = 0 ;	 int count=0;	 char buffer[100];	 defgenericPtr = (VOID *)lParam;	 SetWindowText(GetDlgItem (hDlg, IDC_TEXT), "Methods for - ");	 StartWaitCursor();	 while ((theMethod = GetNextDefmethod ( defgenericPtr, theMethod )) != 0)	 {  char Name[100];	    int index;	    GetDefmethodDescription ( Name,50,defgenericPtr,theMethod );	    index = (int) SendMessage ( hListBox, LB_ADDSTRING, 0,(LPARAM)(LPCSTR) Name);	    SendMessage ( hListBox,LB_SETITEMDATA,index,theMethod);	    WinRunEvent();	    count ++;	 }	 StopWaitCursor();	 SendMessage ( hListBox, LB_SETCURSEL, 0, 0L);	 sprintf ( DialogName,"Defmethod-Handler Manager - %4d Items (in precedence order)",count);	 SetWindowText ( hDlg, (LPSTR)DialogName );	 sprintf ( buffer,"Methods for - <%s>", GetDefgenericName (defgenericPtr));	 SetWindowText(GetDlgItem (hDlg, IDC_TEXT), buffer);	 ShowButtons (hDlg, DISABLE, HIDE, HIDE, DISABLE, HIDE,	    DISABLE, HIDE, HIDE, ENABLE);	 return (TRUE);      }      case WM_COMMAND:      {  switch (wParam)	 {  /*------*/	    /* Done */	    /*------*/	    case IDC_PBUTTON6:	    {  EndDialog( hDlg, IDOK);	       return (TRUE);	    }			       /*-------------------*/	    case IDC_PBUTTON1: /* Remove Defmethod */	    case IDC_PBUTTON4: /* PPrint Defmethod */	    case IDC_CBOX1:    /* Trace Defmethod  */	    case IDC_LISTBOX:  /*-------------------*/	    {  int index = (int) SendMessage ( hListBox, LB_GETCURSEL, 0, 0L );	       unsigned theMethod;	       extern SCREEN WinDialog;	       int count = (int) SendMessage(hListBox, LB_GETCOUNT, 0, 0);	       if (index == LB_ERR )		  break;	       theMethod = (unsigned) SendMessage ( hListBox,LB_GETITEMDATA,index ,0);	       /*-------------------*/	       /* Remove Defmethod */	       /*-------------------*/	       if ( wParam == IDC_PBUTTON1 )	       {  count--;		  sprintf ( DialogName,"Defmethod-Handler Manager - %4d Items",count);		  SetWindowText ( hDlg, (LPSTR)DialogName );				  SendMessage (hListBox, LB_DELETESTRING, index, 0L );		  FlushCommandString();		  PrintCLIPS ("wclips", "(undefmethod ");		  PrintCLIPS ("wclips", GetDefgenericName(defgenericPtr));		  PrintCLIPS ("wclips"," ");		  PrintLongInteger ("wclips", (long int) theMethod);		  PrintCLIPS ("wclips", ")\n");		  PrintPrompt ();		  Undefmethod (defgenericPtr, theMethod);		  InvalidateRect ( WinDialog.hWnd, NULL, TRUE );		  SetFocus (hListBox);		  break;	       }	       /*-------------------*/	       /* Pprint Defmethod */	       /*-------------------*/	       if ( wParam == IDC_PBUTTON4 )	       {  FlushCommandString();		  PrintCLIPS ("wclips", "(ppdefmethod ");		  PrintCLIPS ("wclips", GetDefgenericName(defgenericPtr));		  PrintCLIPS ("wclips"," ");		  PrintLongInteger ("wclips", (long int) theMethod);		  PrintCLIPS ("wclips", ")\n");		  PrintCLIPS ("wclips", GetDefmethodPPForm ( defgenericPtr, theMethod ));		  PrintPrompt ();		  InvalidateRect ( WinDialog.hWnd, NULL, TRUE );		  SetFocus (hListBox);	       }	       /*----------------------------+	       | Set-Remove Defmethod Trace |	       +----------------------------*/	       if ( wParam == IDC_CBOX1 )	       {  SetDefmethodWatch(		     !GetDefmethodWatch(defgenericPtr, theMethod),		     defgenericPtr, theMethod);		  SetFocus (hListBox);	       }	       ShowButtons (hDlg,		  IsDefmethodDeletable(defgenericPtr, theMethod),		  HIDE, HIDE,		  (GetDefmethodPPForm(defgenericPtr, theMethod)!= NULL),		  HIDE,		  GetDefmethodWatch(defgenericPtr, theMethod),		  HIDE, HIDE, ENABLE);	       return (TRUE);	    }	 }	 break;      }   }#endif   return (FALSE);}/************************************************************* DefInstanceManager: Callback Function for the*   DefInstance List Box Manager.************************************************************/#if IBM_TBC#pragma argsused#endifBOOL FAR PASCAL _export DefInstanceManager (hDlg, message, wParam, lParam)   HWND       hDlg;   unsigned   message;   WORD       wParam;   LONG       lParam;{#if OBJECT_SYSTEM   HWND hListBox = GetDlgItem ( hDlg, IDC_LISTBOX);   switch (message)   {  case WM_INITDIALOG:      {  VOID *definstancesPtr = NULL;	 int count=0;	 StartWaitCursor();	 while ((definstancesPtr = GetNextDefinstances ( definstancesPtr )) != NULL)	 {  count ++;	    WinRunEvent();	    SendMessage ( hListBox, LB_ADDSTRING, 0,(LPARAM)(LPCSTR) GetDefinstancesName (definstancesPtr));	 }	 StopWaitCursor();	 SendMessage ( hListBox, LB_SETCURSEL, 0, 0L);	 sprintf ( DialogName,"Definstances Manager - %4d Items",count);	 SetWindowText ( hDlg, (LPSTR)DialogName );	 ShowButtons ( hDlg, DISABLE, HIDE, HIDE, DISABLE, HIDE,	    HIDE, HIDE, HIDE, ENABLE );	 return (TRUE);      }      case WM_COMMAND:      {  switch (wParam)	 {  case IDC_PBUTTON6:	    {  EndDialog( hDlg, IDOK);	       return (TRUE);	    }			       /*--------*/	    case IDC_PBUTTON1: /* Remove */	    case IDC_PBUTTON4: /* PPrint */	    case IDC_LISTBOX:  /*--------*/	    {  int index = (int) SendMessage ( hListBox, LB_GETCURSEL, 0, 0L );	       int stringsize = (int) SendMessage(hListBox, LB_GETTEXTLEN, index, 0);	       VOID *definstancesPtr;#if WIN_32			 char *string;#else			 char far *string;#endif			 HANDLE hString;	       if (stringsize == LB_ERR)		  break;	       hString = GlobalAlloc(GMEM_FIXED, (WORD) stringsize+1);	       if ( hString == NULL )	       {  EndDialog( hDlg, IDOK);		  ExitToShell();	       }	       string = GlobalLock ( hString );	       SendMessage( hListBox, LB_GETTEXT, index,(LPARAM)((LPSTR) string) );	       definstancesPtr = FindDefinstances ( string );	       /*--------------------+	       | Remove Definstances |	       +--------------------*/	       if ( wParam == IDC_PBUTTON1 )			 {           int count;		  extern SCREEN WinDialog;		  Undefinstances ( definstancesPtr );		  SendMessage (hListBox, LB_DELETESTRING, index, 0L );		  count = (int) SendMessage (hListBox, LB_GETCOUNT, 0, 0);		  sprintf ( DialogName,"Definstances Manager - %4d Items",count);		  SetWindowText ( hDlg, (LPSTR)DialogName );		  PrintCLIPS ("wclips", "(undefinstances ");		  PrintCLIPS ("wclips", string );		  PrintCLIPS ("wclips", ")\n");		  PrintPrompt ();		  InvalidateRect ( WinDialog.hWnd, NULL, TRUE );		  GlobalUnlock ( hString );		  GlobalFree ( hString );		  SetFocus ( hListBox );		  break;	       }	       /*----------------+	       | PPrint Deffacts |	       +----------------*/	       if ( wParam == IDC_PBUTTON4 )	       {  extern SCREEN WinDialog;		  PrintCLIPS ("wclips", "(ppdefinstances ");		  PrintCLIPS ("wclips", string );		  PrintCLIPS ("wclips", ")\n");		  PrintCLIPS ("wclips", GetDefinstancesPPForm ( definstancesPtr ));		  PrintPrompt ();		  InvalidateRect ( WinDialog.hWnd, NULL, TRUE );		  SetFocus ( hListBox );	       }	       GlobalUnlock ( hString );	       GlobalFree ( hString );	       ShowButtons ( hDlg,		  IsDefinstancesDeletable(definstancesPtr), HIDE, HIDE,		  (GetDefinstancesPPForm (definstancesPtr)!= NULL),		   HIDE,		   HIDE, HIDE, HIDE, ENABLE );	       return (TRUE);	    }	 }	 break;      }   }#endif   return (FALSE);}/************************************************************* DefClassManager: Callback Function for the DefClass*   List Box Manager.************************************************************/#if IBM_TBC#pragma argsused#endifBOOL FAR PASCAL _export DefClassManager (hDlg, message, wParam, lParam)   HWND       hDlg;   unsigned   message;   WORD       wParam;   LONG       lParam;{#if OBJECT_SYSTEM   HWND hListBox = GetDlgItem ( hDlg, IDC_LISTBOX);   switch (message)   {  case WM_INITDIALOG:      {  VOID *defclassPtr = NULL;	 int count=0;	 StartWaitCursor();	 while ((defclassPtr = GetNextDefclass ( defclassPtr )) != NULL)	 {  count ++;	    WinRunEvent();	    SendMessage ( hListBox, LB_ADDSTRING, 0,(LPARAM)(LPCSTR) GetDefclassName (defclassPtr));	 }	 StopWaitCursor();	 SendMessage ( hListBox, LB_SETCURSEL, 0, 0L);	 sprintf ( DialogName,"Defclass Manager - %4d Items",count);	 SetWindowText ( hDlg, (LPSTR)DialogName );	 ShowButtons ( hDlg, DISABLE, DISABLE ,DISABLE , DISABLE, DISABLE,	    HIDE, GRAY, GRAY, ENABLE);	 SetWindowText(GetDlgItem (hDlg, IDC_PBUTTON2), "&Describe");	 SetWindowText(GetDlgItem (hDlg, IDC_PBUTTON3), "&Browse");	 SetWindowText ( GetDlgItem ( hDlg, IDC_CBOX2 ), "Watch &Instances" );	 return (TRUE);      }      case WM_COMMAND:      {  switch (wParam)	 {  /*-----+	    | Done |	    +-----*/	    case IDC_PBUTTON6:	    {  EndDialog( hDlg, IDOK);	       return (TRUE);	    }			       /*--------------------*/	    case IDC_CBOX2:    /* Trace Instances    */	    case IDC_CBOX3:    /* Trace Slot Changes */	    case IDC_PBUTTON1: /* Remove             */	    case IDC_PBUTTON2: /* Describe           */	    case IDC_PBUTTON3: /* Browse             */	    case IDC_PBUTTON4: /* PPrint             */	    case IDC_PBUTTON5: /* Message Handlers   */	    case IDC_LISTBOX:  /*--------------------*/	    {  int index = (int) SendMessage ( hListBox, LB_GETCURSEL, 0, 0L );	       int stringsize = (int) SendMessage(hListBox, LB_GETTEXTLEN, index, 0);	       VOID *defclassPtr;#if WIN_32			 char *string;#else			 char far *string;#endif			 HANDLE hString;	       if (stringsize == LB_ERR)		  break;	       hString = GlobalAlloc(GMEM_FIXED, (WORD) stringsize+1);	       if (hString == NULL)	       {  EndDialog( hDlg, IDOK);		  ExitToShell();	       }	       string = GlobalLock ( hString );	       SendMessage( hListBox, LB_GETTEXT, index,(LPARAM)((LPSTR) string));	       defclassPtr = FindDefclass ( string );	       /*------------------+	       | Remove Defclasses |	       +------------------*/	       if ( wParam == IDC_PBUTTON1 )			 {       int count;		  extern SCREEN WinDialog;		  Undefclass ( defclassPtr );		  SendMessage (hListBox, LB_DELETESTRING, index, 0L );		  count = (int) SendMessage (hListBox, LB_GETCOUNT, 0, 0);		  sprintf ( DialogName,"Defclasss Manager - %4d Items",count);		  SetWindowText ( hDlg, (LPSTR)DialogName );		  PrintCLIPS ("wclips", "(undefclass ");		  PrintCLIPS ("wclips", string );		  PrintCLIPS ("wclips", ")\n");		  PrintPrompt ();		  InvalidateRect ( WinDialog.hWnd, NULL, TRUE );		  SetFocus ( hListBox );		  GlobalUnlock ( hString );		  GlobalFree ( hString );		  break;	       }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -