Click here to Skip to main content
15,894,646 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questioninsert excel datas in mysql db Pin
vijay_8311-May-07 19:33
vijay_8311-May-07 19:33 
AnswerRe: insert excel datas in mysql db Pin
Rajesh R Subramanian12-May-07 0:22
professionalRajesh R Subramanian12-May-07 0:22 
GeneralRe: insert excel datas in mysql db Pin
vijay_8312-May-07 1:56
vijay_8312-May-07 1:56 
QuestionCreateProcess and WaitForSingleObject Pin
cppshishu11-May-07 18:57
cppshishu11-May-07 18:57 
AnswerRe: CreateProcess and WaitForSingleObject Pin
Mark Salsbery12-May-07 5:43
Mark Salsbery12-May-07 5:43 
QuestionStorage class for MD5 values Pin
TariqZ11-May-07 18:39
TariqZ11-May-07 18:39 
AnswerRe: Storage class for MD5 values Pin
Garth J Lancaster11-May-07 19:27
professionalGarth J Lancaster11-May-07 19:27 
QuestionSecond Slider won't slide with setcapture Pin
mtwombley11-May-07 13:05
mtwombley11-May-07 13:05 
I have a CDialog derived class (CColorSliderDlg) that has three scroll bars on it.
CColorSliderDlg doesn't have a border and so uses the SetCapture to detect when the mouse has been clicked outside it.

Because I'm using SetCapture the child controls will not get any mouse messages. So in the PreTranslateMessage I check if the message should go to a child and forward it to it.

BOOL CColorSliderDlg::PreTranslateMessage(MSG* pMsg)
{
	//Because we have a capture set, mouse messages don't forward to the children.
	//So help out and forward them, just do it for mouse messages as the rest seem to work
	POINT pnt = pMsg->pt;
	ScreenToClient(&pnt);
	CWnd *child = ChildWindowFromPoint(pnt,CWP_SKIPINVISIBLE);
	if (child != 0  /*&& child != this*/)
	{
		pMsg->hwnd = child->GetSafeHwnd();
 	}
		
	return CDialog::PreTranslateMessage(pMsg);
}


When the mouse is released for the slider I set the capture back.

void CColorSliderDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{	
	if (nSBCode == SB_ENDSCROLL)
		SetCapture();
	CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}

This works great on the first slider on the dialog.
When I added the other two only the first one will respond.
If I tab and use the keys or the wheel mouse the slider will move. But click and drag just won't.

If I remove the SetCapture everything works great again but I can't close the dialog.


Thanks
Mark
AnswerRe: Second Slider won't slide with setcapture Pin
Mark Salsbery11-May-07 13:25
Mark Salsbery11-May-07 13:25 
GeneralRe: Second Slider won't slide with setcapture Pin
mtwombley11-May-07 13:57
mtwombley11-May-07 13:57 
GeneralRe: Second Slider won't slide with setcapture Pin
Mark Salsbery11-May-07 14:39
Mark Salsbery11-May-07 14:39 
GeneralRe: Second Slider won't slide with setcapture Pin
mtwombley11-May-07 15:24
mtwombley11-May-07 15:24 
GeneralRe: Second Slider won't slide with setcapture Pin
Mark Salsbery11-May-07 16:01
Mark Salsbery11-May-07 16:01 
GeneralRe: Second Slider won't slide with setcapture Pin
mtwombley12-May-07 10:18
mtwombley12-May-07 10:18 
GeneralRe: Second Slider won't slide with setcapture Pin
Mark Salsbery12-May-07 14:05
Mark Salsbery12-May-07 14:05 
QuestionLogonUser to windows xp Pin
jluis_hdezg11-May-07 10:15
jluis_hdezg11-May-07 10:15 
QuestionHow to obtain a DLL window handle Pin
Perspx11-May-07 10:05
Perspx11-May-07 10:05 
AnswerRe: How to obtain a DLL window handle Pin
Randor 11-May-07 10:54
professional Randor 11-May-07 10:54 
GeneralRe: How to obtain a DLL window handle Pin
Perspx13-May-07 8:42
Perspx13-May-07 8:42 
QuestionError debugging winsock programs? Pin
raul211-May-07 9:08
raul211-May-07 9:08 
QuestionRe: Error debugging winsock programs? Pin
Mark Salsbery11-May-07 9:29
Mark Salsbery11-May-07 9:29 
AnswerRe: Error debugging winsock programs? Pin
raul211-May-07 10:19
raul211-May-07 10:19 
QuestionRe: Error debugging winsock programs? Pin
Mark Salsbery11-May-07 10:22
Mark Salsbery11-May-07 10:22 
AnswerRe: Error debugging winsock programs? Pin
raul211-May-07 12:19
raul211-May-07 12:19 
GeneralRe: Error debugging winsock programs? Pin
Mark Salsbery11-May-07 12:26
Mark Salsbery11-May-07 12:26 

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.