Cold_Fearing_Bird wrote:
char origin[] = "追求追求";
You are trying to set a unicode/wide string to ANSI buffer.
Cold_Fearing_Bird wrote:
char origin[] = "追求追求";
You are trying to set a unicode/wide string to ANSI buffer.
+5 for the answer!
Keep a public CString member variable in Child dialog class, set the member variable before calling the DoModal() or Create function of child dialog. Call SetWindowText of edit control in InitDialog. for. eg If CMainDlg is your Main dialog class and CChildDialog be the child. in header of CChildDialog you declare a public member variable to hold the string
class CChildDialog : public CDialog
{
public :
CString m_strText;
}
and in your button click function of CMainDlg do this
void CMainDlg::OnClick_Button()
{
CChildDialog oChildDlg;
oChildDlg.m_strText = strText; // This should be the edit box value
oChildDlg.DoModal();
}
Set the variable value in CChildDialog's OnInitDialog as
CChildDialog::OnInitDialog()
{
SetDlgItemText(ID_OF_YOUR_EDIT, m_strText);
}
You can also set the text by modifying your constructor of CChildDialog, such as
CChildDialog::CChildDialog(CString strText)
antonio343 wrote:
, I get a error that it said:
You dont have acces to this file.
Open the file using
CFile::modeReadWrite OR CFile::modeWrite
it seems you don't have permission to write.
@Albert,thanks!
pandit84 wrote:
Is there any API which gives me list of Seial Ports available on system.
SerialPort.GetPortNames Method[^] is available as a.Net library method. You could also try Another serial port enumerator[^] which uses a different approach to find serial ports by enumerating registry keys. -OR- Enumerating serial ports - W2K style [^]- Enumerating the serial ports using the SetupDi* API provided with Win2K and later
pandit84 wrote:
QueryDosDevice () but its failed to provide any result .
I have also found this support page [^] on why QueryDosDevice fails.
Validate the pointers and HTREEITEM
CTreeCtrl* pTreeCtrl = (CTreeCtrl*)GetDlgItem(pNMHDR->idFrom);
//add this checking
if(!pTreeCtrl)
{
// Some message and return
}
also
HTREEITEM ht = pTreeCtrl->HitTest(point, &uiFlags);
// add this checking
if (ht != NULL)
{
pTreeCtrl->Select(ht, TVGN_CARET);
}
else
{
// Show some error message/return
}
antonio343 wrote:
I need, to show text from other class in the same dialog
How about making the ShowText function as public and pass a CString variable ;
void CEjemplo::ShowText(CString strText)
{
//CString cadena= _T("Hi, it is a example");
m_Edit.SetWindowTextW(strText);
//Add this to invoke DDX updation
UpdateData(FALSE);
}
call the public function of CEjemplo object as,
void CSomeOtherClass::ShowText()
{
CEjemplo oEjemplo;
CSting strText(_T("Some text from other class"));
oEjemplo.ShowText(strText);
}
Or insert a PictureControl and change the "Type" property of PictureControl to "Icon", then assign an ICON resource to "Image" property of PictureControl.
Using managed GZipStream[^] class. For unmanaged apps check CGzip[^] class found in codeproject.
The WINDOWS API replacement of system[^] are ShellExecute[^] / ShellExecuteEx[^] or CreateProcess[^]
The index concept is not applicable for a TreeItem. The HTREEITEM itself is an index identifier for the item. Loop through each items and store the index values and HTREEITEM in a map for future use.
zon_cpp wrote:
user selects 3th item of CTreeCtrl.
If your issue is to get the exact item when the user clicks on a treeitem - I have a suggestion, to use CTreeCtrl's HitTest[^] to get the item from selected point.
How about adding a CString member variable[^] for your CRichEditCtrl and updating the data using UpdateData[^]
Yes - the MiniDumpWriteDump[^] function.
Figure out what are the main difference with 'working' and 'not working' buttons. Is it a sub-classed button or OWNER DRAW true in styles.
You should use CommandLineToArgvW[^] along with GetCommandLine[^] for UNICODE applications.
Check your PUSHBUTTON is not disabled.For a BN_CLICKED message, The parent window is notified through WM_COMMAND with control ID and handler. wParam The LOWORD contains the button's control identifier. The HIWORD specifies the notification code. lParam A handle to the button
/D "_UNICODE" /D "UNICODE"