|
Parthi_appu wrote: so u accept that i was not ask to delete the CString object..
How would I know whether or not you were asked to delete a CString object? I'm not a mind reader.
Parthi_appu wrote: surely CString will give problem while it was used in global thread methods...
CString does not advertise as being thread safe. To use it under that presumption is just asking for trouble.
Parthi_appu wrote: MSDN suggest to use ReleaseBuffer() after the use of GetBuffer(), i faced some memory problem when i tried to release the buffer..
Something else was surely awry (e.g., some other method used before ReleaseBuffer() was called).
Parthi_appu wrote: and don't reply that i have to use the methods properly..
Why would you think it is ok to use the class improperly?
Parthi_appu wrote: ...the problem is intermitent...
That alone should throw up all sorts of red flags.
"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,
i was in vacation...so i didn't reply to ur post..
You mentioned that CString selling point is, it doesn't need new or delete..
and still some folks are insisting to use delete....
for this post only i replied... you didn't see the previous post that has char*... ok lets leave that...
and i didn't know CString will give problems while using thread context... i have no memory of reading this in MSDN... so if you have any link related to this, please suggest me..
Do your Duty and Don't expect the Result
|
|
|
|
|
i need to run unzip command.
If there is any parameter for unzip, so that the specified folder( which doesnot existing ) for extracting the zip file is created while running the command???
Dream bigger... Do bigger...Expect smaller
aji
|
|
|
|
|
Hi,
Any body knows some thing about unzip command????????
Dream bigger... Do bigger...Expect smaller
aji
|
|
|
|
|
|
Hi,
I am trying to implement global hooks(as a DLL) to capture the Mouse and Windows related events happening on the desktop. I created a window and then set global hooks with the help of the following
SetWindowsHookEx( WH_CALLWNDPROC, (HOOKPROC) CallWndProc, hInst, 0);
SetWindowsHookEx( WH_GETMESSAGE, (HOOKPROC) GetMessageProc, hInst, 0);
I could Only get the Events associated with the window i created, but not the events associated with other Windows on the Desktop.
Am i missing something?
Please help me in fixing this.
Thanks,
Vissu.
|
|
|
|
|
Vissu89 wrote: SetWindowsHookEx( WH_CALLWNDPROC, (HOOKPROC) CallWndProc, hInst, 0);
can u show me how u took the hInst in the above call?
nave
|
|
|
|
|
The hInstance HANDLE from DLLMAIN is stored in hinst, which is used in setting system hook
BOOL WINAPI DllMain (HANDLE hInstance, ULONG ul_reason_for_call, LPVOID lpReserved)
{
// Save the instance handle
hInst = (HINSTANCE)hInstance;
}
Thanks,
Vissu
|
|
|
|
|
hi all,
I would like to set the width of an edit box according to the no of char allowed chars.
means-> user can only enter 5 char in the edit box. So i would like to set the width of an edit box which exactly holds 5 chars(no blank space).
So how can i draw edit box which holds exactly a specified no of chars?
can anyone help in this probs?
Thanks in advance.
Regards,
Ram
|
|
|
|
|
Try
BOOL MoveWindow( int x, int y, int nWidth, int nHeight, BOOL bRepaint = TRUE )
Dream bigger... Do bigger...Expect smaller
aji
|
|
|
|
|
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.
|
|
|
|