Closed gzhwl closed 3 years ago
Hi, you are using a local stack variable std::string str =
to set the data, no wonder it doesn't work. It destroys as soon as it goes out of the declaration scope.
You must either make it static
or declare it as a class member (or global).
Thanks, I changed it to 'static' declare, It works !
Hello, I'm a Chinese developer, I use HexCtrl in my MFC App, using it with 'Building From The Sources' type,create window with these code:
RECT rcClient = { 0 }; ::GetClientRect(GetSafeHwnd(), &rcClient); HEXCREATESTRUCT hcs; hcs.enCreateMode = EHexCreateMode::CREATE_CHILD; hcs.hwndParent = m_hWnd; hcs.rect = rcClient; if (m_HexCtrl->Create(hcs)) { // Set China locale m_HexCtrl->SetEncoding(936); // Init string whith Chinese Char std::string str = "0123456789,零一二三四五六七八九十,零壹贰叁肆伍陆柒捌玖拾"; HEXDATASTRUCT hds; hds.pData = (std::byte*)str.data(); hds.ullDataSize = str.size();
}
these code compiled ok, But after I run the App and click the data shown in the HEX View wnd, The data Changed random,is it a bug?