Click here to Skip to main content
15,923,006 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: URL encoding/decoding function for C++ Pin
Djalma R. dos Santos Filho7-Jan-10 3:29
Djalma R. dos Santos Filho7-Jan-10 3:29 
QuestionMultiple Child Dialogs Pin
SutterA20-Aug-09 22:23
SutterA20-Aug-09 22:23 
AnswerRe: Multiple Child Dialogs Pin
KarstenK20-Aug-09 22:56
mveKarstenK20-Aug-09 22:56 
GeneralRe: Multiple Child Dialogs Pin
SutterA20-Aug-09 23:10
SutterA20-Aug-09 23:10 
GeneralRe: Multiple Child Dialogs Pin
KarstenK21-Aug-09 0:34
mveKarstenK21-Aug-09 0:34 
GeneralRe: Multiple Child Dialogs Pin
SutterA21-Aug-09 2:50
SutterA21-Aug-09 2:50 
GeneralRe: Multiple Child Dialogs Pin
KarstenK21-Aug-09 2:56
mveKarstenK21-Aug-09 2:56 
GeneralRe: Multiple Child Dialogs Pin
SutterA21-Aug-09 3:05
SutterA21-Aug-09 3:05 
GeneralRe: Multiple Child Dialogs Pin
KarstenK21-Aug-09 3:10
mveKarstenK21-Aug-09 3:10 
AnswerRe: Multiple Child Dialogs Pin
SutterA21-Aug-09 3:16
SutterA21-Aug-09 3:16 
GeneralRe: Multiple Child Dialogs Pin
David Crow21-Aug-09 3:21
David Crow21-Aug-09 3:21 
AnswerRe: Multiple Child Dialogs Pin
Code-o-mat20-Aug-09 22:57
Code-o-mat20-Aug-09 22:57 
GeneralRe: Multiple Child Dialogs Pin
SutterA20-Aug-09 23:04
SutterA20-Aug-09 23:04 
GeneralRe: Multiple Child Dialogs Pin
Code-o-mat20-Aug-09 23:09
Code-o-mat20-Aug-09 23:09 
GeneralRe: Multiple Child Dialogs Pin
SutterA20-Aug-09 23:16
SutterA20-Aug-09 23:16 
QuestionMessge "the device is not ready" occur. Pin
Le@rner20-Aug-09 20:41
Le@rner20-Aug-09 20:41 
AnswerRe: Messge "the device is not ready" occur. Pin
_AnsHUMAN_ 20-Aug-09 21:51
_AnsHUMAN_ 20-Aug-09 21:51 
GeneralRe: Messge "the device is not ready" occur. Pin
Le@rner20-Aug-09 21:57
Le@rner20-Aug-09 21:57 
QuestionConverting CString to int Pin
Le@rner20-Aug-09 18:47
Le@rner20-Aug-09 18:47 
AnswerRe: Converting CString to int Pin
Adam Roderick J20-Aug-09 19:11
Adam Roderick J20-Aug-09 19:11 
GeneralRe: Converting CString to int Pin
Le@rner20-Aug-09 19:37
Le@rner20-Aug-09 19:37 
QuestionRetreive Hard Disk Interface Type Pin
Abinash Mohanty20-Aug-09 18:39
Abinash Mohanty20-Aug-09 18:39 
AnswerRe: Retreive Hard Disk Interface Type Pin
Randor 20-Aug-09 22:32
professional Randor 20-Aug-09 22:32 
Abinash Mohanty wrote:
Can anybody tell me how to retreive hard disk interface type without using WMI classes in MFC


Hi Abinash,

The MFC classes[^] are a very small subset of the Microsoft Windows API. The answer to your question is that MFC does not have any methods of determining a drive volume bus type.

But you can use the IOCTL_STORAGE_QUERY_PROPERTY[^] control code to obtain the STORAGE_BUS_TYPE[^]. Here is an example:

#include <winioctl.h>
#define IOCTL_STORAGE_QUERY_PROPERTY   CTL_CODE(IOCTL_STORAGE_BASE, 0x0500, METHOD_BUFFERED, FILE_ANY_ACCESS)

STORAGE_BUS_TYPE GetDriveBusType(DWORD dwDrive)
{
	STORAGE_BUS_TYPE sbt = BusTypeUnknown;
	HANDLE hDrive;
	TCHAR szDrive[MAX_PATH];
	_stprintf(szDrive,_T("\\\\.\\PhysicalDrive%d"), dwDrive);
	hDrive = CreateFile(szDrive,GENERIC_READ | GENERIC_WRITE,FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,NULL, OPEN_EXISTING, 0, NULL);
	if(INVALID_HANDLE_VALUE != hDrive)
	{
		DWORD dwSizeBytes;
		STORAGE_PROPERTY_QUERY q;
		ZeroMemory(&q,sizeof(STORAGE_PROPERTY_QUERY));
		PBYTE pBuf = (PBYTE)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(STORAGE_DESCRIPTOR_HEADER));
		if(NULL != pBuf)
		{
			if(TRUE == DeviceIoControl(hDrive,IOCTL_STORAGE_QUERY_PROPERTY,&q,sizeof(STORAGE_PROPERTY_QUERY),pBuf,sizeof(STORAGE_DESCRIPTOR_HEADER),&dwSizeBytes, NULL))
			{
				STORAGE_DESCRIPTOR_HEADER *pHeader = (STORAGE_DESCRIPTOR_HEADER *)pBuf;
				dwSizeBytes = pHeader->Size;
				pBuf = (PBYTE)HeapReAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,pBuf,dwSizeBytes);
				if(NULL != pBuf)
				{
					if(TRUE == DeviceIoControl(hDrive,IOCTL_STORAGE_QUERY_PROPERTY,&q,sizeof(STORAGE_PROPERTY_QUERY),pBuf,dwSizeBytes,&dwSizeBytes, NULL))
					{
						STORAGE_DEVICE_DESCRIPTOR * pDesc = (STORAGE_DEVICE_DESCRIPTOR *)pBuf;
						sbt = pDesc->BusType;
					}
				}
			}
			HeapFree(GetProcessHeap(), 0, (LPVOID)pBuf);
		}
	}
	return sbt;
}


Best Wishes,
-David Delaune
QuestionADO Connection String. Pin
forexsurfr20-Aug-09 17:11
forexsurfr20-Aug-09 17:11 
AnswerRe: ADO Connection String. Pin
Rane20-Aug-09 18:12
Rane20-Aug-09 18:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.