home *** CD-ROM | disk | FTP | other *** search
/ In'side Shareware 1995 April / ish0495.iso / update / truedic / truedic.pak / VC / TRDEDIC.CPP < prev    next >
C/C++ Source or Header  |  1995-05-20  |  3KB  |  129 lines

  1. //
  2. // TrueDic Beispiel
  3. //
  4. #include <afxwin.h>
  5. #include <afxdlgs.h>
  6. #include <afxext.h>
  7. #include "resource.h"
  8. #include "resrc1.h"
  9. #include "trdedic.h"
  10.  
  11.  
  12. #define BOOK_ENGLISH   1       // englisches W÷rterbuch
  13. #define BOOK_GERMAN    2       // deutsches W÷rterbuch
  14.  
  15.  
  16. extern "C" BOOL FAR PASCAL ShowTrueDic(LPSTR lpCmdLine, BOOL iCmdLine, BOOL iBook, BOOL bReserved); 
  17.  
  18.  
  19. /////////////////////////////////////////////////////////////////////////////
  20. // ThisApp: 
  21. /////////////////////////////////////////////////////////////////////////////
  22. CTruedicApp ThisApp;
  23.  
  24. /////////////////////////////////////////////////////////////////////////////
  25. // InitInstance:
  26. /////////////////////////////////////////////////////////////////////////////
  27. BOOL CTruedicApp::InitInstance()
  28. {
  29.  
  30.     m_pMainWnd = new CMainDlgWindow();
  31.     m_pMainWnd->Invalidate(TRUE);
  32.     m_pMainWnd->ShowWindow(SW_SHOW);
  33.  
  34.     SetClassWord(m_pMainWnd->m_hWnd,GCW_HICON, (WORD)LoadIcon(AFX_IDI_STD_FRAME));
  35.     
  36.     return TRUE;
  37. }
  38.  
  39. //-----------------------------------------------------------------------
  40. // CMainDlgWindow constructor:
  41. // Create the dialog box using the definition in the dialog template
  42. //-----------------------------------------------------------------------
  43. CMainDlgWindow::CMainDlgWindow()
  44. {
  45.     Create(MAIN_DICTIONARY);        // Create the Main Dialog Window
  46. }
  47.  
  48.  
  49. void CMainDlgWindow::OnClose()
  50. {
  51.     DestroyWindow();                // Destroy the dialog box window
  52.     delete this;                    // Delete 'this' dialog box object
  53.     PostQuitMessage(0);                // End the application
  54. }
  55.  
  56.  
  57. BEGIN_MESSAGE_MAP(CMainDlgWindow, CDialog)
  58.     //{{AFX_MSG_MAP(CMainDlgWindow)
  59.     ON_WM_CLOSE()
  60.     ON_COMMAND(ID_EXIT, OnExit)
  61.     ON_BN_CLICKED(IDC_DEUENG, OnDeueng)
  62.     ON_BN_CLICKED(IDC_ENGDEU, OnEngdeu)
  63.     //}}AFX_MSG_MAP
  64. END_MESSAGE_MAP()
  65.  
  66. void CMainDlgWindow::OnExit()
  67. {
  68.     OnClose();                        // Do the OnClose member function
  69. }
  70.  
  71. void CMainDlgWindow::OnDeueng()
  72. {
  73.     
  74.     BOOL iCmd = TRUE;           // ctl3d an     
  75.     BOOL iBook = BOOK_GERMAN;
  76.     CString cStr;
  77.     
  78.     LPSTR lpStwWort = cStr.GetBuffer(30);
  79.  
  80.     GetDlgItemText(IDC_STICHWORT, lpStwWort,30);
  81.     
  82.     ShowTrueDic((LPSTR)lpStwWort, iCmd, iBook, 0);    
  83.  
  84. }
  85.  
  86. void CMainDlgWindow::OnEngdeu()
  87. {
  88.  
  89.     BOOL iCmd = TRUE;           // ctl3d an     
  90.     BOOL iBook = BOOK_ENGLISH; // deutsches W÷rterbuch
  91.     CString cStr;
  92.  
  93.     LPSTR lpStwWort = cStr.GetBuffer(30);
  94.     
  95.     GetDlgItemText(IDC_STICHWORT, lpStwWort,30);
  96.     
  97.     ShowTrueDic((LPSTR)lpStwWort, iCmd, iBook, 0);
  98.     
  99. }
  100.  
  101. BOOL CMainDlgWindow::OnInitDialog()
  102. {
  103.     CDialog::OnInitDialog();                 
  104.     
  105.     m_cBitEng.AutoLoad(IDC_ENGDEU, this);
  106.     m_cBitDeu.AutoLoad(IDC_DEUENG, this);
  107.    
  108.     m_cBitDeu.SizeToContent(); 
  109.     m_cBitEng.SizeToContent();
  110.    
  111. // horizontal    
  112.  
  113.     SetWindowPos(&wndTopMost, 0, 0, 42, 20, 0); 
  114.     
  115.     m_cBitEng.SetWindowPos(0,  0, 0, 0, 0, SWP_NOSIZE);
  116.     m_cBitDeu.SetWindowPos(0, 21, 0, 0, 0, SWP_NOSIZE);
  117.  
  118.  
  119. // senkrecht
  120. /*
  121.     SetWindowPos(&wndTopMost, 0, 0, 21, 40, 0); 
  122.     
  123.     m_cBitDeu.SetWindowPos(0, 0, 0, 0, 0, SWP_NOSIZE);
  124.     m_cBitEng.SetWindowPos(0, 0, 20, 0, 0, SWP_NOSIZE);
  125. */
  126.     
  127.     return TRUE;  // return TRUE  unless you set the focus to a control
  128. }
  129.