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

📄 stdafx.h

📁 客户端服务器源码
💻 H
字号:
// stdafx.h : include file for standard system include files,
//  or project specific include files that are used frequently, but
//      are changed infrequently
//

#if !defined(AFX_STDAFX_H__BB5D1D67_E380_4FC0_9E63_1A5821314D4F__INCLUDED_)
#define AFX_STDAFX_H__BB5D1D67_E380_4FC0_9E63_1A5821314D4F__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define	_SCB_REPLACE_MINIFRAME	//定义工具栏风格

#define VC_EXTRALEAN		// Exclude rarely-used stuff from Windows headers 

#include <afxwin.h>         // MFC core and standard components
#include <afxext.h>         // MFC extensions
#include <afxdisp.h>        // MFC Automation classes
#include <afxdtctl.h>		// MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h>			// MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT

#include <afxsock.h>		// MFC socket extensions

#include "..\SizeCoolBar\sizecbar.h"
#include "..\SizeCoolBar\scbarg.h"

#include <objbase.h>
#include <comdef.h>

//#import "..\Server_dbPos\Server_dbPos.tlb" no_namespace
// 导入COM服务器
#import "..\Pos_Server\Pos_Server.tlb" no_namespace rename("EOF", "ADOEOF")

//#import "..\ADO\Server\ADOSamp.tlb" no_namespace rename("EOF", "ADOEOF")
// 导入通用查询
#import "..\AdoQuery\AdoQuery.tlb" no_namespace 

const int ID_Tree_View =1001;	//定义树状控件的ID,手工添加

// 定义全局函数,用来打开特定的文档模板视图
CFrameWnd* EkCreateNewWindow( CDocTemplate* pTemplate,
                              CDocument* pDocument );

// 定义函数用来获取当前文档
CDocument* EkGetActiveDocument();

// 定义全局枚举变量,用来记录当前登录的用户类型
enum User_Type 
{
	Material = 0,
	Sell = 1,
	Finance = 2,
	Adm_All = 3
};
extern User_Type g_tUserType;

/////////////////////////////////////////////////////////

// 定义一个函数,用来创建一个窗口(若不存在)或打开一个窗口(若存在)

template<class T>
void EkNewOrOpenWnd(CDocTemplate* pTemplate, CDocument* pDocument, 
					CFrameWnd* pFrame, T* pFindView, CString strClassName)
{
	//pFindView = NULL; //所要找的视图的指针
	/*if(pFindView != NULL)
	{
		if(!(pFindView->IsKindOf( RUNTIME_CLASS(CView) )))
		{
			AfxMessageBox("第四个参数必须为视图类或者其派生类对象!", NULL, MB_OK);
			return;
		}
	}*/
	if(pFindView != NULL)
	{
		pFindView = NULL;
	}

	CView* pView=NULL ;

	pFrame = static_cast<CFrameWnd *>(AfxGetMainWnd())->GetActiveFrame();
	
	pDocument = pFrame->GetActiveDocument();

	if(pDocument != NULL)
	{
		POSITION pos = pDocument->GetFirstViewPosition();
		while(pos != NULL)
		{
			pView= pDocument->GetNextView(pos);
			//if (pView->IsKindOf( RUNTIME_CLASS(T)))  
			if(pView != NULL)
			{
				if( pView->GetRuntimeClass()->m_lpszClassName 
						== strClassName) 
						//pFindView->GetRuntimeClass()->m_lpszClassName)
				//if( typeid(pView) == typeid(pFindView))
				{
					pFindView = (T*)pView;
				}
				//else
				//{
				//	pFindView = NULL;
				//}
			}
		}
		if(pFindView == NULL)
		{
			//pDocument->SetTitle(strTitle);
			EkCreateNewWindow( pTemplate, pDocument );
		}
		else
		{
			pFindView->GetParentFrame()->ActivateFrame();
		}
	}

	if (pDocument == NULL)
	{
		pDocument = new CDocument();
		
		//pDocument->SetTitle(strTitle);
		EkCreateNewWindow( pTemplate, pDocument );		
	}
	//pFrame->  //SetWindowsText(strTitle);
	//pFrame->GetActiveWindow()->SetWindowText(strTitle);
}
/////////////////////////////////////////////////////////
// 定义用来初始化应用程序的常量
const HKEY MAINKEY = HKEY_CURRENT_USER;		// 初始的键
const CString SUBKEY = "SOFTWARE\\物资管理信息系统";	// 要打开的键的名称


//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_STDAFX_H__BB5D1D67_E380_4FC0_9E63_1A5821314D4F__INCLUDED_)

⌨️ 快捷键说明

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