|
Do not interact with UI controls from any place other than the owning window (the modeless dialog in this case). If you need the modeless dialog to update its controls, send it a message.
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Ok, finally, I got my answer.
I solved of this way:
I made a public variable of my dialog class, where is the edit control, in the class view, and I made the windows in the builder. After, when I press a button, I did :
void Cprueba4View::OnButton3()
{
CString cadena;
dlgDesc->GetDlgItemText(IDC_EDIT1, cadena);
cadena += "Hello other time ";
dlgDesc->SetDlgItemText(IDC_EDIT1, cadena);
dlgDesc->SetFocus();
}
But now, I have another problem. When I maximize the windows dialog, only it's maximized the windows and not the edit control. why? how can I maximize the windows and the edit control at the same time?
I used
dlgDesc->ShowWindow(SW_MAXIMIZE);
to maximized
|
|
|
|
|
antonio343 wrote: how can I maximize the windows and the edit control at the same time?
Why can't you use SetWindowPos() on the edit control? It's a window too.
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
I tried this, but it can't run.
I did this:
BOOL CEjemplo::OnInitDialog()
{
CDialogEx::OnInitDialog();
m_Edit.SetMargins(10,10);
m_Edit.ShowWindow(SW_MAXIMIZE);
return TRUE;
}
is it right? If not.. how I use showWindow()?
|
|
|
|
|
antonio343 wrote: I tried this, but it can't run.
Which means what?
antonio343 wrote: m_Edit.SetMargins(10,10);
Are you thinking that setting a control's margins will also affect it's physical dimensions?
antonio343 wrote: m_Edit.ShowWindow(SW_MAXIMIZE);
Unless the control's width and height have been changed (see SetWindowPos() ), it is already maximized.
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
m_Edit.SetMargins(10,10); is so that the text don't appear next to the border.
Ok, I will try with SetWindowPos.
I will tell you my progress
modified 3-Oct-11 18:20pm.
|
|
|
|
|
I dont know how to use this function. Please, teach me.
|
|
|
|
|
How to count positive values WHILE doing HeapSort? Here is my HeapSort and I count them in a loop at the end of the method, but it needs to be done while sorting. How's that?
void Sift(int arr[], int left, int right)
{
int i, j, x;
i = left;
j = 2 * i + 1;
x = arr[i];
while (j <= right)
{
if(j < right)
if(arr[j] < arr[j + 1]) j++;
if (x >= arr[j]) break;
arr[i] = arr[j];
i = j;
j = 2 * i + 1;
}
arr[i] = x;
}
void HeapSort(int arr[], int n)
{
int left, right, temp;
left = n / 2 + 1;
right = n - 1;
while (0 < left)
{
left--;
Sift(arr, left, right);
}
while (0 < right)
{
temp = arr[left];
arr[left] = arr[right];
arr[right] = temp;
right--;
Sift(arr, left, right);
}
for(int i = 0; i < n; i++)
if(0 < arr[i]) PosCount++;
}
|
|
|
|
|
This question was already posted in Q&A[^]; please post in one location only.
0100000101101110011001000111001011101001
|
|
|
|
|
|
Have you tried placing the counting code within either of those other loops to see if it counts what you expect? At first glance, I'd try:
while (0 < right)
{
temp = arr[left];
arr[left] = arr[right];
arr[right] = temp;
if (0 < arr[right])
PosCount++;
right--;
Sift(arr, left, right);
}
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
modified 13-Oct-11 9:39am.
|
|
|
|
|
Yes, the problem is that I don't understand the HeapSort good enough to reshape it whatever I want. That's why i need help..
|
|
|
|
|
Code aside, what part of the heap sort do you need help with: building the heap, or adding to the sorted array? I would forgo coding until I could do it all on paper first.
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hi,
I am using WMI services to get Disk Information. But for a SD Card I am not getting correct physical size. It comes under logical e:\ drive in My Computer, for that (e:\) I am getting correct size but not for physical .
Please suggest.
|
|
|
|
|
Please give a bit more details. How are you querying the size? Show some code (don't forget the <pre>/</pre> tags) if possible. Tell us what you expect to get and what you do get.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
|
Hello people I have the following the code written in C++, converted from Vb.net to C++ from a program, the following code tells the user via message box if the program is running as an admin, see below
Object ^identity = WindowsIdentity::GetCurrent();
WindowsPrincipal ^principal = gcnew WindowsPrincipal(identity);
bool isElevated = principal->IsInRole(WindowsBuiltInRole::Administrator);
try
{
if (isElevated == true)
{
}
else
{
MessageBox::Show("WARNING: Program not running as administrator!", "Credential Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
}
}
catch (Exception ^ex)
{
MessageBox::Show("This program cannot run as performed because your system does not support admin rights, program now terminating from computer memory.", ".Net Framework Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
Environment::Exit(1);
}
When this block of code was executed with my program, I get the following error message (In double quotations):
"error C2664: 'System::Security::Principal::WindowsPrincipal::WindowsPrincipal(System::Security::Principal::WindowsIdentity ^)' : cannot convert parameter 1 from 'System::Object ^' to 'System::Security::Principal::WindowsIdentity ^'"
the remaining error messages are (In double quotations):
"1> No user-defined-conversion operator available, or
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast"
Could anyone point out something that I could edit that could make the compiler accept or work, any suggestions or personal solutions are appreciated .
|
|
|
|
|
|
|
Hi all,
I have an google imagery. And i want to implement a datum and projection for it.
how should i proceed?
Can any body please suggest something...
|
|
|
|
|
|
Hi, dear all,
Maybe my title make you confused, but I really don't know how to express it.
The project was created by other people before, inside the project there is a server called XXXX which inherite from COleServerDoc class. There are two containers that invoke the methods in the sever. Everything works fine.
Until now, before it only handle 4 types of materials, now it needs to handle 8 types of mateials, so I need to modify the server, otherwise it will cause array overflow. I modify the server and compile it, but when I run the container program, I still get the material overflow error, it totally didn't use the latest server I just compiled.
I check the container project and find it invode the server use the code: CreateDispatch(_T("XXXX.Document")), then I got to the Registry editor and find it was registered there before. So even I modify the server and recompile it, but the registered XXXX .Document is not updated, what should I do? how can I make the container project call my latest server?
Thank you very much!
|
|
|
|
|
Hello friends
I am writing in a Binary File Using FILE object.
And the structure that I am using while Writing is :
class A
{
int a;
int b;
};
While Reading Mine structure is :
class B
{
string name;
int a;
int b;
}
I am using fread like this way:
B* obj = new B();
fread(obj,sizeof(B)-sizeof(string),1,stream);
but not working,I m assuming that memory pointer obj is pointing at string name,so thats why i want to move obj pointer to int a,so it will read value of int a.
If ,i am wrong,please sugget me some other way. But there is restriction that i can change struture.
Thanks In Advance.
Regards
Yogesh
|
|
|
|
|
try
&obj->a
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
Try ofstream[^] for serializing the objects in C++ way. Here[^] is an example.
Check this[^] site if you are interested to learn how to serialize in MFC.
|
|
|
|