//*************************************************************************
// BCMenu.cpp : implementation file
// Version : 3.02
// Date : March 2002
// Author : Brent Corkum
// Email : corkum@rocscience.com
// Latest Version : http://www.rocscience.com/~corkum/BCMenu.html
//
// Bug Fixes and portions of code supplied by:
//
// Ben Ashley,Girish Bharadwaj,Jean-Edouard Lachand-Robert,
// Robert Edward Caldecott,Kenny Goers,Leonardo Zide,
// Stefan Kuhr,Reiner Jung,Martin Vladic,Kim Yoo Chul,
// Oz Solomonovich,Tongzhe Cui,Stephane Clog,Warren Stevens,
// Damir Valiulin,David Kinder,Marc Loiry
//
// You are free to use/modify this code but leave this header intact.
// This class is public domain so you are free to use it any of
// your applications (Freeware,Shareware,Commercial). All I ask is
// that you let me know so that if you have a real winner I can
// brag to my buddies that some of my code is in your app. I also
// wouldn't mind if you sent me a copy of your application since I
// like to play with new stuff.
//*************************************************************************
#include "stdafx.h" // Standard windows header file
#include "BCMenu.h" // BCMenu class declaration
#include <afxpriv.h> //SK: makes A2W and other spiffy AFX macros work
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define BCMENU_GAP 1
#ifndef OBM_CHECK
#define OBM_CHECK 32760 // from winuser.h
#endif
#if _MFC_VER <0x400
#error This code does not work on Versions of MFC prior to 4.0
#endif
static CPINFO CPInfo;
// how the menu's are drawn in win9x/NT/2000
UINT BCMenu::original_drawmode=BCMENU_DRAWMODE_ORIGINAL;
BOOL BCMenu::original_select_disabled=TRUE;
// how the menu's are drawn in winXP
UINT BCMenu::xp_drawmode=BCMENU_DRAWMODE_XP;
BOOL BCMenu::xp_select_disabled=FALSE;
BOOL BCMenu::xp_draw_3D_bitmaps=TRUE;
CImageList BCMenu::m_AllImages;
CArray<int,int&> BCMenu::m_AllImagesID;
enum Win32Type{
Win32s,
WinNT3,
Win95,
Win98,
WinME,
WinNT4,
Win2000,
WinXP
};
Win32Type IsShellType()
{
Win32Type ShellType;
DWORD winVer;
OSVERSIONINFO *osvi;
winVer=GetVersion();
if(winVer<0x80000000){/*NT */
ShellType=WinNT3;
osvi= (OSVERSIONINFO *)malloc(sizeof(OSVERSIONINFO));
if (osvi!=NULL){
memset(osvi,0,sizeof(OSVERSIONINFO));
osvi->dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
GetVersionEx(osvi);
if(osvi->dwMajorVersion==4L)ShellType=WinNT4;
else if(osvi->dwMajorVersion==5L&&osvi->dwMinorVersion==0L)ShellType=Win2000;
else if(osvi->dwMajorVersion==5L&&osvi->dwMinorVersion==1L)ShellType=WinXP;
free(osvi);
}
}
else if (LOBYTE(LOWORD(winVer))<4)
ShellType=Win32s;
else{
ShellType=Win95;
osvi= (OSVERSIONINFO *)malloc(sizeof(OSVERSIONINFO));
if (osvi!=NULL){
memset(osvi,0,sizeof(OSVERSIONINFO));
osvi->dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
GetVersionEx(osvi);
if(osvi->dwMajorVersion==4L&&osvi->dwMinorVersion==10L)ShellType=Win98;
else if(osvi->dwMajorVersion==4L&&osvi->dwMinorVersion==90L)ShellType=WinME;
free(osvi);
}
}
return ShellType;
}
static Win32Type g_Shell=IsShellType();
void BCMenuData::SetAnsiString(LPCSTR szAnsiString)
{
USES_CONVERSION;
SetWideString(A2W(szAnsiString)); //SK: see MFC Tech Note 059
}
CString BCMenuData::GetString(void)//returns the menu text in ANSI or UNICODE
//depending on the MFC-Version we are using
{
CString strText;
if (m_szMenuText)
{
#ifdef UNICODE
strText = m_szMenuText;
#else
USES_CONVERSION;
strText=W2A(m_szMenuText); //SK: see MFC Tech Note 059
#endif
}
return strText;
}
CTypedPtrArray<CPtrArray, HMENU> BCMenu::m_AllSubMenus; // Stores list of all sub-menus
IMPLEMENT_DYNAMIC( BCMenu, CMenu )
/*
===============================================================================
BCMenu::BCMenu()
BCMenu::~BCMenu()
-----------------
Constructor and Destructor.
===============================================================================
*/
BCMenu::BCMenu()
{
m_bDynIcons = FALSE; // O.S. - no dynamic icons by default
disable_old_style=FALSE;
m_iconX = 16; // Icon sizes default to 16 x 16
m_iconY = 15; // ...
m_selectcheck = -1;
m_unselectcheck = -1;
checkmaps=NULL;
checkmapsshare=FALSE;
// set the color used for the transparent background in all bitmaps
m_bitmapBackground=RGB(192,192,192); //gray
m_bitmapBackgroundFlag=FALSE;
GetCPInfo(CP_ACP,&CPInfo);
m_loadmenu=FALSE;
}
BCMenu::~BCMenu()
{
DestroyMenu();
}
BOOL BCMenu::IsNewShell ()
{
return (g_Shell>=Win95);
}
BOOL BCMenu::IsWinXPLuna()
{
if(g_Shell==WinXP){
if(IsWindowsClassicTheme())return(FALSE);
else return(TRUE);
}
return(FALSE);
}
BOOL BCMenu::IsLunaMenuStyle()
{
if(IsWinXPLuna()){
if(xp_drawmode==BCMENU_DRAWMODE_XP)return(TRUE);
}
else{
if(original_drawmode==BCMENU_DRAWMODE_XP)return(TRUE);
}
return(FALSE);
}
BCMenuData::~BCMenuData()
{
if(bitmap)
delete(bitmap);
delete[] m_szMenuText; //Need not check for NULL because ANSI X3J16 allows "delete NULL"
}
void BCMenuData::SetWideString(const wchar_t *szWideString)
{
delete[] m_szMenuText;//Need not check for NULL because ANSI X3J16 allows "delete NULL"
if (szWideString)
{
m_szMenuText = new wchar_t[sizeof(wchar_t)*(wcslen(szWideString)+1)];
if (m_szMenuText)
wcscpy(m_szMenuText,szWideString);
}
else
m_szMenuText=NULL;//set to NULL so we need not bother about dangling non-NULL Ptrs
}
BOOL BCMenu::IsMenu(CMenu *submenu)
{
int m;
int numSubMenus = m_AllSubMenus.GetUpperBound();
for(m=0;m<=numSubMenus;++m){
if(submenu->m_hMenu==m_AllSubMenus[m])return(TRUE);
}
return(FALSE);
}
BOOL BCMenu::IsMenu(HMENU submenu)
{
int m;
int numSubMenus = m_AllSubMenus.GetUpperBound();
for(m=0;m<=numSubMenus;++m){
if(submenu==m_AllSubMenus[m])return(TRUE);
}
return(FALSE);
}
BOOL BCMenu::DestroyMenu()
{
// Destroy Sub menus:
int m,n;
int numAllSubMenus = m_AllSubMenus.GetUpperBound();
for(n = numAllSubMenus; n>= 0; n--){
if(m_AllSubMenus[n]==this->m_hMenu)m_AllSubMenus.RemoveAt(n);
}
int numSubMenus = m_SubMenus.GetUpperBound();
for(m = numSubMenus; m >= 0; m--){
numAllSubMenus = m_AllSubMenus.GetUpperBound();
for(n = numAllSubMenus; n>= 0; n--){
if(m_AllSubMenus[n]==m_SubMenus[m])m_AllSubMenus.RemoveAt(n);
}
CMenu *ptr=FromHandle(m_SubMenus[m]);
BOOL flag=ptr->IsKindOf(RUNTIME_CLASS( BCMenu ));
if(flag)delete((BCMenu *)ptr);
}
m_SubMenus.RemoveAll();
// Destroy menu data
int numItems = m_MenuList.GetUpperBound();
for(m = 0; m <= numItems; m++)delete(m_MenuList[m]);
m_MenuList.RemoveAll();
if(checkmaps&&!checkmapsshare){
delete checkmaps;
checkmaps=NULL;
}
// Call base-class implementation last:
return(CMenu::DestroyMenu());
};
int BCMenu::GetMenuDrawMode(void)
{
if(IsWinXPLuna())return(xp_drawmode);
return(original_drawmode);
}
BOOL BCMenu::GetSelectDisableMode(void)
{
if(IsLunaMenuStyle())return(xp_select_disabled);
return(original_select_disabled);
}
/*
==========================================================================
void BCMenu::DrawItem(LPDRAWITEMSTRUCT)
---------------------------------------
Called by the framework when a particular item needs to be drawn. We
overide this to draw the menu item in a custom-fashion, including icons
and the 3D rectangle bar.
==========================================================================
*/
void BCMenu::DrawItem (LPDRAWITEMSTRUCT lpDIS)
{
ASSERT(lpDIS != NULL);
CDC* pDC = CDC::FromHandle(lpDIS->hDC);
if(pDC->GetDeviceCaps(RASTERCAPS) & RC_PALETTE)DrawItem_Win9xNT2000(lpDIS);
else{
if(IsWinXPLuna()){
if(xp_drawmode==BCMENU_DRAWMODE_XP) DrawIte
没有合适的资源?快使用搜索试试~ 我知道了~
客户管理系统(vc+sql2000)
共163个文件
h:36个
cpp:35个
obj:35个
4星 · 超过85%的资源 需积分: 10 24 下载量 136 浏览量
2008-12-06
13:01:08
上传
评论
收藏 4.9MB RAR 举报
温馨提示
客户管理系统(vc+sql2000)客户管理系统(vc+sql2000)客户管理系统(vc+sql2000)
资源推荐
资源详情
资源评论
收起资源包目录
客户管理系统(vc+sql2000) (163个子文件)
khmanager.aps 1.08MB
客户管理系统2.bmp 1MB
客户管理系统登录界面.bmp 212KB
Toolbar.bmp 1KB
khmanager.clw 24KB
BCMenu.cpp 87KB
BtnST.cpp 51KB
lxrxx.cpp 16KB
khts.cpp 10KB
KHFK.cpp 10KB
khbase.cpp 10KB
qkh.cpp 10KB
yuwl.cpp 9KB
quyu.cpp 9KB
khjb.cpp 8KB
khmy.cpp 8KB
qylx.cpp 8KB
qyzx.cpp 7KB
qyxz.cpp 7KB
qlxr.cpp 6KB
khb.cpp 6KB
khhj.cpp 6KB
xkh.cpp 5KB
khmain.cpp 5KB
tsm.cpp 5KB
ado.cpp 5KB
fkm.cpp 4KB
khlogin.cpp 4KB
xlxr.cpp 4KB
khl.cpp 4KB
TabSheet.cpp 3KB
khmanager.cpp 3KB
addoper.cpp 3KB
mima.cpp 2KB
khmanagerView.cpp 2KB
MainFrm.cpp 2KB
khmanagerDoc.cpp 1KB
ChildFrm.cpp 1KB
about.cpp 1KB
StdAfx.cpp 211B
Thumbs.db 120KB
Thumbs.db 7KB
MFC42D.DLL 908KB
MFCO42D.DLL 780KB
MSVCRTD.DLL 376KB
khmanager.dsp 12KB
khmanager.dsw 673B
khmanager.exe 2.22MB
rh_opt.gdt 934B
rh_opt.gpr 10KB
BCMenu.h 16KB
resource.h 9KB
BtnST.h 8KB
lxrxx.h 2KB
khts.h 2KB
KHFK.h 2KB
yuwl.h 2KB
quyu.h 2KB
khbase.h 2KB
khmain.h 2KB
khmanagerView.h 2KB
khjb.h 2KB
khmy.h 2KB
khb.h 2KB
qyzx.h 2KB
qylx.h 2KB
qyxz.h 2KB
xkh.h 2KB
xlxr.h 2KB
khhj.h 2KB
TabSheet.h 1KB
MainFrm.h 1KB
qlxr.h 1KB
qkh.h 1KB
khmanagerDoc.h 1KB
tsm.h 1KB
addoper.h 1KB
khlogin.h 1KB
fkm.h 1KB
ChildFrm.h 1KB
khmanager.h 1KB
mima.h 1KB
about.h 1KB
khl.h 1KB
StdAfx.h 1KB
ado.h 749B
下一条.ico 6KB
联系人信息.ico 6KB
icon22.ico 6KB
客户投诉.ico 6KB
保存.ico 6KB
客户呼叫中心.ico 6KB
联系人信息查询.ico 6KB
修改.ico 6KB
删除.ico 6KB
业务往来.ico 6KB
关闭.ico 6KB
关于.ico 6KB
曥找.ico 6KB
客户信息.ico 6KB
共 163 条
- 1
- 2
资源评论
- 雲中漫卟2015-12-28真的 好难呀
yebingkun363
- 粉丝: 1
- 资源: 65
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功