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

C / C++ / MFC

 
GeneralRe: How can I show my dialog on the TOP from other window dialog? Pin
David Crow1-Aug-09 16:56
David Crow1-Aug-09 16:56 
Question[MISC] - Operators - Meaning of operator & Pin
Thang29-Jul-09 6:59
Thang29-Jul-09 6:59 
AnswerRe: [MISC] - Operators - Meaning of operator & Pin
David Crow29-Jul-09 7:05
David Crow29-Jul-09 7:05 
AnswerRe: [MISC] - Operators - Meaning of operator & Pin
enhzflep29-Jul-09 8:27
enhzflep29-Jul-09 8:27 
GeneralRe: [MISC] - Operators - Meaning of operator & Pin
Maximilien29-Jul-09 9:48
Maximilien29-Jul-09 9:48 
GeneralRe: [MISC] - Operators - Meaning of operator & Pin
enhzflep29-Jul-09 10:00
enhzflep29-Jul-09 10:00 
GeneralRe: [MISC] - Operators - Meaning of operator & Pin
Thang30-Jul-09 6:10
Thang30-Jul-09 6:10 
QuestionSlider control on the status bar (where does WM_HSCROLL go?) Pin
BabakTaati29-Jul-09 5:46
BabakTaati29-Jul-09 5:46 
Hi,

I'm trying to place a slider control (CSliderCtrl) on the status bar. The slider bar appears fine and I can move it around (either manually or by calling SetPos). However, I can't find where the WM_HSCROLL messages from the slider bar are sent to! I set the parent of the slider control to the status bar, but no WM_HSCROLL is sent to that window! Any ideas?

Here's what my code looks like. First off, I derived a class from CStatusBar to handle WM_HSCROLL:
class CMyStatusBar : public CStatusBar 
{
public:
	DECLARE_MESSAGE_MAP()
	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
};

In my view class (e.g. CMySimpleProjctView) I added two members:
CSliderCtrl videoPosSlider;
CMyStatusBar statusBar;

and also a function called InitSliderBar() which is something like this:
void CMySimpleProjctView::InitSliderBar()
{
	CMainFrame* frame = (CMainFrame*) AfxGetApp()->m_pMainWnd; // get the main frame
	statusBar = (CMyStatusBar*)(frame->GetStatusBar()); // get the status bar

	// place a slide bar on the status bar, similar to http://support.microsoft.com/kb/142202
	RECT rc;
	statusBar->GetItemRect(0, &rc);
	VERIFY (videoPosSlider.Create(WS_CHILD | WS_VISIBLE, rc, statusBar, 1)); // parent of the slider = status bar

	videoPosSlider.SetRange(0, 50, 1);
	videoPosSlider.SetPos(5);
}

When I run the program, the slider bar appears and I can move it around, but CMyStatusBar::OnHScroll() is not called when I move the slider. To test if everything else is fine, I changed the parent of the slider control to the view window in the code as
VERIFY (videoPosSlider.Create(WS_CHILD | WS_VISIBLE, rc, m_hWnd, 1)); // parent of the slider = view window

and now CMySimpleProjctView::OnHScroll *is* called (but of course the slider bar appears at the wrong place, not on the status bar). I tried Spy++ to see where the WM_HSCROLL is sent to (when parent=status bar) but no WM_HSCROLL is sent at all! In fact no messages are passed when I move the slider around!!

Any ideas? thanks.

-Babak

(by the way, videoPosSlider.GetOwner() and videoPosSlider.GetParent() both return pointers that are identical to statusBar)
QuestionReading from and writing to the registry in windows Vista Pin
Sternocera29-Jul-09 5:00
Sternocera29-Jul-09 5:00 
QuestionRe: Reading from and writing to the registry in windows Vista Pin
David Crow29-Jul-09 5:47
David Crow29-Jul-09 5:47 
AnswerRe: Reading from and writing to the registry in windows Vista Pin
bob1697229-Jul-09 5:53
bob1697229-Jul-09 5:53 
GeneralRe: Reading from and writing to the registry in windows Vista Pin
Sternocera29-Jul-09 23:38
Sternocera29-Jul-09 23:38 
QuestionReferences Pin
EliottA29-Jul-09 4:13
EliottA29-Jul-09 4:13 
AnswerRe: References Pin
Chris Losinger29-Jul-09 4:28
professionalChris Losinger29-Jul-09 4:28 
GeneralRe: References Pin
EliottA29-Jul-09 4:35
EliottA29-Jul-09 4:35 
GeneralRe: References Pin
Chris Losinger29-Jul-09 4:40
professionalChris Losinger29-Jul-09 4:40 
GeneralRe: References Pin
Maximilien29-Jul-09 7:59
Maximilien29-Jul-09 7:59 
AnswerRe: References Pin
Rajesh R Subramanian29-Jul-09 4:50
professionalRajesh R Subramanian29-Jul-09 4:50 
QuestionTrimRight() and TrimLeft() for unicode characters. Pin
Rakesh529-Jul-09 3:40
Rakesh529-Jul-09 3:40 
AnswerRe: TrimRight() and TrimLeft() for unicode characters. Pin
Emilio Garavaglia30-Jul-09 1:42
Emilio Garavaglia30-Jul-09 1:42 
QuestionFont Pin
kumar sanghvi29-Jul-09 3:28
kumar sanghvi29-Jul-09 3:28 
QuestionRe: Font Pin
David Crow29-Jul-09 3:55
David Crow29-Jul-09 3:55 
AnswerRe: Font Pin
CPallini29-Jul-09 3:57
mveCPallini29-Jul-09 3:57 
GeneralRe: Font Pin
kumar sanghvi29-Jul-09 4:05
kumar sanghvi29-Jul-09 4:05 
GeneralRe: Font Pin
CPallini29-Jul-09 4:32
mveCPallini29-Jul-09 4:32 

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.