|
You can use SetWindowPos(..),
if the editbox can have random string lengths then you have to calculate the size depending on the text selected.
if its going to be constant length then decide the size in design time itself.
An edit box can have more value than its width, if you want to restrict the string length to some constant value then setting the width won't work out
Do your Duty and Don't expect the Result
|
|
|
|
|
Ram Murali wrote: So i would like to set the width of an edit box which exactly holds 5
to calculate the rectangle required for a string to fit,use DrawText funtion with the DT_CALCRECT flag. this function will return the rectangle required by the string(Before calling this funtion don't forget to select the current edit box font to the DC). After u got the rectangle call the MoveWindow function to size the edit box.
nave
|
|
|
|
|
Hi,
I am working with edit boxes.I have declared a member variable for it with data type as "CString" .Is there any event which rises at the time when the edit box looses the focuses(for eg stating that the range is not between 100 and -100) or alternatively
I need some means to set the range for that edit box for which I have declared a variable of type "CString" . I will enter only numbers and not character type data.I will convert the entered data into integers later on.For the entered data I need to find whether it is in the range or not.
Thanks in advance
Taruni
|
|
|
|
|
|
I thing it is better to add control variable for Edit box
Instead of using CString as datatype, use CEdit.
Dream bigger... Do bigger...Expect smaller
aji
|
|
|
|
|
You can set Min value and Max value for your control(editbox)
whitesky
|
|
|
|
|
Taruni wrote: I will enter only numbers and not character type data.
Then why CString?
|
|
|
|
|
For that i think he need to add Control variable for the edit box instead of CString
Dream bigger... Do bigger...Expect smaller
aji
|
|
|
|
|
The EN_CHANGE notification message is sent when the user has taken an action that may have altered text in an edit control.
Then you override the EN_CHANGE Event and write this code
// where m_editbox is a variable associated to the edit window
char *myValue=new char[m_editbox.GetWindowTextLength ()];
m_editbox.GetWindowText(myValue,strlen(myValue));
int i=0;
i=atoi(myValue);
if(i>=100 || i<=-100)
{
AfxMessageBox("Invalid value:");
}
I hope that I understood your query correctly
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Taruni wrote: I have declared a member variable for it with data type as "CString"
You should be using CEdit instead. Otherwise, you'll be (incorrectly) using UpdateData() . See here for how/why that method can be avoided.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi together,
I'd like to determine the number of cores a CPU has using a C++ program. I found a solution at http://www.intel.com on how to do it for Intel CPUs. But I didn't find out how to do it for AMD CPUs (i.e., Athlon X2). Moreover, the Intel solution states that it might give wrong results for CPUs with a certain stepping if it's not compiled on that CPU type
Therefore I'd like to ask if anybody has a robust solution for counting the cores of Intel and AMD CPUs. Thank you for any ideas in advance!
Regards,
Marcus.
|
|
|
|
|
Use the Win32_Processor class.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi David,
thank you for the hint. I managed to access the Win32_Processor members. However, the members NumberOfCores and NumberOfLogicalProcessors are not valid. To get them MSDN suggests to use Win32_ComputerSystemProcessor . This class contains a reference to Win32_Processor which should contain the data I'm looking for.
Now my question: How do I follow the reference from Win32_ComputerSystemProcessor to Win32_Processor in C++? In the first run I used ExecQuery() to select Win32_Processor and accessed its data using Next() and Get() . Now I guess I have to use ExecQuery() to select Win32_ComputerSystemProcessor , but how do I continue?
Thank you for any help you can give!
Regards,
Marcus.
|
|
|
|
|
khb wrote: I managed to access the Win32_Processor members. However, the members NumberOfCores and NumberOfLogicalProcessors are not valid. To get them MSDN suggests to use Win32_ComputerSystemProcessor. This class contains a reference to Win32_Processor which should contain the data I'm looking for.
This makes no sense. If the members of Win32_Processor are not valid, why would you then state that they should contain the data you're looking for?
khb wrote: However, the members NumberOfCores and NumberOfLogicalProcessors are not valid.
How are you verifying this?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: This makes no sense. If the members of Win32_Processor are not valid, why would you then state that they should contain the data you're looking for?
Maybe I understood wrong what MSDN says. I just read: "To determine the total number of processor instances associated with a computer system object, use the Win32_ComputerSystemProcessor association class."
DavidCrow wrote: How are you verifying this?
Maybe I'm doing something wrong. I compiled the code with VC6 on my single core P4 with HT enabled (Win XP). I also run the program on a dual core Pentium D with HT enabled (also Win XP). In both cases NumberOfCores was not found and NumberOfLogicalProcessors was 0. I guess that the code works, as I can retrieve other members like, e.g., Name correctly. However, I can post the code if you like.
Regards,
Marcus.
|
|
|
|
|
|
DavidCrow wrote: These were added for Vista.
Whoops, I somehow missed that Well, this brings me right back to my initial question: Is there any chance to get the processor specs on non-Vista systems?
Regards,
Marcus.
|
|
|
|
|
khb wrote: Is there any chance to get the processor specs on non-Vista systems?
Yes, I've done it with both Win32_ComputerSystem and Win32_Processor .
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Now I'm getting confused
I just tried Win32_ComputerSystem . For example, I can get NumberOfProcessors correctly. But I can't get NumberOfLogicalProcessors , it's not in the query result. But this is alright according to MSDN which says about NumberOfLogicalProcessors :
Windows Server 2003, Windows XP, Windows 2000, Windows NT 4.0, and Windows Me/98/95: This property is not available.
Then I tried Win32_Processor . For example, I can get Name correctly. But I get neither NumberOfLogicalProcessors nor NumberOfCores , they're both not in the query result. But again this is alright, because MSDN states for both properties what I already cited above.
Or did I get something completely wrong?
Thank you for your patience, David!
Regards,
Marcus.
|
|
|
|
|
|
Hi Mike,
thanks for your answer. Currently I'm using the code from the article Counting Physical and Logical Processors here on CP. It makes also use of the functions you mentioned. I split up the code on did some tests on the following 2 PCs (I was wrong before: Pentium D has no HT):
1) Pentium 4, 3.06GHz, Single core, HT
2) Pentium D 950, 3.40GHz, Dual core, No HT I'd like to calculate the following values:
1) # CPUs: 1, #Cores: 1, #Log. CPUs per Core: 2
2) # CPUs: 1, #Cores: 2, #Log. CPUs per Core: 1 Now the problem: The functions you mentioned return the following values for both(!) CPUs:
GetSystemInfo.dwNumberOfProcessors: 2
cpuid HTT bit: Set
cpuid # logical CPUs per physical CPU: 2 This shows that it's not possible to distinguish between HT and dual core
Regards,
Marcus.
|
|
|
|
|
Hi all,
I am doing a project in VC++. In that I am loading html pages
dynamically using CHtmlView Class. And I need to catch all the events happening in the html page NOT IN the web browser control.
Is it possible or Not
Please help me.
Thanks in advance
George K Jolly
-- modified at 5:36 Monday 17th July, 2006
|
|
|
|
|
|
Hi,
I studied in my project tutorial that each OPC server is identified by a unique clsid.To get this clsid,run GUIDGen.exe and get the clsid.
I do the same...i got different type of clsid.
As iam new to coding..I dont know..
why they use clsid in the coding?
Whats the use of this clsid?
What is GUID?
Is there any tutorial to study about this?
Help me
|
|
|
|
|
A CLSID is a globally unique identifier that identifies a COM class object. If your server or container allows linking to its embedded objects, you need to register a CLSID for each supported class of objects.
See More From MSDN[^]
There are some articles for a beginner in COM at CP itself
See Micheal Dunn's article Introduction to COM[^]
He has also written some other articles regarding COM and WTL.
Search in CP
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
My Blog | Understanding State Patte
|
|
|
|