|
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
|
|
|
|
|
This string contains 32 hexadecimal digits. So may represent 16 bytes, as well 8 shorts, as well 4 int.
If you need to convert it into an array of bytes (unsigned char) try something similar to:
#include <stdio.h>
void main()
{
char hash[] = "df310c24eb35eee2af4f83bed8bee284";
char * p = hash;
const unsigned int SIZE = (sizeof(hash)-1)/2;
unsigned char arr[SIZE];
unsigned int count=0;
while (count < SIZE)
{
if (sscanf(p, "%2x", &arr[count]) != 1)
{
}
count++;
p+=2;
}
}
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]
|
|
|
|
|
hi everyone who reads this,
i am in a digital electronics class and i decided to write a program that converts decimals to binary, i thought this was going to be simple and it was till i realized my my loop cout'ed the binary in reverse order. 731 in dec = 1011011011 and my program did it in reverse 1101101101 i used int's with modulus and division operators:
while (num)
{
rem=num%2;
num = num/2;
cout << rem;
}
so i was wondering is there a simple way to reverse the output or could the division be done in reverse so the last output is first and the first last in my program? please note i am a beginner at c++ so i don't know how to do arrays as of yet and i am sure the output could be loaded into an array and printed in reverse order.
thank you in advanced for any help.
|
|
|
|
|
You should go in the opposite way, using multiplication (or bit shif, that is faster):
#include <iostream>
using namespace std;
void main()
{
unsigned int k = 731;
unsigned int b;
const int SIZE = sizeof(k) << 3;
const unsigned int MSB = 1 << (SIZE-1);
for (b=0; b<SIZE; b++)
{
cout << (( MSB & k) ? 1 : 0);
k <<= 1;
}
cout << endl;
}
Or
#include <iostream>
using namespace std;
void main()
{
unsigned int k = 731;
unsigned int b;
const int SIZE = sizeof(k) << 3;
const unsigned int MSB = 1 << (SIZE-1);
bool isLeadZero= true;
for (b=0; b<SIZE; b++)
{
if ( MSB & k)
{
isLeadZero = false;
cout << 1;
}
else
{
if ( ! isLeadZero) cout << 0;
}
k <<= 1;
}
cout << endl;
}
If you need to remove heading zeroes.
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]
|
|
|
|