内容参考于:易道云信息技术研究院VIP课
上一个内容:升级Notice类获得背包基址-CSDN博客
码云地址(ui显示角色数据 分支):https://gitee.com/dye_your_fingers/sro_-ex.git
码云版本号:3be017de38c50653b1d98bae6eb6db0fcff7bd54
代码下载地址,在 SRO_EX 目录下,文件名为:SRO_Ex-自动化助手显示物品数据.zip
链接:https://pan.baidu.com/s/1W-JpUcGOWbSJmMdmtMzYZg
提取码:q9n5
--来自百度网盘超级会员V4的分享
HOOK引擎,文件名为:黑兔sdk.zip
链接:https://pan.baidu.com/s/1IB-Zs6hi3yU8LC2f-8hIEw
提取码:78h8
--来自百度网盘超级会员V4的分享
以 升级Notice类获得背包基址 它的代码为基础进行修改
效果图:
首先设置窗口
新加ListBox控件
设置属性
添加变量
CUI.cpp文件的修改:修改了 OnInitDialog函数
// CUI.cpp: 实现文件
//#include "pch.h"
#include "htdMfcDll.h"
#include "CUI.h"
#include "afxdialogex.h"// CUI 对话框IMPLEMENT_DYNAMIC(CUI, CDialogEx)CUI::CUI(CWnd* pParent /*=nullptr*/): CDialogEx(IDD_MAIN, pParent)
{}CUI::~CUI()
{
}void CUI::DoDataExchange(CDataExchange* pDX)
{CDialogEx::DoDataExchange(pDX);DDX_Control(pDX, IDC_TAB1, mTab);
}BOOL CUI::OnInitDialog()
{CDialogEx::OnInitDialog();InstallPage(new CUIWnd_0(), IDD_PAGE_0, L"角色", TRUE);InstallPage(new CUIWnd_1(), IDD_PAGE_1, L"物品");SetBackgroundColor(0xFFFFFFFF);//PageINJ.Init(wAppPath);//PageRAN.SetAppPath(wAppPath);return TRUE;
}bool CUI::InstallPage(CDialogEx* wnd, int IDD_WND, CString&& _Name, BOOL IsShow)
{if (CurPage >= MAX_PAGE_MAIN) return false;Pages[CurPage] = wnd;Pages[CurPage]->Create(IDD_WND, this);//Pages[CurPage]->SetParent(this);Pages[CurPage]->ShowWindow(IsShow);CRect rect;mTab.GetClientRect(&rect);rect.top += 46;rect.left = 0;rect.bottom -= 5;rect.right -= 5;Pages[CurPage]->MoveWindow(&rect);mTab.InsertItem(CurPage, _Name);CurPage++;return true;
}BEGIN_MESSAGE_MAP(CUI, CDialogEx)ON_NOTIFY(TCN_SELCHANGE, IDC_TAB1, &CUI::OnTcnSelchangeTab1)ON_WM_CLOSE()
END_MESSAGE_MAP()// CUI 消息处理程序void CUI::OnTcnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult)
{// TODO: 在此添加控件通知处理程序代码*pResult = 0;int n = mTab.GetCurSel();for (int i = 0; i < CurPage; i++){Pages[i]->ShowWindow(i == n);}
}void CUI::UIShow()
{auto hwndClient = ::FindWindow(L"CLIENT", L"SRO_CLIENT");::SetParent(this->m_hWnd, hwndClient);this->ShowWindow(ShowUI = !ShowUI);// 把焦点还给游戏::SetFocus(hwndClient);
}void CUI::OnClose()
{// TODO: 在此添加消息处理程序代码和/或调用默认值UIShow();// CDialogEx::OnClose();
}
CUIWnd_1.cpp文件的修改:修改了 OnBnClickedButton1函数,OnBnClickedButton1函数是读取物品信息按钮的点击事件
// CUIWnd_1.cpp: 实现文件
//#include "pch.h"
#include "htdMfcDll.h"
#include "CUIWnd_1.h"
#include "afxdialogex.h"
#include "extern_all.h"// CUIWnd_1 对话框IMPLEMENT_DYNAMIC(CUIWnd_1, CDialogEx)CUIWnd_1::CUIWnd_1(CWnd* pParent /*=nullptr*/): CDialogEx(IDD_PAGE_1, pParent)
{}CUIWnd_1::~CUIWnd_1()
{
}void CUIWnd_1::DoDataExchange(CDataExchange* pDX)
{CDialogEx::DoDataExchange(pDX);DDX_Control(pDX, IDC_LIST1, lstPack);
}BEGIN_MESSAGE_MAP(CUIWnd_1, CDialogEx)ON_BN_CLICKED(IDC_BUTTON1, &CUIWnd_1::OnBnClickedButton1)
END_MESSAGE_MAP()// CUIWnd_1 消息处理程序void CUIWnd_1::OnBnClickedButton1()
{// int count = _pgamebase->SRO_Control->GetPPack()->GetPackBack()->PackCount();CString tmp;// tmp.Format(L"%d", count);// AfxMessageBox(tmp);PBackPack _PackBack = _pgamebase->SRO_Control->GetPPack()->GetPackBack();lstPack.ResetContent();for (int i = 0; i < _PackBack->PackCount(); i++){PITEM item = _PackBack->GetItem(i);if ((item != NULL) && (item->Type)) {tmp.Format(L"[%s][数量:%d][耐久:%d/%d]\n", item->GetName()->wcstr(), item->Count, item->Durabillty, item->MaxDurabillty);lstPack.AddString(tmp);}}}