CSWIN.CPP
上传用户:zhang8947
上传日期:2007-01-08
资源大小:1910k
文件大小:28k
- // cswin.cpp : implementation file
- //
- #include "stdafx.h"
- #include <io.h>
- #include "resource.h"
- #include "basicwin.h"
- #include "basicbut.h"
- #include "systemse.h"
- #include "menubutt.h"
- #include "activebu.h"
- #include "cswin.h"
- #include "cspublic.h"
- #include "cskernel.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CCsWin
- CCsWin::CCsWin()
- {
- GetSomePrograms() ;
-
- //初始化窗口参数
- //窗口按钮行数
- m_nRowNum =GetPrivateProfileInt( "窗口参数" , "窗口按钮行数" ,
- 1 , INI_FILE_NAME ) ;
- //动作按钮数目
- m_nActiveButtonNum =min( GetPrivateProfileInt( "工具箱" ,
- "工具数目" , 0 , INI_FILE_NAME ) , MAX_ACTIVE_BUTTON ) ;
- //计算浮动条的列数
- m_nColNum =(m_nActiveButtonNum+1)/m_nRowNum ;
- if( (m_nActiveButtonNum+1)%m_nRowNum ) //不能整除
- m_nColNum++ ;
- //计算主窗口的宽度与高度
- m_nWidth =m_nColNum*BUTTON_WIDTH + 2 ;
- m_nTuiHuaWidth =m_nWidth ; //退化宽度
- m_nHeight =m_nRowNum*BUTTON_HEIGHT + 2 ;
- //窗口左上角位置
- m_LeftTopPos.x =GetPrivateProfileInt( "窗口参数" ,
- "窗口左上角的x坐标" , 300 , INI_FILE_NAME ) ;
- if( m_LeftTopPos.x<0 ||
- m_LeftTopPos.x>GetSystemMetrics(SM_CXSCREEN)-m_nWidth )
- m_LeftTopPos.x =300 ;
- m_LeftTopPos.y =GetPrivateProfileInt( "窗口参数" ,
- "窗口左上角的y坐标" , 0 , INI_FILE_NAME ) ;
- if( m_LeftTopPos.y<0 ||
- m_LeftTopPos.y>GetSystemMetrics(SM_CYSCREEN)-m_nHeight )
- m_LeftTopPos.x =0 ;
- //创建主窗口
- VERIFY( CreateEx( WS_EX_TOPMOST ,
- AfxRegisterWndClass( CS_SAVEBITS , 0 , 0 ,
- AfxGetApp()->LoadIcon( IDI_ICON1 ) ) ,
- "中文大观(作者:朱佳良)" , WS_POPUP ,
- m_LeftTopPos.x , m_LeftTopPos.y ,
- m_nWidth , m_nHeight ,
- NULL , NULL ) ) ;
- m_bButtonIsDown =0 ; //初始鼠标键没有按下
- m_nMoveStatus =0 ;
- //创建系统按钮
- RECT rect={ 1 , 1 , 1+BUTTON_WIDTH , 1+BUTTON_HEIGHT } ;
- VERIFY( m_SystemButton.InitButton( //系统按钮
- "中文大观系统按钮(作者:朱佳良)" ,
- rect , this , 111 , IDB_BITMAP1 ,
- IDR_MENU1 ) ) ;
- m_SystemButton.SetHint( "中文大观系统设置" ,
- "いゅ