Click here to Skip to main content
15,887,485 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow can i concate two bitmap to produce third combine bitmap Pin
Game-point24-Sep-09 19:16
Game-point24-Sep-09 19:16 
AnswerRe: How can i concate two bitmap to produce third combine bitmap Pin
CPallini24-Sep-09 20:54
mveCPallini24-Sep-09 20:54 
GeneralRe: How can i concate two bitmap to produce third combine bitmap Pin
Game-point24-Sep-09 21:01
Game-point24-Sep-09 21:01 
Questionvoid Pin
Benjamin Bruno24-Sep-09 18:16
Benjamin Bruno24-Sep-09 18:16 
AnswerRe: void Pin
CPallini24-Sep-09 20:32
mveCPallini24-Sep-09 20:32 
AnswerRe: void Pin
Stuart Dootson24-Sep-09 21:02
professionalStuart Dootson24-Sep-09 21:02 
AnswerRe: void Pin
markkuk25-Sep-09 0:11
markkuk25-Sep-09 0:11 
QuestionCListCtrl::FindItem crashes Pin
Maxwell Chen24-Sep-09 18:03
Maxwell Chen24-Sep-09 18:03 
With FindWindow and FindChildWindows API functions, I got the handle of SysListView32 control of mmsys.cpl panel. When I was trying to search the text of each entries on the ListCtrl, it always crashed.

My code snippet is as the below.
void CMainDlg::OnBnClickedGetDolby()
{
	// Kill any running window if any.
	KillRunningApplet(_T("Sound"));

	// Launch it.
	if(!LaunchCplApplet(_T("mmsys.cpl"), 0, 0)) {
		OutputDebugString(_T("LaunchCplApplet fails. \n"));
		return;
	}

	// Make sure the applet pops up.
	CWnd* pWnd = NULL;
	int i = 0;
	while(!pWnd) {
		pWnd = FindWindow(NULL, _T("Sound"));
		if(pWnd) {
			OutputDebugString(_T("Found Sound window. \n"));
			break;
		}
		Sleep(10);
		i++;
		if(i > 1000) {
			OutputDebugString(_T("Sound window is not found. \n"));
			return;
		}
	}

	// ---
	m_hListView = NULL;
	for(i = 0; i < 2; i++) {
		EnumChildWindows(pWnd->m_hWnd, DoSomethingHelper, (LPARAM)this);
		if(m_hListView) {
			OutputDebugString(_T("Got SysListView32"));
			break;
		}
		else {
			OutputDebugString(_T("SysListView32 is not found."));
			if(i == 1) {
				return;
			}
		}
	}

//	m_pListView->SendMessage(WM_KEYDOWN, VK_DOWN, 0);
//	m_pListView->SendMessage(WM_KEYDOWN, VK_DOWN, 0);

	CListView* pView = (CListView*)FromHandle(m_hListView);
	CListCtrl& Ctrl = pView->GetListCtrl();
//	Ctrl.ShowWindow(SW_HIDE); // <-- this line tells me that I got the right handle.

	LVFINDINFO info = {0};
	int iIndex = 0;

	info.flags = LVFI_PARTIAL | LVFI_STRING;
	info.psz = _T("Speaker\0");

	if((iIndex = Ctrl.FindItem(&info)) != -1) { // <-- crash at this line.
		OutputDebugString(_T("Speaker-like entry is found."));
	}

}

BOOL CALLBACK DoSomethingHelper(HWND hwnd, LPARAM lParam)
{
	TCHAR sClassName[MAX_PATH] = {0};
	GetClassName(hwnd, sClassName, MAX_PATH);
	if(wcscmp(sClassName, _T("SysListView32")) == 0) {
		CMainDlg* pMain = (CMainDlg*)lParam;
		pMain->m_hListView = hwnd;
	}
	OutputDebugString(sClassName);
	return TRUE;
}


  Maxwell Chen

AnswerRe: CListCtrl::FindItem crashes Pin
Naveen24-Sep-09 19:39
Naveen24-Sep-09 19:39 
GeneralRe: CListCtrl::FindItem crashes [modified] Pin
Maxwell Chen24-Sep-09 20:02
Maxwell Chen24-Sep-09 20:02 
GeneralRe: CListCtrl::FindItem crashes Pin
Naveen24-Sep-09 20:08
Naveen24-Sep-09 20:08 
GeneralRe: CListCtrl::FindItem crashes Pin
Maxwell Chen24-Sep-09 20:38
Maxwell Chen24-Sep-09 20:38 
GeneralRe: CListCtrl::FindItem crashes Pin
Naveen24-Sep-09 21:48
Naveen24-Sep-09 21:48 
GeneralRe: CListCtrl::FindItem crashes Pin
Maxwell Chen24-Sep-09 22:12
Maxwell Chen24-Sep-09 22:12 
GeneralRe: CListCtrl::FindItem crashes Pin
Naveen24-Sep-09 22:32
Naveen24-Sep-09 22:32 
GeneralRe: CListCtrl::FindItem crashes Pin
Maxwell Chen24-Sep-09 22:48
Maxwell Chen24-Sep-09 22:48 
QuestionHow to judge if left button down in OnMouseMove while it is a SDI derived from CListView? Pin
Syouki_kou24-Sep-09 17:30
Syouki_kou24-Sep-09 17:30 
AnswerRe: How to judge if left button down in OnMouseMove while it is a SDI derived from CListView? Pin
babu_mcet4-Apr-11 23:38
babu_mcet4-Apr-11 23:38 
QuestionHow to call telnet script (commands) inside C/C++ code? Pin
Jun Du24-Sep-09 16:22
Jun Du24-Sep-09 16:22 
AnswerRe: How to call telnet script (commands) inside C/C++ code? Pin
«_Superman_»24-Sep-09 17:03
professional«_Superman_»24-Sep-09 17:03 
QuestionHow can I copy a multidimensional array? [modified] Pin
Paul Belikian24-Sep-09 15:39
Paul Belikian24-Sep-09 15:39 
AnswerNevermind - it works as is Pin
Paul Belikian24-Sep-09 18:19
Paul Belikian24-Sep-09 18:19 
QuestionC++ new operator Global Process storage ??? Pin
ForNow24-Sep-09 13:08
ForNow24-Sep-09 13:08 
AnswerRe: C++ new operator Global Process storage ??? Pin
Rajesh R Subramanian24-Sep-09 17:11
professionalRajesh R Subramanian24-Sep-09 17:11 
GeneralRe: C++ new operator Global Process storage ??? Pin
CPallini24-Sep-09 20:56
mveCPallini24-Sep-09 20: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.