VirtualKeyboard.cpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. // VirtualKeyboard.cpp : Defines the class behaviors for the application.
  2. //
  3. #include "stdafx.h"
  4. #include "VirtualKeyboard.h"
  5. #include "MainFrm.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #endif
  9. // CVirtualKeyboardApp
  10. BEGIN_MESSAGE_MAP(CVirtualKeyboardApp, CWinApp)
  11. ON_COMMAND(ID_APP_ABOUT, &CVirtualKeyboardApp::OnAppAbout)
  12. END_MESSAGE_MAP()
  13. // CVirtualKeyboardApp construction
  14. CVirtualKeyboardApp::CVirtualKeyboardApp()
  15. {
  16. // TODO: add construction code here,
  17. // Place all significant initialization in InitInstance
  18. }
  19. // The one and only CVirtualKeyboardApp object
  20. CVirtualKeyboardApp theApp;
  21. #include <io.h>
  22. #include <fcntl.h>
  23. #include <stdio.h>
  24. // CVirtualKeyboardApp initialization
  25. void InitConsoleWindow()
  26. {
  27. int nCrt = 0;
  28. FILE* fp;
  29. AllocConsole();
  30. nCrt = _open_osfhandle((long)GetStdHandle(STD_OUTPUT_HANDLE), _O_TEXT);
  31. fp = _fdopen(nCrt, "w");
  32. *stdout = *fp;
  33. setvbuf(stdout, NULL, _IONBF, 0);
  34. }
  35. BOOL CVirtualKeyboardApp::InitInstance()
  36. {
  37. CWinApp::InitInstance();
  38. // Standard initialization
  39. // If you are not using these features and wish to reduce the size
  40. // of your final executable, you should remove from the following
  41. // the specific initialization routines you do not need
  42. // Change the registry key under which our settings are stored
  43. // TODO: You should modify this string to be something appropriate
  44. // such as the name of your company or organization
  45. SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  46. // To create the main window, this code creates a new frame window
  47. // object and then sets it as the application's main window object
  48. CMainFrame* pFrame = new CMainFrame;
  49. if (!pFrame)
  50. return FALSE;
  51. m_pMainWnd = pFrame;
  52. // create and load the frame with its resources
  53. pFrame->LoadFrame(IDR_MAINFRAME,
  54. WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL,
  55. NULL);
  56. // The one and only window has been initialized, so show and update it
  57. pFrame->ShowWindow(SW_SHOW);
  58. pFrame->UpdateWindow();
  59. // call DragAcceptFiles only if there's a suffix
  60. // In an SDI app, this should occur after ProcessShellCommand
  61. return TRUE;
  62. }
  63. // CVirtualKeyboardApp message handlers
  64. // CAboutDlg dialog used for App About
  65. class CAboutDlg : public CDialog
  66. {
  67. public:
  68. CAboutDlg();
  69. // Dialog Data
  70. enum { IDD = IDD_ABOUTBOX };
  71. protected:
  72. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  73. // Implementation
  74. protected:
  75. DECLARE_MESSAGE_MAP()
  76. };
  77. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  78. {
  79. }
  80. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  81. {
  82. CDialog::DoDataExchange(pDX);
  83. }
  84. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  85. END_MESSAGE_MAP()
  86. // App command to run the dialog
  87. void CVirtualKeyboardApp::OnAppAbout()
  88. {
  89. CAboutDlg aboutDlg;
  90. aboutDlg.DoModal();
  91. }
  92. // CVirtualKeyboardApp message handlers