Compare commits

...

3 Commits

18 changed files with 688 additions and 17 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -194,6 +194,7 @@
<ClInclude Include="PublicStruct.h" />
<ClInclude Include="Resource.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="TrueColorToolBar.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="CcRemote.cpp" />
@@ -204,6 +205,7 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TrueColorToolBar.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="CcRemote.rc" />
@@ -213,6 +215,8 @@
</ItemGroup>
<ItemGroup>
<Image Include="res\CcRemote.ico" />
<Image Include="res\toolbar1.bmp" />
<Image Include="res\ToolBar_Main.bmp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@@ -13,6 +13,9 @@
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="重写控件">
<UniqueIdentifier>{476b0088-5a08-4c04-af41-397f23c6743b}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="CcRemote.h">
@@ -36,6 +39,9 @@
<ClInclude Include="PublicStruct.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="TrueColorToolBar.h">
<Filter>重写控件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="CcRemote.cpp">
@@ -47,6 +53,9 @@
<ClCompile Include="CcRemoteDlg.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="TrueColorToolBar.cpp">
<Filter>重写控件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="CcRemote.rc">
@@ -62,5 +71,11 @@
<Image Include="res\CcRemote.ico">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\toolbar1.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\ToolBar_Main.bmp">
<Filter>资源文件</Filter>
</Image>
</ItemGroup>
</Project>

View File

@@ -67,11 +67,30 @@ void CCcRemoteDlg::DoDataExchange(CDataExchange* pDX)
}
BEGIN_MESSAGE_MAP(CCcRemoteDlg, CDialogEx)
//-------------自定义------------
ON_MESSAGE(UM_ICONNOTIFY, (LRESULT(__thiscall CWnd::*)(WPARAM, LPARAM))OnIconNotify)
//-------------系统-------------
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_WM_SIZE()
ON_NOTIFY(NM_RCLICK, IDC_ONLINE, &CCcRemoteDlg::OnNMRClickOnline)
ON_COMMAND(ID_ONLINE_AUDIO, &CCcRemoteDlg::OnOnlineAudio)
ON_COMMAND(ID_ONLINE_CMD, &CCcRemoteDlg::OnOnlineCmd)
ON_COMMAND(ID_ONLINE_DESKTOP, &CCcRemoteDlg::OnOnlineDesktop)
ON_COMMAND(ID_ONLINE_FILE, &CCcRemoteDlg::OnOnlineFile)
ON_COMMAND(ID_ONLINE_PROCESS, &CCcRemoteDlg::OnOnlineProcess)
ON_COMMAND(ID_ONLINE_REGIST, &CCcRemoteDlg::OnOnlineRegist)
ON_COMMAND(ID_ONLINE_SERVER, &CCcRemoteDlg::OnOnlineServer)
ON_COMMAND(ID_ONLINE_VIDEO, &CCcRemoteDlg::OnOnlineVideo)
ON_COMMAND(ID_ONLINE_WINDOW, &CCcRemoteDlg::OnOnlineWindow)
ON_COMMAND(ID_ONLINE_DELETE, &CCcRemoteDlg::OnOnlineDelete)
ON_COMMAND(IDM_MAIN_SET, &CCcRemoteDlg::OnMainSet)
ON_COMMAND(IDM_MAIN_CLOSE, &CCcRemoteDlg::OnMainClose)
ON_COMMAND(IDM_MAIN_BUILD, &CCcRemoteDlg::OnMainBuild)
ON_COMMAND(IDM_MAIN_ABOUT, &CCcRemoteDlg::OnMainAbout)
ON_WM_CLOSE()
END_MESSAGE_MAP()
@@ -107,9 +126,12 @@ BOOL CCcRemoteDlg::OnInitDialog()
SetIcon(m_hIcon, FALSE); // 设置小图标
// TODO: 在此添加额外的初始化代码
InitSystemMenu();//初始化系统托盘
InitToolBar();//初始化工具栏按钮控件
InitMyMenu();//初始化菜单控件
InitList();//初始化列表控件
InitStatusBar();//初始化状态栏控件
//---------改变窗口大小出发动态调整-------|
CRect rect;
GetWindowRect(&rect);
@@ -117,7 +139,6 @@ BOOL CCcRemoteDlg::OnInitDialog()
MoveWindow(rect);
//----------------------------------------|
Test();
return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
}
@@ -177,6 +198,10 @@ void CCcRemoteDlg::OnSize(UINT nType, int cx, int cy)
{
double dcx = cx; //对话框的总宽度
CDialogEx::OnSize(nType, cx, cy);
if (SIZE_MINIMIZED == nType)//当窗口最小化避免大小为0造成崩溃直接返回
return;
if (m_CList_Online.m_hWnd != NULL)
{
CRect rc;
@@ -186,8 +211,6 @@ void CCcRemoteDlg::OnSize(UINT nType, int cx, int cy)
rc.bottom = cy - 160; //列表的下坐标
m_CList_Online.MoveWindow(rc);
for (int i = 0; i < COLUMN_ONLINE_COUNT; i++) { //遍历每一个列
double dd = m_Column_Online_Data[i].nWidth; //得到当前列的宽度
dd /= m_Column_Online_Width; //看一看当前宽度占总长度的几分之几
@@ -202,7 +225,7 @@ void CCcRemoteDlg::OnSize(UINT nType, int cx, int cy)
rc.left = 1; //列表的左坐标
rc.top = cy - 156; //列表的上坐标
rc.right = cx - 1; //列表的右坐标
rc.bottom = cy - 6; //列表的下坐标
rc.bottom = cy - 20; //列表的下坐标
m_CList_Message.MoveWindow(rc);
for (int i = 0; i < COLUMN_MESSAGE_COUNT; i++) { //遍历每一个列
@@ -213,9 +236,50 @@ void CCcRemoteDlg::OnSize(UINT nType, int cx, int cy)
m_CList_Message.SetColumnWidth(i, (lenth)); //设置当前的宽度
}
}
if (m_wndStatusBar.m_hWnd != NULL) { //当对话框大小改变时 状态条大小也随之改变
CRect rc;
rc.top = cy - 20;
rc.left = 0;
rc.right = cx;
rc.bottom = cy;
m_wndStatusBar.MoveWindow(rc);
m_wndStatusBar.SetPaneInfo(0, m_wndStatusBar.GetItemID(0), SBPS_POPOUT, cx - 10);
}
if (m_ToolBar.m_hWnd != NULL) //工具条
{
CRect rc;
rc.top = rc.left = 0;
rc.right = cx;
rc.bottom = 80;
m_ToolBar.MoveWindow(rc); //设置工具条大小位置
}
// TODO: 在此处添加消息处理程序代码
}
int CCcRemoteDlg::InitMyMenu()
{
HMENU hmenu;
hmenu = LoadMenu(NULL, MAKEINTRESOURCE(IDR_MENU_MAIN)); //载入菜单资源
::SetMenu(this->GetSafeHwnd(), hmenu); //为窗口设置菜单
::DrawMenuBar(this->GetSafeHwnd()); //显示菜单
popup.LoadMenu(IDR_MENU_ONLINE);//载入菜单资源
::MENUINFO lpcmi;
m_brush.CreateSolidBrush(RGB(236, 153, 101));//颜色
memset(&lpcmi, 0, sizeof(::LPCMENUINFO));
lpcmi.cbSize = sizeof(MENUINFO);
lpcmi.fMask = MIM_APPLYTOSUBMENUS | MIM_BACKGROUND;
lpcmi.hbrBack = (HBRUSH)m_brush.operator HBRUSH();
::SetMenuInfo(popup, &lpcmi);
return 0;
}
int CCcRemoteDlg::InitList()
{
m_CList_Online.SetExtendedStyle(LVS_EX_FULLROWSELECT);
@@ -245,6 +309,7 @@ void CCcRemoteDlg::AddList(CString strIP, CString strAddr, CString strPCName, CS
m_CList_Online.SetItemText(0, ONLINELIST_CPU, strCPU);
m_CList_Online.SetItemText(0, ONLINELIST_VIDEO, strVideo);
m_CList_Online.SetItemText(0, ONLINELIST_PING, strPing);
ShowMessage(true, strIP + "主机上线");
}
void CCcRemoteDlg::ShowMessage(bool bIsOK, CString strMsg)
@@ -262,21 +327,43 @@ void CCcRemoteDlg::ShowMessage(bool bIsOK, CString strMsg)
m_CList_Message.InsertItem(0, strIsOK);
m_CList_Message.SetItemText(0, 1, strTime);
m_CList_Message.SetItemText(0, 2, strMsg);
CString strStatusMsg;
if (strMsg.Find("上线") > 0) //处理上线还是下线消息
{
m_OnlineCount++;
}
else if (strMsg.Find("下线") > 0)
{
m_OnlineCount--;
}
else if (strMsg.Find("断开") > 0)
{
m_OnlineCount--;
}
m_OnlineCount = (m_OnlineCount <= 0 ? 0 : m_OnlineCount); //防止iCount 有-1的情况
strStatusMsg.Format("已连接: %d", m_OnlineCount);
m_wndStatusBar.SetPaneText(0, strStatusMsg); //在状态条上显示文字
}
void CCcRemoteDlg::Test()
{
AddList("192.168.0.1", "本机局域网", "Lang", "Windows7", "2.2GHZ", "", "123232");
ShowMessage(true, "软件初始化成功...");
AddList("192.168.0.1", "本机局域网", "CHANG", "Windows7", "2.2GHZ", "", "123232");
AddList("192.168.10.1", "本机局域网", "WANG", "Windows10", "2.2GHZ", "", "111111");
AddList("192.168.18.25", "本机局域网", "LIU", "Windows8", "2.2GHZ", "", "654321");
AddList("192.168.97.162", "本机局域网", "SHANG", "WindowsXP", "2.2GHZ", "", "123456");
}
void CCcRemoteDlg::OnNMRClickOnline(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
// TODO: 在此添加控件通知处理程序代码
CMenu popup;//声明一个菜单变量
popup.LoadMenu(IDR_MENU_ONLINE);//载入菜单资源
CMenu* pM = popup.GetSubMenu(0);//得到菜单项
CPoint p;
GetCursorPos(&p);//得到鼠标指针的位置
@@ -287,8 +374,248 @@ void CCcRemoteDlg::OnNMRClickOnline(NMHDR *pNMHDR, LRESULT *pResult)
{
pM->EnableMenuItem(i, MF_BYPOSITION | MF_DISABLED | MF_GRAYED); //菜单全部变灰
}
}
else
{
for (int i = 0; i < count; i++) //遍历每一个菜单
{
pM->EnableMenuItem(i, MF_BYPOSITION | MF_ENABLED ); //菜单可用
}
}
pM->TrackPopupMenu(TPM_LEFTALIGN, p.x, p.y, this); //在指定位置显示菜单
*pResult = 0;
}
void CCcRemoteDlg::OnOnlineAudio()
{
// TODO: 在此添加命令处理程序代码
MessageBox("声音");
}
void CCcRemoteDlg::OnOnlineCmd()
{
// TODO: 在此添加命令处理程序代码
MessageBox("CMD");
}
void CCcRemoteDlg::OnOnlineDesktop()
{
// TODO: 在此添加命令处理程序代码
}
void CCcRemoteDlg::OnOnlineFile()
{
// TODO: 在此添加命令处理程序代码
}
void CCcRemoteDlg::OnOnlineProcess()
{
// TODO: 在此添加命令处理程序代码
}
void CCcRemoteDlg::OnOnlineRegist()
{
// TODO: 在此添加命令处理程序代码
}
void CCcRemoteDlg::OnOnlineServer()
{
// TODO: 在此添加命令处理程序代码
}
void CCcRemoteDlg::OnOnlineVideo()
{
// TODO: 在此添加命令处理程序代码
}
void CCcRemoteDlg::OnOnlineWindow()
{
// TODO: 在此添加命令处理程序代码
}
void CCcRemoteDlg::OnOnlineDelete()
{
// TODO: 在此添加命令处理程序代码
CString strIP;//选择断开的IP
int iSelect = m_CList_Online.GetSelectionMark();//获得选中的行
strIP = m_CList_Online.GetItemText(iSelect, ONLINELIST_IP);//获取断开的IP字符串
m_CList_Online.DeleteItem(iSelect);//删除该列表项
strIP += " 由主机主动断开连接";
ShowMessage(true, strIP);//显示日志
}
void CCcRemoteDlg::OnMainSet()
{
// TODO: 在此添加命令处理程序代码
}
void CCcRemoteDlg::OnMainClose()
{
// TODO: 在此添加命令处理程序代码
PostMessage(WM_CLOSE);
}
void CCcRemoteDlg::OnMainBuild()
{
// TODO: 在此添加命令处理程序代码
}
void CCcRemoteDlg::OnMainAbout()
{
// TODO: 在此添加命令处理程序代码
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
//状态栏数组
static UINT indicators[] =
{
IDR_STATUSBAR_STRING
};
//初始化状态栏
void CCcRemoteDlg::InitStatusBar()
{
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators) / sizeof(UINT))) //创建状态条并设置字符资源的ID
{
TRACE0("Failed to create status bar\n");
return; // fail to create
}
CRect rc;
::GetWindowRect(m_wndStatusBar.m_hWnd, rc);
m_wndStatusBar.MoveWindow(rc); //移动状态条到指定位置
}
//初始化工具条按钮控件
void CCcRemoteDlg::InitToolBar()
{
//创建工具条
if (!m_ToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_ToolBar.LoadToolBar(IDR_TOOLBAR_MAIN))//载入创建好的控件资源
{
TRACE0("Failed to create toolbar\n");
return; // fail to create
}
m_ToolBar.ModifyStyle(0, TBSTYLE_FLAT); //Fix for WinXP
//加载位图资源
m_ToolBar.LoadTrueColorToolBar
(
48, //加载真彩工具条
IDB_BITMAP_MAIN,
IDB_BITMAP_MAIN,
IDB_BITMAP_MAIN
);
RECT rt, rtMain;
GetWindowRect(&rtMain);//获取窗口大小
rt.left = 0;
rt.top = 0;
rt.bottom = 80;
rt.right = rtMain.right - rtMain.left + 10;
m_ToolBar.MoveWindow(&rt, TRUE);
m_ToolBar.SetButtonText(0, "终端管理");
m_ToolBar.SetButtonText(1, "进程管理");
m_ToolBar.SetButtonText(2, "窗口管理");
m_ToolBar.SetButtonText(3, "桌面管理");
m_ToolBar.SetButtonText(4, "文件管理");
m_ToolBar.SetButtonText(5, "语音管理");
m_ToolBar.SetButtonText(6, "视频管理");
m_ToolBar.SetButtonText(7, "服务管理");
m_ToolBar.SetButtonText(8, "注册表管理");
m_ToolBar.SetButtonText(10, "参数设置");
m_ToolBar.SetButtonText(11, "生成服务端");
m_ToolBar.SetButtonText(12, "帮助");
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
}
//初始化工具条按钮控件
void CCcRemoteDlg::InitSystemMenu()
{
/*
typedef struct _NOTIFYICONDATA {
DWORD cbSize; //结构体自身大小
HWND hWnd; //托盘的父窗口 托盘发出的消息由哪一个窗口响应
UINT uID; //显示图标的ID
UINT uFlags; //托盘的状态 (如有图标,有气泡提示,有消息响应等)
UINT uCallbackMessage; //托盘事件的消息响应函数
HICON hIcon; //图标的变量
TCHAR szTip[64]; //气泡的显示文字
DWORD dwState; //图标的显示状态
DWORD dwStateMask; //图标的显示状态
TCHAR szInfo[256]; //气泡的显示文字 (可以忽略)
union {
UINT uTimeout;
UINT uVersion;
};
TCHAR szInfoTitle[64];
DWORD dwInfoFlags;
GUID guidItem;
HICON hBalloonIcon;
} NOTIFYICONDATA, *PNOTIFYICONDATA;
*/
nid.cbSize = sizeof(nid); //大小赋值
nid.hWnd = m_hWnd; //父窗口
nid.uID = IDR_MAINFRAME; //icon ID
nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; //托盘所拥有的状态
nid.uCallbackMessage = UM_ICONNOTIFY; //回调消息
nid.hIcon = m_hIcon; //icon 变量
CString str = "CcRemote远程协助软件"; //气泡提示
lstrcpyn(nid.szTip, (LPCSTR)str, sizeof(nid.szTip) / sizeof(nid.szTip[0]));
Shell_NotifyIcon(NIM_ADD, &nid); //显示托盘
}
void CCcRemoteDlg::OnClose()
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
Shell_NotifyIcon(NIM_DELETE, &nid); //销毁图标
CDialogEx::OnClose();
}
void CCcRemoteDlg::OnIconNotify(WPARAM wParam, LPARAM lParam)
{
switch ((UINT)lParam)
{
case WM_LBUTTONDOWN: // click or dbclick left button on icon
case WM_LBUTTONDBLCLK: // should show desktop
if (!IsWindowVisible())
ShowWindow(SW_SHOW);
else
ShowWindow(SW_HIDE);
break;
case WM_RBUTTONDOWN: // click right button, show menu
CMenu menu;
menu.LoadMenu(IDR_MENU_NOTIFY);
CPoint point;
GetCursorPos(&point);
SetForegroundWindow();
menu.GetSubMenu(0)->TrackPopupMenu(
TPM_LEFTBUTTON | TPM_RIGHTBUTTON,
point.x, point.y, this, NULL);
PostMessage(WM_USER, 0, 0);
break;
}
}

View File

@@ -1,6 +1,7 @@

// CcRemoteDlg.h: 头文件
//
#include "TrueColorToolBar.h"
#include "PublicStruct.h"
#pragma once
@@ -32,13 +33,20 @@ protected:
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
public:
CStatusBar m_wndStatusBar;//状态控件
CListCtrl m_CList_Online;//在线列表变量
CListCtrl m_CList_Message;//消息列表变量
CTrueColorToolBar m_ToolBar;//工具条按钮控件变量
afx_msg void OnSize(UINT nType, int cx, int cy);
private:
//--------------主界面列表的显示变量及常量----------------
//--------------变量及常量----------------
int m_OnlineCount;//上线计数
CBrush m_brush;//绘色函数
CMenu popup;//LIST菜单变量
NOTIFYICONDATA nid;//含有图标 消息响应 的一个结构体 用于系统托盘
#define COLUMN_ONLINE_COUNT 7 //在线列表的个数
#define COLUMN_MESSAGE_COUNT 3 //消息列表的个数
int m_Column_Online_Width = 0; //在线列表宽度和
@@ -62,12 +70,40 @@ private:
{"信息内容", 660 }
};
//-----------------------函数-----------------------
int InitList();//初始化list控件信息
int InitMyMenu();//初始化主页面上方菜单
void InitStatusBar();//初始化状态控件
void InitToolBar();//初始化工具条按钮控件
void InitSystemMenu();//初始化系统托盘菜单
void AddList(CString strIP, CString strAddr, CString strPCName, CString strOS, CString strCPU, CString strVideo, CString strPing);
void ShowMessage(bool bIsOK, CString strMsg);
void Test();
public:
//-------------自定义消息处理-------------
afx_msg void OnIconNotify(WPARAM wParam, LPARAM lParam);
//-------------系统消息处理-------------
afx_msg void OnNMRClickOnline(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnOnlineAudio();
afx_msg void OnOnlineCmd();
afx_msg void OnOnlineDesktop();
afx_msg void OnOnlineFile();
afx_msg void OnOnlineProcess();
afx_msg void OnOnlineRegist();
afx_msg void OnOnlineServer();
afx_msg void OnOnlineVideo();
afx_msg void OnOnlineWindow();
afx_msg void OnOnlineDelete();
afx_msg void OnMainSet();
afx_msg void OnMainClose();
afx_msg void OnMainBuild();
afx_msg void OnMainAbout();
afx_msg void OnClose();
};

View File

@@ -0,0 +1,20 @@
f:\myapp\ccremote\ccremote\ccremote\debug\ccremote.pch
f:\myapp\ccremote\ccremote\ccremote\debug\vc141.pdb
f:\myapp\ccremote\ccremote\ccremote\debug\vc141.idb
f:\myapp\ccremote\ccremote\ccremote\debug\pch.obj
f:\myapp\ccremote\ccremote\ccremote\debug\truecolortoolbar.obj
f:\myapp\ccremote\ccremote\ccremote\debug\ccremotedlg.obj
f:\myapp\ccremote\ccremote\ccremote\debug\ccremote.obj
f:\myapp\ccremote\ccremote\debug\ccremote.ilk
f:\myapp\ccremote\ccremote\debug\ccremote.exe
f:\myapp\ccremote\ccremote\debug\ccremote.pdb
f:\myapp\ccremote\ccremote\ccremote\debug\ccremote.res
f:\myapp\ccremote\ccremote\ccremote\debug\ccremote.tlog\cl.command.1.tlog
f:\myapp\ccremote\ccremote\ccremote\debug\ccremote.tlog\cl.read.1.tlog
f:\myapp\ccremote\ccremote\ccremote\debug\ccremote.tlog\cl.write.1.tlog
f:\myapp\ccremote\ccremote\ccremote\debug\ccremote.tlog\link.command.1.tlog
f:\myapp\ccremote\ccremote\ccremote\debug\ccremote.tlog\link.read.1.tlog
f:\myapp\ccremote\ccremote\ccremote\debug\ccremote.tlog\link.write.1.tlog
f:\myapp\ccremote\ccremote\ccremote\debug\ccremote.tlog\rc.command.1.tlog
f:\myapp\ccremote\ccremote\ccremote\debug\ccremote.tlog\rc.read.1.tlog
f:\myapp\ccremote\ccremote\ccremote\debug\ccremote.tlog\rc.write.1.tlog

View File

@@ -1,7 +1,8 @@
 pch.cpp
CcRemote.cpp
CcRemoteDlg.cpp
g:\ccremote\ccremote\ccremote\ccremote\ccremotedlg.cpp(195): warning C4244: “初始化”: 从“double”转换到“int”可能丢失数据
g:\ccremote\ccremote\ccremote\ccremote\ccremotedlg.cpp(212): warning C4244: “初始化”: 从“double”转换到“int”可能丢失数据
f:\myapp\ccremote\ccremote\ccremote\ccremotedlg.cpp(220): warning C4244: “初始化”: 从“double”转换到“int”可能丢失数据
f:\myapp\ccremote\ccremote\ccremote\ccremotedlg.cpp(237): warning C4244: “初始化”: 从“double”转换到“int”可能丢失数据
TrueColorToolBar.cpp
正在生成代码...
CcRemote.vcxproj -> G:\CcRemote\CcRemote\CcRemote\Debug\CcRemote.exe
CcRemote.vcxproj -> F:\myapp\CcRemote\CcRemote\Debug\CcRemote.exe

Binary file not shown.

View File

@@ -1,2 +1,2 @@
#TargetFrameworkVersion=v4.0:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0.17763.0
Debug|Win32|G:\CcRemote\CcRemote\CcRemote\|
Debug|Win32|F:\myapp\CcRemote\CcRemote\|

View File

@@ -1,5 +1,6 @@
#pragma once
//<2F>б<EFBFBD>ö<EFBFBD><C3B6>
enum
{
ONLINELIST_IP = 0, //IP<49><50><EFBFBD><EFBFBD>˳<EFBFBD><CBB3>
@@ -17,3 +18,10 @@ typedef struct
char *title; //<2F>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int nWidth; //<2F>б<EFBFBD><D0B1>Ŀ<EFBFBD><C4BF><EFBFBD>
}COLUMNSTRUCT;
//<2F>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>Ϣö<CFA2><C3B6>
enum
{
UM_ICONNOTIFY = WM_USER + 0x100,
};

View File

@@ -0,0 +1,139 @@
/***=========================================================================
==== ====
==== D C U t i l i t y ====
==== ====
=============================================================================
==== ====
==== File name : TrueColorToolBar.cpp ====
==== Project name : Tester ====
==== Project number : --- ====
==== Creation date : 13/1/2003 ====
==== Author(s) : Dany Cantin ====
==== ====
==== Copyright ?DCUtility 2003 ====
==== ====
=============================================================================
===========================================================================*/
#include "pch.h"
#include "TrueColorToolBar.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTrueColorToolBar
CTrueColorToolBar::CTrueColorToolBar()
{
m_bDropDown = FALSE;
}
CTrueColorToolBar::~CTrueColorToolBar()
{
}
BEGIN_MESSAGE_MAP(CTrueColorToolBar, CToolBar)
//{{AFX_MSG_MAP(CTrueColorToolBar)
ON_NOTIFY_REFLECT(TBN_DROPDOWN, OnToolbarDropDown)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTrueColorToolBar message handlers
BOOL CTrueColorToolBar::LoadTrueColorToolBar(int nBtnWidth,
UINT uToolBar,
UINT uToolBarHot,
UINT uToolBarDisabled)
{
if (!SetTrueColorToolBar(TB_SETIMAGELIST, uToolBar, nBtnWidth))
return FALSE;
if (uToolBarHot) {
if (!SetTrueColorToolBar(TB_SETHOTIMAGELIST, uToolBarHot, nBtnWidth))
return FALSE;
}
if (uToolBarDisabled) {
if (!SetTrueColorToolBar(TB_SETDISABLEDIMAGELIST, uToolBarDisabled, nBtnWidth))
return FALSE;
}
return TRUE;
}
BOOL CTrueColorToolBar::SetTrueColorToolBar(UINT uToolBarType,
UINT uToolBar,
int nBtnWidth)
{
CImageList cImageList;
CBitmap cBitmap;
BITMAP bmBitmap;
if (!cBitmap.Attach(LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(uToolBar),
IMAGE_BITMAP, 0, 0,
LR_DEFAULTSIZE|LR_CREATEDIBSECTION)) ||
!cBitmap.GetBitmap(&bmBitmap))
return FALSE;
CSize cSize(bmBitmap.bmWidth, bmBitmap.bmHeight);
int nNbBtn = cSize.cx/nBtnWidth;
RGBTRIPLE* rgb = (RGBTRIPLE*)(bmBitmap.bmBits);
COLORREF rgbMask = RGB(rgb[0].rgbtRed, rgb[0].rgbtGreen, rgb[0].rgbtBlue);
if (!cImageList.Create(nBtnWidth, cSize.cy, ILC_COLOR24|ILC_MASK, nNbBtn, 0))
return FALSE;
if (cImageList.Add(&cBitmap, rgbMask) == -1)
return FALSE;
SendMessage(uToolBarType, 0, (LPARAM)cImageList.m_hImageList);
cImageList.Detach();
cBitmap.Detach();
return TRUE;
}
void CTrueColorToolBar::AddDropDownButton(CWnd* pParent, UINT uButtonID, UINT uMenuID)
{
if (!m_bDropDown) {
GetToolBarCtrl().SendMessage(TB_SETEXTENDEDSTYLE, 0, (LPARAM)TBSTYLE_EX_DRAWDDARROWS);
m_bDropDown = TRUE;
}
SetButtonStyle(CommandToIndex(uButtonID), TBSTYLE_DROPDOWN);
stDropDownInfo DropDownInfo;
DropDownInfo.pParent = pParent;
DropDownInfo.uButtonID = uButtonID;
DropDownInfo.uMenuID = uMenuID;
m_lstDropDownButton.Add(DropDownInfo);
}
void CTrueColorToolBar::OnToolbarDropDown(NMHDR * pnmtb, LRESULT *plr)
{
NMTOOLBARA * pnmtbb=(NMTOOLBARA *)pnmtb;
for (int i = 0; i < m_lstDropDownButton.GetSize(); i++) {
stDropDownInfo DropDownInfo = m_lstDropDownButton.GetAt(i);
if (DropDownInfo.uButtonID == UINT(pnmtbb->iItem)) {
CMenu menu;
menu.LoadMenu(DropDownInfo.uMenuID);
CMenu* pPopup = menu.GetSubMenu(0);
CRect rc;
SendMessage(TB_GETRECT, (WPARAM)pnmtbb->iItem, (LPARAM)&rc);
ClientToScreen(&rc);
pPopup->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_VERTICAL,
rc.left, rc.bottom, DropDownInfo.pParent, &rc);
break;
}
}
}

View File

@@ -0,0 +1,88 @@
/***=========================================================================
==== ====
==== D C U t i l i t y ====
==== ====
=============================================================================
==== ====
==== File name : TrueColorToolBar.h ====
==== Project name : Tester ====
==== Project number : --- ====
==== Creation date : 13/1/2003 ====
==== Author(s) : Dany Cantin ====
==== ====
==== Copyright ?DCUtility 2003 ====
==== ====
=============================================================================
===========================================================================*/
#ifndef TRUECOLORTOOLBAR_H_
#define TRUECOLORTOOLBAR_H_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <afxtempl.h>
/////////////////////////////////////////////////////////////////////////////
// CTrueColorToolBar
class CTrueColorToolBar : public CToolBar
{
// Construction
public:
CTrueColorToolBar();
// Attributes
private:
BOOL m_bDropDown;
struct stDropDownInfo {
public:
UINT uButtonID;
UINT uMenuID;
CWnd* pParent;
};
CArray <stDropDownInfo, stDropDownInfo&> m_lstDropDownButton;
// Operations
public:
BOOL LoadTrueColorToolBar(int nBtnWidth,
UINT uToolBar,
UINT uToolBarHot = 0,
UINT uToolBarDisabled = 0);
void AddDropDownButton(CWnd* pParent, UINT uButtonID, UINT uMenuID);
private:
BOOL SetTrueColorToolBar(UINT uToolBarType,
UINT uToolBar,
int nBtnWidth);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CTrueColorToolBar)
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CTrueColorToolBar();
// Generated message map functions
protected:
//{{AFX_MSG(CTrueColorToolBar)
afx_msg void OnToolbarDropDown(NMHDR * pnmh, LRESULT* plRes);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // TRUECOLORTOOLBAR_H_

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -6,9 +6,16 @@
#define IDD_ABOUTBOX 100
#define IDS_ABOUTBOX 101
#define IDD_CCREMOTE_DIALOG 102
#define IDR_STATUSBAR_STRING 102
#define IDR_MAINFRAME 128
#define IDR_MENU1 130
#define IDR_MENU_ONLINE 130
#define IDR_MENU2 133
#define IDR_MENU_MAIN 133
#define IDR_TOOLBAR_MAIN 134
#define IDB_BITMAP_MAIN 136
#define IDR_MENU3 137
#define IDR_MENU_NOTIFY 137
#define IDC_ONLINE 1000
#define IDC_LIST2 1001
#define IDC_MESSAGE 1001
@@ -30,13 +37,39 @@
#define ID_ONLINE_AUDIO 32786
#define ID_ONLINE_REGIST 32787
#define ID_ONLINE_CMD 32788
#define ID_ONLINE_32789 32789
#define ID_ONLINE_DELETE 32790
#define ID_32791 32791
#define ID_32792 32792
#define ID_32793 32793
#define ID_32794 32794
#define IDM_MAIN_ABOUT 32795
#define IDM_MAIN_SET 32796
#define IDM_MAIN_BUILD 32797
#define IDM_MAIN_CLOSE 32798
#define ID_BUTTON32799 32799
#define ID_BUTTON32800 32800
#define ID_BUTTON32801 32801
#define ID_BUTTON32802 32802
#define ID_BUTTON32803 32803
#define ID_BUTTON32804 32804
#define ID_BUTTON32805 32805
#define ID_BUTTON32806 32806
#define ID_BUTTON32807 32807
#define ID_BUTTON32808 32808
#define ID_BUTTON32810 32810
#define ID_BUTTON32811 32811
#define ID_SYSTEMMENU_XIA 32812
#define ID_SYSTEMMENU_32813 32813
#define IDM_NOTIFY_SHOW 32814
#define IDM_NOTIFY_CLOSE 32815
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 133
#define _APS_NEXT_COMMAND_VALUE 32789
#define _APS_NEXT_RESOURCE_VALUE 138
#define _APS_NEXT_COMMAND_VALUE 32816
#define _APS_NEXT_CONTROL_VALUE 1002
#define _APS_NEXT_SYMED_VALUE 101
#endif

Binary file not shown.