Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1090369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:21:50+00:00 2026-05-16T23:21:50+00:00

I am working on dialog based MFC application in WinCE. I created few controls

  • 0

I am working on dialog based MFC application in WinCE.
I created few controls in a dialog and scrolled down.
When i scroll up again, the controls in the first screen got disappeared.

Controls getting created in OnInitDialog() like below at coordinates (50,10)

test->Create(_T("Title"), WS_CHILD|WS_VISIBLE, CRect(50,10,200,40), this, ID_TITLE);

Scroll handling i am doing in OnVScroll() like below

 switch(nSBCode)
 {
  case SB_LINEDOWN:
  {
   if(nPos < max)
   {
    ScrollWindowEx(0, SCROLLDOWN_LINE_STEPSIZE, CRect(0,0, rect.right - 25, rect.bottom), NULL, NULL, NULL, SW_SCROLLCHILDREN | SW_INVALIDATE); 
    pScrollBar->SetScrollPos(nPos - SCROLLDOWN_LINE_STEPSIZE); //nPos+10
   }
   break;
  }
  case SB_LINEUP:
  {
   if(nPos > min)
   {
    ScrollWindowEx(0, SCROLLUP_LINE_STEPSIZE, CRect(0,0, rect.right - 25, rect.bottom), NULL, NULL, NULL, SW_SCROLLCHILDREN | SW_INVALIDATE); 
    pScrollBar->SetScrollPos(nPos - SCROLLUP_LINE_STEPSIZE); //Ex: nPos-10
   }
   break;
  }

 default:
  printf("Notimplemented");
  break;
 }

I am handling Scroll down and scroll up.
While scrolling down, all the controls in Dialog are shown.
But while scrolling up, the controls at the top got disappeared.

What’s going on ?
Should i implement OnPaint() method for drawing the controls each time i scroll ?
If so, how ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:21:50+00:00Added an answer on May 16, 2026 at 11:21 pm

    I have the following code that works fine. I hope it will help you.

    LRESULT CMyWindow::OnVScroll( UINT code, UINT position )
    {
        SCROLLINFO info = { sizeof( SCROLLINFO ), SIF_ALL };
        GetScrollInfo( m_wnd, SB_VERT, &info );
        int previous_pos = info.nPos;
        switch( code )
        {
        case SB_TOP:
            info.nPos = 0;
            break;
        case SB_BOTTOM:
            info.nPos = info.nMax - info.nPage;
            break;
        case SB_LINEDOWN:
            info.nPos = min( info.nPos + 1, info.nMax - (int)info.nPage );
            break;
        case SB_LINEUP:
            info.nPos = max( info.nPos - 1, info.nMin );
            break;
        case SB_PAGEDOWN:
            info.nPos = min( info.nPos + (int)info.nPage, info.nMax - (int)info.nPage );
            break;
        case SB_PAGEUP:
            info.nPos = max( info.nPos - (int)info.nPage, info.nMin );
            break;
        case SB_THUMBTRACK:
        case SB_THUMBPOSITION:
            info.nPos = position;
            break;
        }
        int offset = previous_pos - info.nPos;
        if( offset != 0 )
        {
            ScrollWindowEx( m_wnd, 0, offset, NULL, NULL, NULL, NULL, SW_SCROLLCHILDREN | SW_INVALIDATE | SW_ERASE );
            SetScrollPos( m_wnd, SB_VERT, info.nPos, FALSE );
        }
        return 0L;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Keyboard Enter key not working in MFC Dialog Box ? I have one MFC
I'm working on a Version History dialog box, and I created a sample to
I'm working on an import (from Excel) dialog to select ranges of cells. When
I'm working on a PyGTK/glade application that currently has 16 windows/dialogs and is about
Working with a SqlCommand in C# I've created a query that contains a IN
I am using a javascript-based modal dialog. The dialog is fading in and fading
I was working on a dialog with content loaded by AJAX, but I'm not
Working with dates in ruby and rails on windows, I'm having problems with pre-epoch
Working on a project at the moment and we have to implement soft deletion
Working on a somewhat complex page for configuring customers at work. The setup is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.