|
Since you're using MFC, you can associate a variable to the control.
Right click on the control in the dialog editor and select Add Variable .
Associate a CString variable with the edit boxes.
You do not need a variable for the button.
For your output text you can use a multi-line edit box.
For this you right click on the edit box and select properties.
Set the Multiline property to true .
Associate a CString variable with this edit box.
For automatic numbering keep a counter of type DWORD that you can increment.
In the button click handler to the following.
UpdateData();
outputCString.AppendFormat(_T("%u: %s\r\n", ++counter, inputCString);
inputCString = _T("");
UpdateData(FALSE);
|
|
|
|
|
Thank you for your help.
regarding the multiline its work when the output text its longer than one line,isn't it? thats what I noticed when I implemented it and I used the list control with no sorting property and work fine and the other works fine thank you very much again.
Regards,
|
|
|
|
|
moh.hijjawi wrote: ...I need after entering to delete the entered text or remove it (clear the input box)
Assuming you are using a CEdit control variable:
m_edit.SetWindowText("");
moh.hijjawi wrote: And when I used the List control for the output box its works like list function there is an ordering happened for output texts.
Sounds like its sorting.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
thank you for your help.
its works fine
|
|
|
|
|
You Can Use : GetDlgItem(Write Here "ID" For That Control You Want To Change Text )->SetWindowsText("");
|
|
|
|
|
abo_alise wrote: You Can Use : GetDlgItem...
I know that you can, but the issue is that you shouldn't.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
|
See here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Can someone give me a link to implementing various control within a dialog dynamically. I need at times to replace existing controls in a dialog, with different controls depending on User selections.
A C++ programming language novice, but striving to learn
|
|
|
|
|
CreateWindow [^] function is the key to your success.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
You can either place all the controls that you will ever be using in the dialog template and hide/show them as required or use the CreateWindow[^] API with the predefined class names as described in the remarks section.
|
|
|
|
|
I understand what you are saying, I think. Ex. one useage requires a large listbox while another selection would require a large editbox. You are saying that while the dialog is displayed? I can change what is presented? Or must I close the dialog after the User made a selection and then reload it with the proper controls in place according to the User's previous selections?
A C++ programming language novice, but striving to learn
|
|
|
|
|
Yes, you can change what is displayed on the dialog without closing and reopening.
For example -
The following will hide the list box and show the edit box.
GetDlgItem(IDC_LIST1)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_EDIT1)->ShowWindow(SW_SHOW);
|
|
|
|
|
Thank you so much for your help. This really sovles my situation.
A C++ programming language novice, but striving to learn
|
|
|
|
|
I find the best way to handle this is to create all of the controls you'll need and then just enable/disable them at runtime.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Thanks again for the information.
A C++ programming language novice, but striving to learn
|
|
|
|
|
how can I use the code of c++ in a function (like checksum) as a string in the same project ?
in another way :
I want to apply a function on the cpp file as a text one to calculate its text value
|
|
|
|
|
your question is not clear.
I'm not even certain _you_ understand what you wan to achieve ?
- you want to copy/paste the code from one function to another one ?
- you want to have a textual representation of a function and call it ? (ie. a bit like an interpreter does ?)
- apply what ? to what ?
- you want to have a text representation of the output of a function like "checksum"? (ie. print the result?)
- ...
This signature was proudly tested on animals.
|
|
|
|
|
when I try to "restart system" or "turn off system" , I get error message "Socket Notification Sink" Dialog box.
And it didn't work reboot or turn off..
How can I avoid "Socket Notification Sink" error?
My main brief code as followings.
<br />
<br />
<br />
UINT _ThreadDoSomethingInfinite(LPVOID pParam)<br />
{<br />
<br />
char buf[100];<br />
CSocket h_sock;<br />
CMyDlg *p=(CMyDlg*)pParam;<br />
h_sock.Create( nPort , SOCK_DGRAM);<br />
while(1)<br />
{<br />
<br />
Sleep(5000); <br />
. <br />
.<br />
stcpy(buf, "some data..buffering..");<br />
<br />
h_sock.SendTo( buf , 1234 , "127.0.0.1" ); <br />
}<br />
<br />
h_sock.ShutDown(2);<br />
h_sock.Close();<br />
}<br />
<br />
<br />
CWinThread g_updsock;<br />
BOOL CMyDlg::OnInitDialog()<br />
<br />
g_updsock=AfxBeginThread(_ThreadSendAgentStatus,this,THREAD_PRIORITY_NORMAL);<br />
if(g_updsock==NULL) return;<br />
<br />
}<br />
<br />
|
|
|
|
|
Hi, I suggest to exit the endless loop when the application is signaled to terminate or an error occured. Add basic error handling to the socket methods, e.g. Create and SendTo return a status. Alternatively use a different socket class than MFC's CSocket or use plain sockets (Winsock).
/M
|
|
|
|
|
Can anyone help me how to convert a DAT file to a BMP file?I have created a DAT file.Now while converting it to a BMP file, how can i insert the bmp header?
|
|
|
|
|
What is in that DAT file? I presume it is an image, do you know the width, height and color depth?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Yes.There is an image.
Actually i have converted a bmp image to a dat file(i have taken a 2D matrix,represented the foreground pixels with "1" and the background pixels with "0") for various operations like thinning,segmentation etc.Now i want to convert my modified dat file to bmp file.i know the width and height of 2d matrix.
how can i insert the bmp header at the beginning of the dat file?
|
|
|
|
|
Well, i guess if you know the BMP format[^], all you have to do is fill out a BITMAPFILEHEADER[^] structure, then fill out a BITMAPINFO[^] and then write them to a file in the following order: BITMAPFILEHEADER, BITMAPINFOHEADER, DAT(a). Does this help?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
hi,
i got a hash value which i wanna convert to 8 digit numbers.
for e.g hash values:
string hash = "df310c24eb35eee2af4f83bed8bee284";
i wanna convert this hash value into 8 digit numbers. how can i do so??
tks in adv
|
|
|
|