|
You can try EM_REPLACESEL message.
CString cs;
GetDlgItemText(IDC_EDIT1, cs);
SendDlgItemMessage(IDC_EDIT1, EM_SETSEL, cs.GetLength(), cs.GetLength());
SendDlgItemMessage(IDC_EDIT1, EM_REPLACESEL, 0, (LPARAM)_T("Some String"));
modified on Wednesday, December 23, 2009 5:34 AM
|
|
|
|
|
Good suggestion.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Thank you!
|
|
|
|
|
OK you modified that post. While I thought the EM_REPLACESEL itself was a great idea, I wouldn't have liked the usage of GetDlgItem() call. But hey, different people, different ways. (why I don't like GetDlgItem() ? Because I'm a terrific fan of Dr. Joseph Newcomer, and his philosophies and I take 'em seriously).
Added: Look at my second answer to the OP.
“Follow your bliss.” – Joseph Campbell
modified on Wednesday, December 23, 2009 5:48 AM
|
|
|
|
|
Me too don't like to use GetDlgItem(). It is always better and clean to use binded members with DDX/DDV. I thought I would provide an answer which resembles the sample code segment in the post . Thanks for the comment.
|
|
|
|
|
Rejeesh.T.S wrote: Me too don't like to use GetDlgItem(). It is always better and clean to use binded members with DDX/DDV.
You do realize, of course, that DDX_ macros internally call GetDlgItem? Newcomer's screed on the subject overlooks that fact. It really comes down to personal preference in coding style; one way is no more evil than another. Personally I try to avoid MFC-specific API's where possible - it makes porting code between frameworks a little less painful.
L u n a t i c F r i n g e
|
|
|
|
|
Use a control type member variable for the edit control. Then do something like
m_Edit.GetWindowText(szTemp );
szTemp += _T("Whatever");
m_Edit.SetWindowText(szTemp);
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Hi,
You might want to try this (thanks to Rejeesh for his EM_REPLACESEL suggestion, which triggered this idea)
int len = m_Edit.GetWindowTextLength();
m_Edit.SetSel(len, len, 0);
m_Edit.ReplaceSel(szNewText);
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
This is the MFC way. Now the code looks cleaner
|
|
|
|
|
Sorry for deleyed reply...
Thanks for Both of you...
the problem has been solved...
G.Paulraj
|
|
|
|
|
After converting my project from VC6.0 to VS2008.Im getting continouly error.I dont have error in building the exe.
When im running this exe i got lot of errors.Mostly on System.AccessViolation,System.NullRefernceException like this.Now i get
An unhandled exception of type 'System.NullReferenceException' occurred in InstructorStation.exe
Additional information: Object reference not set to an instance of an object.
error in this fucntion.
void CMainFrame::UpdateOprs(CTrans *pData)
{
IsNewOpr = TRUE;
WriteDebug("UpdateOprs() - Begin");
.
.
}
THis function get called as follow
CTrans tData;
CMainFrame* tFrm = (CMainFrame*)AfxGetMainWnd();
for(i=0;i<LiveDataCount.Count;i++)
tData.m_sData.Insert(i,LiveArray[i]);
tFrm->UpdateOprs(&tData);
Whats the problem in converting?I thought converting project should be simple likethat.I don't know whether i did any wrong?
Pls guide me on this issue.
Anu
|
|
|
|
|
CMainFrame* tFrm,
what is the value of tFrm?
Did u check whether it is 0 or not?
Please check
if( 0 != frm )
Величие не Бога может быть недооценена.
|
|
|
|
|
While debugging,when i keep mouse on tFrm,it shows as undefined value.
Anu
|
|
|
|
|
Please change your optimization in project settings to see the value of the variable.
Величие не Бога может быть недооценена.
|
|
|
|
|
Sorry,what can i change?
properties->configuratio properties->c/c++->optimization->optimization: Custom
Shall i change to Fulloptimization(/Ox)
Anu
|
|
|
|
|
Now i use tFrm as follow
CMainFrame* tFrm;
tFrm = new CMainFrame();
now that problem is not coming.
Anu
|
|
|
|
|
Hi. I need a program solving the running time of depth first search algorithm..I'm trying to solve it but its hard for me to come up with the solution.
Is it possible to integrate the backtracking in breadth first search algorithm?
If so, can you give me any program for this with computation of its running time ??
I really appreciate any response to this..
Thnx..
|
|
|
|
|
Dear friend, this forum is to help to solve your technical problem, no one is here to spoon feed you.
So don't ask for the whole program again in this forum.
And please read the the instruction, how to ask questions [^]
Please check with this link, it will help you related to DFS [^]
Величие не Бога может быть недооценена.
modified on Wednesday, December 23, 2009 4:19 AM
|
|
|
|
|
The running time of the depth first search algorithm is O(n) where n is the number of nodes in your graph.
Breadth-first search avoids backtracking, and also has a running time of O(n).
You can find programs for both of these algorithms through Google.
|
|
|
|
|
my questions:
how to implement draging for the system icons,just like My Computer,My Document and etc, into other directories in my own design app.as i know,exploer just create a icon-link for the operations,how can i emulate this operation, thank you very much.
your little brother
|
|
|
|
|
Do u want to get drag and drop of files into your application?
Величие не Бога может быть недооценена.
|
|
|
|
|
i want to create a shortcut for my computer in my own application
|
|
|
|
|
|
|
Hi There.
My problem is:
I am able to send messages to the queue using my machines name, but am unable to do the same with IP Add.
For example:
qInfo->PathName = "MYCOMPUTER\\private$\\PanBQueue"; works fine...
qInfo->PathName = "IP ADDRESS\\private$\\PanBQueue"; Fails...
Thanks
PanB
|
|
|
|