WinApp.cpp
资源名称:CAD.zip [点击查看]
上传用户:hehe2haha
上传日期:2013-08-16
资源大小:161k
文件大小:2k
源码类别:
CAD
开发平台:
Visual C++
- // WinApp.cpp: implementation of the CWinApp class.
- //
- //////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "WinApp.h"
- #include "MainFrame.h"
- #include "resource.h"
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- CWinApp::CWinApp()
- {
- }
- CWinApp::~CWinApp()
- {
- }
- HINSTANCE CWinApp::GetInst()
- {
- return hInstance;
- }
- void CWinApp::SetInst(HINSTANCE hInst)
- {
- hInstance = hInst;
- }
- int CWinApp::GetCmd()
- {
- return nCmdShow;
- }
- void CWinApp::SetCmd(int nCmd)
- {
- nCmdShow = nCmd;
- }
- ATOM CWinApp::MyRegisterClass()
- {
- WNDCLASSEX wcex;
- wcex.cbSize = sizeof(WNDCLASSEX);
- wcex.style = CS_HREDRAW | CS_VREDRAW;
- wcex.lpfnWndProc = (WNDPROC)CMainFrame::WndProc;
- wcex.cbClsExtra = 0;
- wcex.cbWndExtra = 0;
- wcex.hInstance = hInstance;
- wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_TCAD);
- wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
- wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
- wcex.lpszMenuName = (LPCSTR)IDC_TCAD;
- wcex.lpszClassName = "TCAD";
- wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);
- return RegisterClassEx(&wcex);
- }
- BOOL CWinApp::InitInstance()
- {
- HWND hWnd;
- hWnd = CreateWindow("TCAD", "TCAD", WS_OVERLAPPEDWINDOW,
- CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
- if (!hWnd)
- {
- return FALSE;
- }
- ShowWindow(hWnd, nCmdShow);
- UpdateWindow(hWnd);
- return TRUE;
- }
- int CWinApp::run()
- {
- MSG msg;
- // Main message loop:
- while (GetMessage(&msg, NULL, 0, 0))
- {
- if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- }
- return msg.wParam;
- }
- void CWinApp::SetAccel(HACCEL hAccel)
- {
- hAccelTable = hAccel;
- }