|
try it alreay. but it can't fullfill the use I need.
even if it didn't have any effect at all.
guess the mouse move event reflash is too quick.
|
|
|
|
|
Does anyone know how to retrieve the user and kernel cycle times on a per-logical processor basis in Windows?
Task Manager does it, but how? Every function I've looked at only gives total times for all processors.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
|
I have a memory card which is having corrupted file system. I need to get physical drive size.
I tried using WMI but it gives 8 MB only even though its size is 30GB.
Can you please guide me?
|
|
|
|
|
If the file system is corrupt then it is unlikely that any of the normal functions will work successfully, you should try to reformat the device.
Use the best guess
|
|
|
|
|
But we nothing to do with file system, need to get physical disk size. Many other software are showing correct size for same memory card.
Can you please give any idea?
|
|
|
|
|
Maybe you need to show us the code you have tried.
Use the best guess
|
|
|
|
|
Below is WMI call
VariantClear(&vtProp);
hr = pclsObj->Get(L"Size", 0, &vtProp, 0, 0);
Below is IOCTL call
bResult = DeviceIoControl(hDevice, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, pdg, sizeof(*pdg), &junk, (LPOVERLAPPED) NULL);
CloseHandle(hDevice);
ULONGLONG DiskSize = 0;
DiskSize = pdg->Cylinders.QuadPart * (ULONG)pdg->TracksPerCylinder *
(ULONG)pdg->SectorsPerTrack * (ULONG)pdg->BytesPerSector;
wprintf(L"Disk size = %I64d (Bytes)\n"
L" = %.2f (Gb)\n",
DiskSize, (double) DiskSize / (1024 * 1024 * 1024));
But both gives same result. pdg->Cylinders.QuadPart is coming 1.
|
|
|
|
|
I tried IOCTL
DeviceIoControl(hDevice,IOCTL_DISK_GET_LENGTH_INFO,0,0,&gli,sizeof(gli),&ret,0);
ULONGLONG siize = gli.Length.QuadPart;
It gives correct result on VS2008 but not on VS2003. I need to code for VS2003.
Please guide...
|
|
|
|
|
The VS version should make no difference for device IO control API functions. But IOCTL_DISK_GET_LENGTH_INFO requires XP or later. To support older Windows versions use IOCTL_DISK_GET_PARTITION_INFO .
|
|
|
|
|
But why it is not giving correct result on my machine win7+vs2003 but working fine with win7+vs2008. I can not use vs2008 simply because whole product is in vs2003 and need to make correction in same.
please suggest solution...
|
|
|
|
|
I don't know why.
DeviceIoControl() is a Windows kernel function that passes the request to the device specific driver. So there should be no differences on one machine when calling this from a VS 2003 or VS 2008 generated application or even any other programming language.
|
|
|
|
|
Simple answer use VS2008 or later.
Use the best guess
|
|
|
|
|
you have a 30GB memory card? that's a strange size... they're sized in generally powers of two.
|
|
|
|
|
Chris Losinger wrote: you have a 30GB memory card? that's a strange size... they're sized in generally powers of two.
That's generally the case, but some lower capacity SSDs are specified in tens of gigs.
try googling for 30GB/40GB SSD.
|
|
|
|
|
here is the question I did ask before:
I have a listview REPORT with fullrowselect style everything works fine, but after i used customdraw I faced a problem such pic included, it seems I click on the item col 3 it becomes bold and more bold..
Picture[^]
if i use listview_update the bold text from the col 3 will be gone so why happens? and i just want to click on the raw without having that bold problem? any ideas?
The Code
if (lpNMHdr->code == NM_CUSTOMDRAW)
{
LPNMLVCUSTOMDRAW lpCD = (LPNMLVCUSTOMDRAW)lpNMHdr;
if (lpCD->nmcd.dwDrawStage == CDDS_PREPAINT)
{
return CDRF_NOTIFYITEMDRAW;
}
if (lpCD->nmcd.dwDrawStage == CDDS_ITEMPREPAINT)
{
return CDRF_NOTIFYSUBITEMDRAW;
}
if (lpCD->nmcd.dwDrawStage == (CDDS_ITEMPREPAINT|CDDS_SUBITEM))
{
if (lpCD->iSubItem == 0) {
LPCTSTR lpcszBuf1 = _T("example");
LPCTSTR lpcszBuf2 = _T("text");
RECT iR = { 0 };
ListView_GetSubItemRect(lpCD->nmcd.hdr.hwndFrom, lpCD->nmcd.dwItemSpec, lpCD->iSubItem, LVIR_BOUNDS, &iR);
SetBkMode(lpCD->nmcd.hdc, TRANSPARENT);
SIZE sz = { 0 };
GetTextExtentPoint32(lpCD->nmcd.hdc, lpcszBuf1, 7, &sz);
SetTextColor(lpCD->nmcd.hdc, RGB(255, 0, 0));
DrawText(lpCD->nmcd.hdc, lpcszBuf1, -1, &iR, DT_LEFT);
iR.left += sz.cx;
SetTextColor(lpCD->nmcd.hdc, RGB(0, 255, 0));
DrawText(lpCD->nmcd.hdc, lpcszBuf2, -1, &iR, DT_LEFT);
return CDRF_SKIPDEFAULT;
}
}
So someone answered me:
If you draw it yourself you need to clear the background as well, which you are not doing. Try using OPAQUE instead of TRANSPARENT.
However, I used OPAQUE but it does not help a lot so, I am trying now with clear the background: the message is wm_ERASEBACKGROUND but what I suppose to do? should I add the code there or what?
|
|
|
|
|
Just out of curiosity, why are you drawing the text yourself rather than using SetWindowText() ?JoneLe86 wrote: I click on the item col 3 it becomes bold and more bold.. I think either your X or Y coordinate is changing by 1 pixel each time. Without actually testing, that's just a guess, though.
"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
|
|
|
|
|
cuz I am coloring those buffers?!
|
|
|
|
|
Fair enough, but you can still use SetWindowText() (elsewhere, not in response to NM_CUSTOMDRAW ) rather than DrawText() for that.
"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
|
|
|
|
|
thanks for this info...
do you know what I should do? i still do get what i want, the more i click on them the more bold the become.....
|
|
|
|
|
JoneLe86 wrote: do you know what I should do? i still do get what i want, the more i click on them the more bold the become..... Check the X and Y coordinates to make sure they are the same each time your message handler is called.
"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
|
|
|
|
|
You must fill the cell rect with the background color before drawing the text. The CDC class provides the FillSolidRect() function which can be used to do this. When using DC handles, you can do it the same way as the CDC class:
::SetBkColor(lpCD->nmcd.hdc, GetBkColor());
::ExtTextOut(lpCD->nmcd.hdc, 0, 0, ETO_OPAQUE, &iR, NULL, 0, NULL);
|
|
|
|
|
Thanks for this info..
You must fill the cell rect with the background color before drawing the text.
SetBkColor(lpCD->nmcd.hdc, GetBkColor());
ExtTextOut(lpCD->nmcd.hdc, 0, 0, ETO_OPAQUE, &iR, NULL, 0, NULL);
but may function looks like this
fillrect(); //i am using this to fill out the specific rect
settextcolor(); //then I set the text color
Drawtext() //then I draw the text
(1)
if use ExtTextOut then there is no need to drawtext?
ExtTextOut(lpCD->nmcd.hdc, 0, 0, ETO_OPAQUE, &iR, Buffer, strlen(Buffer), NULL);
(2)
i used SetBkColor(lpCD->nmcd.hdc, GetBkColor(..)); nothing happened, i do not set a bk color in my listview, i did set a row color manually... so If I do SetBkColor(lpCD->nmcd.hdc, RGB(255,0,0)); the whole list bk changed to red?
maybe the method i use is wrong..
|
|
|
|
|
My example code is those used by CDC::FillSolidRect() . It will erase the cell using the actual background color of the HDC which can be set to the default returned by CListView::GetBkColor() or any other you are specifying (e.g. a row specific color).
You may of course use ExtTextOut() to print the cell text parts with different colors when adjusting the rect.
When using CListView::SetBkColor() this will set the default color for the list. When calling ::SetBkColor(HDC) , this specifies the color for the drawing functions using the HDC.
If you change the background color (or the text color) of the HDC, you should restore it to the original value that is returned by the first set call. Restoring the colors may be omitted when all cells are owner drawn.
|
|
|
|
|
OMG man (After all that Time) I finally got what I am looking for thanks so much..
those info helped me a lot
|
|
|
|