L
Lukeparker34
Guest
I have an application that reads a CString and then copies it to the clipboard. However the CString in question is not quite the correct information I need to copy. I need the first 3 characters of that string ("LEO") to be replaced with "SmartSEM".
is there any way I can do this?
Below is my code.
void CBugsDlg::OnBnClickedBtnSem()
{
CLeo32DB* DB = CLeo32DB::CreateMe();
TCHAR serial[60];
DB->DBGetSystemKeyString((LPTSTR)_T("SerialNumber"),(LPTSTR) _T(""), serial, 60);
CLeo32DB:estroyMe(DB);
CString SEMSerial(serial);
CVersionTranslatomatic ver:GetDesktopWindow());
CString version = ver.GetMajorMinorVersionString() + " " + ver.GetVersionType() + " " + ver.GetBuildNumber() + " " + ver.GetServicePack();
CString Data = SEMSerial + " " + version;
HGLOBAL hglbCopy;
if( OpenClipboard())
{
wchar_t *wcBuffer = 0;
hglbCopy = GlobalAlloc(GMEM_MOVEABLE,(Data.GetLength() + 1)*sizeof(wchar_t));
wcBuffer = (wchar_t*)GlobalLock(hglbCopy);
lstrcpy(wcBuffer, Data);
GlobalUnlock(hglbCopy);
EmptyClipboard();
SetClipboardData(CF_UNICODETEXT, hglbCopy);
CloseClipboard();
}
}
Continue reading...
is there any way I can do this?
Below is my code.
void CBugsDlg::OnBnClickedBtnSem()
{
CLeo32DB* DB = CLeo32DB::CreateMe();
TCHAR serial[60];
DB->DBGetSystemKeyString((LPTSTR)_T("SerialNumber"),(LPTSTR) _T(""), serial, 60);
CLeo32DB:estroyMe(DB);
CString SEMSerial(serial);
CVersionTranslatomatic ver:GetDesktopWindow());
CString version = ver.GetMajorMinorVersionString() + " " + ver.GetVersionType() + " " + ver.GetBuildNumber() + " " + ver.GetServicePack();
CString Data = SEMSerial + " " + version;
HGLOBAL hglbCopy;
if( OpenClipboard())
{
wchar_t *wcBuffer = 0;
hglbCopy = GlobalAlloc(GMEM_MOVEABLE,(Data.GetLength() + 1)*sizeof(wchar_t));
wcBuffer = (wchar_t*)GlobalLock(hglbCopy);
lstrcpy(wcBuffer, Data);
GlobalUnlock(hglbCopy);
EmptyClipboard();
SetClipboardData(CF_UNICODETEXT, hglbCopy);
CloseClipboard();
}
}
Continue reading...