Click here to Skip to main content
15,884,388 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How can I check if LPCTSTR is empty ? Pin
_Flaviu10-Apr-11 21:20
_Flaviu10-Apr-11 21:20 
AnswerRe: How can I check if LPCTSTR is empty ? Pin
Rajesh R Subramanian10-Apr-11 21:22
professionalRajesh R Subramanian10-Apr-11 21:22 
AnswerRe: How can I check if LPCTSTR is empty ? Pin
Rob Grainger10-Apr-11 23:44
Rob Grainger10-Apr-11 23:44 
GeneralRe: How can I check if LPCTSTR is empty ? Pin
_Flaviu11-Apr-11 5:45
_Flaviu11-Apr-11 5:45 
GeneralRe: How can I check if LPCTSTR is empty ? Pin
Rob Grainger11-Apr-11 12:55
Rob Grainger11-Apr-11 12:55 
QuestionProblem Showing Enumerated Sound Devices in ComboBox [modified] Pin
Paul Hasler10-Apr-11 16:49
Paul Hasler10-Apr-11 16:49 
AnswerRe: Problem Showing Enumerated Sound Devices in ComboBox Pin
Hans Dietrich10-Apr-11 19:03
mentorHans Dietrich10-Apr-11 19:03 
GeneralRe: Problem Showing Enumerated Sound Devices in ComboBox Pin
Paul Hasler10-Apr-11 20:26
Paul Hasler10-Apr-11 20:26 
Thank you for your response Hans.

I added the break; after the case WM_INITDIALOG: block. Thank you, this was an oversight. Unfortunately it has not fixed the problem.
I've now added a static int called iCount to the callback procedure where I call ComboBox_AddString(). I've used ComboBox_GetCount() to update iCount.
I've also added some error handling to the ComboBox_AddString() call.
When I put in a breakpoint here and debug, I see that iCount remains at 0 each time the code passes through.
Below is my revised code.
BOOL CALLBACK DSEnumProc(LPGUID lpGUID, LPCSTR lpszDescription, LPCSTR lpszDriverName, LPVOID lpContext)
{
	HWND		hCombo = (HWND)lpContext;
	LPGUID		lpTemp = NULL;
	static int	iCount;
	if(lpGUID != NULL)
	{
		if((lpTemp = (LPGUID)malloc(sizeof(GUID))) == NULL)
			return TRUE;
		memcpy(lpTemp, lpGUID, sizeof(GUID));
	}

	// Put data into ComboBox
	if(ComboBox_AddString(hCombo, lpszDescription) == CB_ERR | CB_ERRSPACE)
		{
			MessageBox(hCombo, TEXT("Error Adding String To ComboBox"), TEXT("Error!"), MB_OK);
		}
	iCount = ComboBox_GetCount(hCombo);
	ComboBox_SetItemData(hCombo, ComboBox_FindString(hCombo, 0, lpszDescription), lpTemp);
	free(lpTemp);
	return TRUE;
}


Is it something to do with the way I'm trying to pass the ComboBox handle to the DSEnumProc procedure when I initialize the dialog? I notice that the value of hCombo in the code below is different from the value in the code above when I debug.
hCombo = GetDlgItem(hDlg, IDC_COMBO);
if(DirectSoundEnumerate((LPDSENUMCALLBACK)DSEnumProc,(VOID*)&hCombo) != DS_OK)
{
    EndDialog(hDlg, TRUE);
    return TRUE;
}


Thank you again for your help

Paul
GeneralRe: Problem Showing Enumerated Sound Devices in ComboBox Pin
Hans Dietrich10-Apr-11 20:41
mentorHans Dietrich10-Apr-11 20:41 
GeneralRe: Problem Showing Enumerated Sound Devices in ComboBox Pin
Paul Hasler10-Apr-11 21:18
Paul Hasler10-Apr-11 21:18 
GeneralRe: Problem Showing Enumerated Sound Devices in ComboBox Pin
Hans Dietrich10-Apr-11 21:27
mentorHans Dietrich10-Apr-11 21:27 
GeneralRe: Problem Showing Enumerated Sound Devices in ComboBox Pin
Paul Hasler10-Apr-11 22:01
Paul Hasler10-Apr-11 22:01 
GeneralRe: Problem Showing Enumerated Sound Devices in ComboBox Pin
Hans Dietrich10-Apr-11 22:13
mentorHans Dietrich10-Apr-11 22:13 
Questionhow to set IE to open my file format? just like PDF files. Pin
refla10-Apr-11 16:08
refla10-Apr-11 16:08 
AnswerRe: how to set IE to open my file format? just like PDF files. Pin
Hans Dietrich10-Apr-11 19:06
mentorHans Dietrich10-Apr-11 19:06 
QuestionRedirecting output to DVI or HDMI. Pin
beastian10-Apr-11 4:34
beastian10-Apr-11 4:34 
AnswerRe: Redirecting output to DVI or HDMI. Pin
Code-o-mat10-Apr-11 11:37
Code-o-mat10-Apr-11 11:37 
GeneralRe: Redirecting output to DVI or HDMI. Pin
beastian13-May-11 4:28
beastian13-May-11 4:28 
GeneralRe: Redirecting output to DVI or HDMI. Pin
Code-o-mat13-May-11 4:30
Code-o-mat13-May-11 4:30 
Questionproblem to draw line in list control Pin
shashankacharya8-Apr-11 19:30
shashankacharya8-Apr-11 19:30 
AnswerRe: problem to draw line in list control Pin
Nitheesh George8-Apr-11 20:18
Nitheesh George8-Apr-11 20:18 
GeneralRe: problem to draw line in list control Pin
shashankacharya8-Apr-11 22:13
shashankacharya8-Apr-11 22:13 
GeneralRe: problem to draw line in list control Pin
Rotted Frog8-Apr-11 23:02
Rotted Frog8-Apr-11 23:02 
QuestionHow can find the text file encoded in other than ANSI format? Pin
Le@rner8-Apr-11 18:29
Le@rner8-Apr-11 18:29 
AnswerRe: How can find the text file encoded in other than ANSI format? Pin
Rotted Frog8-Apr-11 22:56
Rotted Frog8-Apr-11 22:56 

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.