|
What problem are you having? If interface_details->DevicePath has the full path, then all you have to do is extract the drive using something like _splitpath() .
|
|
|
|
|
interface_details->DevicePath looks like
\\?\ide#diskhitachi_hts545032b9a300_________________pb3oc64g#4&110e2cc5&0&0.0.0#
{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
and there are no drive letters.
|
|
|
|
|
Hi,
I don't know the functions you are using. Here is what I have used so far:
1.
GetDriveType(string rootPathName) which is a kernel32 function. It returns one of:
Maybe that is sufficient for your needs.
2.
If not, I would have to recommend WMI; warning: it is a bit of a puzzle. The relevant WMI classes would be Win32_DiskDrive, Win32_LogicalDiskToPartition, Win32_PhysicalMedia. And IIRC the drives come in the same order when querying Win32_PhysicalMedia and Win32_DiskDrive.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Let's say I have a command-line C++ program running under an Administrator account on the system and I want to start another program but I want it to run under a different user account. I want this new user account to only have write permissions to a specific subdirectory tree on the system and restricted access to the Registry (if possible). And this account should only be able to run specific programs. I also want my C++ program to manage the list of allowed programs for the target user account.
How do I create such an account? (Windows XP Professional SP3)
Then, how do I start the target program using the desired user account?
Also, using C++ (or command-line applications I can execute from my C++ program), how do I go about managing the list of allowed programs for the target user account?
|
|
|
|
|
|
I want to move items position in listcontrol using MFC . my listview style is image.
Rajesh
|
|
|
|
|
You will probably need to use one of these members[^].
I must get a clever new signature for 2011.
|
|
|
|
|
But I want to move using drag and drop
Rajesh
|
|
|
|
|
Take a look here[^].
I must get a clever new signature for 2011.
|
|
|
|
|
|
Hi. I am trying to change the bmp when the cursor position is greater than 100, but my program doesnt seems to respond to it >.<.
here is the code
LRESULT CALLBACK WindProcedure(HWND hWnd, UINT Msg,
WPARAM wParam, LPARAM lParam)
{
float xPos, yPos;
static int picture;
picture = ID_BMP_BUSY;
switch(Msg)
{
case WM_CREATE:
{
picture = 11;
break;
}
case WM_DESTROY:
{
PostQuitMessage(WM_QUIT);
break;
}
case WM_MOUSEMOVE:
{
xPos = LOWORD(lParam);
yPos = HIWORD(lParam);
if (xPos > 100)
{
picture=ID_BMP_IDLE;
InvalidateRect(hWnd, NULL, TRUE);
}
else
{
break;
}
break;
}
case WM_PAINT:
{
HDC hDC, button;
PAINTSTRUCT Ps;
HBITMAP bmp_button_busy;
hDC = BeginPaint(hWnd, &Ps);
bmp_button_busy = LoadBitmap(hInst, MAKEINTRESOURCE(picture));
printf("recalled\n");
button = CreateCompatibleDC(hDC);
SelectObject(button, bmp_button_busy);
BitBlt(hDC, 100, 50, 180, 70, button, 0, 0, SRCCOPY);
DeleteDC (hDC);
DeleteDC (button);
DeleteObject (bmp_button_busy);
EndPaint(hWnd, &Ps);
break;
}
default:
return DefWindowProc(hWnd, Msg, wParam, lParam);
}
return 0;
}
Did i do something conceptually wrong here? Please help~
Thanks in advance
|
|
|
|
|
picture = ID_BMP_BUSY;
This gets set every time your WindProcedure gets called. I'm guessing you don't want it overwriting the value you set it to in your WM_MOUSEMOVE case label section.
|
|
|
|
|
I have a CWnd derrived window class and I have added handlers for WM_LBUTTONDBLCLK, WM_LBUTTONDOWN and WM_LBUTTONUP. However, OnLButtonDblClk() does not appear to be called when I double-click the window but the OnLButtonDown and OnLButtonUp handlers work OK. I have tried adding CS_DBLCLKS when creating (although this should not be necessary) but it still doesn't work.
Any thoughts as to why this should be or what I could try?
Thanks
Tony
|
|
|
|
|
Do you have a message map entry for WM_LBUTTONDBLCLK ?
|
|
|
|
|
In order to know if the message is being sent, you could use the spy++ software that comes with Visual Studio.
Apart from that, depending on the way you've created the handlers you could be eliminating the double click in the click handler... Imagine you are doing the capture in a PreTranslateMessage assigned function and that after the event for WM_LBUTTONDOWN you would be cancelling the rest of the message queue.
Two attempts to help you. I guess that the first step is mandatory to help you to find the place where the error origines...
HTH!
|
|
|
|
|
Thanks for the reply. I checked the messages being set using Spy as you suggested and the WM_LBUTTONDBLCLK was not being sent to the window.
Just for a giggle, I then added CS_DBLCLKS style to the style member of the WNDCLASS when I register the window class and it then worked.
I must admint that I dont really understand why this should be, because I add the CS_DBLCLKS style when I call Create later on.
Thanks for your help!
|
|
|
|
|
Nice to know it helped.
|
|
|
|
|
As you discovered, CS_DBLCLKS is a *CLASS* style, it won't work in the Window Create.
|
|
|
|
|
|
Can anyone tell me why this code does not work?
I spent a lot of time searching messages but still have no clue.
void CChildView::OnPaint(){
CPaintDC dc(this);
CDC DC;
DC.CreateCompatibleDC(&dc);
CRect R;
GetClientRect(&R);
CBitmap bm;
bm.CreateCompatibleBitmap(&DC,R.right,R.bottom);
DC.SelectObject(bm);
CBrush b(RGB(255,0,0));
DC.SelectObject(&b);
DC.Rectangle(20,20,800,400);
dc.BitBlt(0,0,R.right,R.bottom,&DC,0,0,SRCCOPY);
dc.SelectObject(&b);
dc.Rectangle(20,20,100,100);
}
The last 2 lines produce a bright red rectangle in the proper place
but the BitBlt produces a black and white crosshatch pattern.
I have run out of options
|
|
|
|
|
Not completely sure what exactly you expect to see, since you only said it doesn't work for you, this could mean a lot of things.
Anyways, when you create a DC, it has a "default", 1 bit,1x1 bitmap selected into it. When you use CreateCompatibleBitmap on this DC, you are creating another bitmap with 1 bit colordepth, i supose that is not what you want. Try creating a compatible bitmap with dc instead of DC .
bm.CreateCompatibleBitmap(&dc,R.right,R.bottom); Does this work better?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
Thanks code-o-mat
That seems to have solved the problem.
I don't know why I didn't see that, I says so in the manual.
|
|
|
|
|
Somtimes tbe most obvious things slip our minds, probably exactly because they are so obvious we never start to think about them.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
Boy ain't that the truth.
I haven't done any coding in about 3 years, but it is starting to come back to me.
|
|
|
|
|
The problem is: i got a window, which is simply created with CreateWindow and its class is registered with RegisterClass , but, window has no background at all. It has frame with these buttons (close, minimize, maximize) but no background - it completely mirrors desktop. Have you ever encountered such thing? If yes, why this is happening?
Thanks
011011010110000101100011011010000110100101101110
0110010101110011
|
|
|
|