|
Does anyone know ofa mechansim to get thread timing information. I am trying to get a better understanding of the percentage of CPU utilization in a multi-threaded app, but on a per-thread basis as opposed to a per function basis.
The system APIs provide this info for processes, but I have been unable to get equivalent info for threads.
If someone can elighten me, or suggest a technique, I would appreciate it.
|
|
|
|
|
GetThreadTimes
Don't try it, just do it!
|
|
|
|
|
How to convert "N" to unicode 004E ?
CString n("N");
.
.
.
Output:
004E
Please help me!
|
|
|
|
|
input a unicode string: L"N"
Don't try it, just do it!
|
|
|
|
|
How to convert "N" to unicode 004E ?
|
|
|
|
|
for ANSI characters, the lower byte of its unicode representation is just the same as ASCII, while the higher byte is always 00.
So, since 'N' in ASCII is 0x4E, Unicode 'N' is 0x004E (it might be 0x4E00, depending on big endian or little endian).
|
|
|
|
|
Hi everyone,
I'm trying to get at the mouse position in a list view but am having no luck. I have 1 column which displays a series of small icons (ie within a single subitem of the list) and I need to be able to tell which icon has been clicked. Screen real-estate prevents me from doing this using a separate sub-item for each icon.
I'm picking up the NM_CLICK message but there seems to be no MouseMove message available in a ListView control. I only get them in the view when I use SetCapture() but I don't know how I can do a ReleaseCapture() - is there a way of receiving a message when the mouse leaves the control's borders?
Many thanks in advance.
Simon
|
|
|
|
|
NM_CLICK messages from a ListView are accompanied by an NMLISTVIEW structure. You can cast the NMHDR pointer to this type, e.g.
void CMyClass::OnListViewClick( NMHDR * pNotifyStruct, LRESULT * result )
{
NMLISTVIEW* pnmlv = (NMLISTVIEW*) pNotifyStruct;
} The NMLISTVIEW structure contains a member ptAction which tells you where the user clicked. I can't remember if this is in screen or client co-ordinates; you may need to use ScreenToClient to convert.
From here you can use GetSubItemRect and work out the relative position of the click within the subitem.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Thanks very much Mike, this was exactly what I was looking for.
Simon
|
|
|
|
|
I like to change Edit Focus when I tap "Return" Key.
The problem is that I can't catch VK_RETURN within CEdit::OnKeyDown() event.
|
|
|
|
|
Does the edit control have the ES_WANTRETURN (multiline scope?) style?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Yes the edit control have the ES_WANTRETURN style,
But the probleme is that the dialog is closed when I press "ENTER", et usually I can't catch the VK_RETURN wthin Edit::OnKeyDown().
|
|
|
|
|
amine.turki wrote:
But the probleme is that the dialog is closed when I press "ENTER"...
If the edit control has focus when you press the Enter key, the dialog should not be closing. If it is closing, then either the edit control does not have focus, or it does have focus but it does not have the ES_WANTRETURN style.
See if this discussion helps.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
You could override the PreTrandlateMessage for the controlling window and do this:
if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN)
{
// check to see if we need to tab between edit controls
Cwnd *pWnd = GetFocus();
if (pWnd != NULL)
{
if (pWnd->IsKindOf(RUNTIME_CLASS(CEdit)))
{
// tab instead of return
pMsg->wParam = VK_TAB;
}
}
}
// fall through to normal processing
This will change return key presses into tabs for edit controls only.
Roger Allen - Sonork 100.10016
Strong Sad:
Clever I am? Next to no one.
Undiscovered and soggy.
Look up. Look down. They're around.
Probably laughing. Still, bright, watery.
Listed among the top. Ten.
Nine. Late night. Early morn.
Early mourn. Now I sleep.
|
|
|
|
|
If you're subclassing the edit control, you could try handling WM_GETDLGCODE and returning DLGC_BUTTON . AFAIK, the ES_WANTRETURN style only matters if it's a multi-line edit control.
How do you move in a world of fog, That's always changing things?
Makes me wish that i could be a dog, When i see the price that you pay.
|
|
|
|
|
Hi,
I have a Modal Dialog Box, When i click the minimize bar on the top right corner, It does not go to the task bar, instead it settles at the bottom left corner of the screen, what should I do to make it settle in the taskbar ?
Thanks,
Deepak Samuel.
|
|
|
|
|
are u using MFC or simple win32?
Don't try it, just do it!
|
|
|
|
|
Hi,
I am using MFC.
Thanks,
Deepak Samuel.
|
|
|
|
|
Hi
When you minimized the window, the OnMinimized function is called, you have to review the function or overwrite the actual implementation.
|
|
|
|
|
Visual C++
i think it's a trivial question but i don't know the right syntax:
i have, for example :
int ID1=70;
int age1=55;
String (or CString) Name="Bell";
CString All;
// i want to make All to be:
All=" The ID is " ID1 " and his age is " age1 " and his name is " Name
..
how to make this?
|
|
|
|
|
Check out the CString::Format function:
<br />
all.Format("The ID is %d and the age is %d", ID1, age1);<br />
Remember, even if you win the rat race, you're still a rat.
|
|
|
|
|
well i tell a how to achieve it with char*;
char[200] str="";
int i=20;
double d=10.00;
char* s="test string";
wsprintf(str,"The integer is %d and the double is %f and the character array contains %s",i,d,s);
NOW str WILL contain "The integer is 20 and the double is 10.000000 and the character array contains test string"
Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs
|
|
|
|
|
how to make clear that this struct has to be 2 bytes in size and NOT 3?
typedef struct _TEST
{
USHORT FragmentOffset: 13;
UCHAR MF: 1;
UCHAR DF: 1;
UCHAR Reserved: 1;
} TEST, *PTEST;
Thanks
Don't try it, just do it!
|
|
|
|
|
|
I can't, this struct is part of the IPv4 header.
Don't try it, just do it!
|
|
|
|