Click here to Skip to main content
15,891,033 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Back Patching an EXE as a Post Build Step Pin
Jeffrey Walton27-May-07 19:26
Jeffrey Walton27-May-07 19:26 
GeneralRe: Back Patching an EXE as a Post Build Step Pin
Garth J Lancaster27-May-07 20:05
professionalGarth J Lancaster27-May-07 20:05 
GeneralRe: Back Patching an EXE as a Post Build Step Pin
Jeffrey Walton27-May-07 20:22
Jeffrey Walton27-May-07 20:22 
QuestionHow to parse FileShare permissions Pin
Akin Ocal26-May-07 16:47
Akin Ocal26-May-07 16:47 
QuestionRe: How to parse FileShare permissions Pin
Jeffrey Walton26-May-07 17:17
Jeffrey Walton26-May-07 17:17 
QuestionApply XP Theme to HTML Dialog Pin
Richard Andrew x6426-May-07 15:57
professionalRichard Andrew x6426-May-07 15:57 
QuestionDetect CDROM eject Pin
Anorexic Tribble26-May-07 14:09
Anorexic Tribble26-May-07 14:09 
AnswerRe: Detect CDROM eject Pin
Hans Dietrich26-May-07 15:47
mentorHans Dietrich26-May-07 15:47 
Here is some rough code of device notification:
void CMyDlg::OnDeviceNotify()
{
	CString cs;
	HDEVNOTIFY *hdn = NULL;
	
	bool bDevInterResult = DoRegisterDeviceInterface(SOME_GUID, hdn) != 0;
	
	if (bDevInterResult)
	{
		cs.Format("Device notification : %d", bDevInterResult);
		MessageBox(cs);
	}
	else
	{
		MessageBox("Device Notification Registration failed");
	}
}

BOOL CMyDlg::DoRegisterDeviceInterface(GUID InterfaceClassGuid, HDEVNOTIFY *hDevNotify)
{
	DEV_BROADCAST_DEVICEINTERFACE NotificationFilter;
	char szMsg[80];
	
	ZeroMemory(&NotificationFilter, sizeof(NotificationFilter) );
	NotificationFilter.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE);
	NotificationFilter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
	NotificationFilter.dbcc_classguid = InterfaceClassGuid;
	
	hDevNotify = (void **)RegisterDeviceNotification(GetSafeHwnd(),
		&NotificationFilter, DEVICE_NOTIFY_WINDOW_HANDLE);
	
	if (!*hDevNotify)
	{
		wsprintf(szMsg, "RegisterDeviceNotification failed: %d\n",
			GetLastError());
		MessageBox((const char*)GetSafeHwnd(),szMsg, MB_OK);
		return FALSE;
	}
	
	return TRUE;
}

BOOL CMyDlg::OnDeviceChange(UINT nEventType, DWORD dwData)
{
	MessageBox("Device Change Occurred");
	
	DEV_BROADCAST_HDR *lpdbh= (DEV_BROADCAST_HDR *)dwData;
	
	switch (nEventType)
	{
		case DBT_DEVICEARRIVAL:
			MessageBox("New Device Arrived");
			break;
			
		case DBT_DEVICEREMOVECOMPLETE:
			MessageBox("Device Removed");
			break;
	}
	return TRUE;
} 



GeneralRe: Detect CDROM eject Pin
Anorexic Tribble26-May-07 23:28
Anorexic Tribble26-May-07 23:28 
QuestionHollow Font When Printing Pin
DanYELL26-May-07 13:09
DanYELL26-May-07 13:09 
AnswerRe: Hollow Font When Printing Pin
Hans Dietrich26-May-07 14:58
mentorHans Dietrich26-May-07 14:58 
QuestionScrabble game Pin
urbdos26-May-07 10:39
urbdos26-May-07 10:39 
AnswerRe: Scrabble game Pin
Hans Dietrich26-May-07 15:03
mentorHans Dietrich26-May-07 15:03 
GeneralRe: Scrabble game Pin
urbdos21-Jun-07 0:53
urbdos21-Jun-07 0:53 
AnswerRe: Scrabble game Pin
Rilhas27-May-07 3:49
Rilhas27-May-07 3:49 
QuestionCostom control? Looking for some general advice. Pin
@largeinsd26-May-07 7:43
@largeinsd26-May-07 7:43 
QuestionCString and string Pin
Star0926-May-07 6:03
Star0926-May-07 6:03 
AnswerRe: CString and string Pin
CPallini26-May-07 10:14
mveCPallini26-May-07 10:14 
AnswerRe: CString and string Pin
Michael Dunn26-May-07 20:45
sitebuilderMichael Dunn26-May-07 20:45 
QuestionHow to close previous form in Dialog based program Pin
Y_Kaushik26-May-07 4:10
Y_Kaushik26-May-07 4:10 
AnswerRe: How to close previous form in Dialog based program Pin
Manoj Kumar Rai26-May-07 9:35
professionalManoj Kumar Rai26-May-07 9:35 
GeneralRe: How to close previous form in Dialog based program Pin
Y_Kaushik27-May-07 19:36
Y_Kaushik27-May-07 19:36 
AnswerRe: How to close previous form in Dialog based program Pin
Demian Panello26-May-07 14:47
Demian Panello26-May-07 14:47 
QuestionThread blocking Pin
mehrdadov26-May-07 0:12
mehrdadov26-May-07 0:12 
AnswerRe: Thread blocking Pin
Taka Muraoka26-May-07 1:09
Taka Muraoka26-May-07 1:09 

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.