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

  • SEARCH
  • Home
  • 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 8562053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:38:42+00:00 2026-06-11T16:38:42+00:00

I am pretty new to visual studio. I am trying to load images and

  • 0

I am pretty new to visual studio. I am trying to load images and display it on a UI with two buttons start and stop. Every time I complete my count of total frames the next time I press start my images load more faster than before and in the end images the speed is so fast that they just disappear or appear as black. The thread speed or loading of images time increases as with each cycle. How can I limit this.. or put a time interval between showing two images. Thank you.
there code is as follows :

    void CmirrorImageDlg::OnBnClickedStart()
    {
        m_play = TRUE;
        CString num = NULL;
        num.Format(_T("Pause"));
        m_start.EnableWindow(false);
        m_stop.EnableWindow(true);
        m_stop.SetWindowTextW(num);
        m_pThread = AfxBeginThread(Operate, (LPVOID)this, THREAD_PRIORITY_NORMAL);

    }


    void CmirrorImageDlg::OnBnClickedStop()
    {
        m_play = FALSE;
        CString num = NULL;
        num.Format(_T("Resume"));
        m_start.EnableWindow(true);
        m_stop.EnableWindow(false);
        m_start.SetWindowTextW(num);
        m_count = 0;

        //m_pThread = AfxBeginThread(Operate, (LPVOID)this, THREAD_PRIORITY_ABOVE_NORMAL);
        // TODO: Add your control notification handler code here
    }


UINT CmirrorImageDlg::Operate(LPVOID param)
{
    CmirrorImageDlg* pDlg = (CmirrorImageDlg*) param;

    CString test;
    while ( pDlg->m_play && pDlg->m_count < TOTAL_FRAME_NUMBER)
    {
        test.Format(_T("images/%.4d.BMP"),pDlg->m_count);

        pDlg->hbitmap = (HBITMAP)LoadImage(NULL,test,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);

        pDlg->inv_hbitmap = pDlg->GetInvertedBitmap(pDlg->hbitmap, TRUE); 
        pDlg->inv_hbitmap_1 = pDlg->GetInvertedBitmap(pDlg->hbitmap , FALSE);
        //CBitmap map = LoadBitmapW(test);
        //filePath = IDB_BITMAP1;
        //filePath++;



        //IDB_PICTURE2.LoadBitmapW(filePath);
        pDlg->m_picture.SetBitmap(pDlg->hbitmap);
        pDlg->m_picture_2.SetBitmap(pDlg->inv_hbitmap);
        pDlg->m_picture_3.SetBitmap(pDlg->inv_hbitmap_1);

        CString num = NULL;
        num.Format(_T("%d"),pDlg->m_count);
        pDlg->m_label.SetWindowTextW(num);
        // TODO: Add your control notification handler code here
        pDlg->m_count++;

    }
    if(pDlg->m_count >= TOTAL_FRAME_NUMBER)
    {
        CString num = NULL;
        num.Format(_T("%d"),0);

        pDlg->m_count = 0;
        pDlg->m_play= false;
        pDlg->m_label.SetWindowTextW(num);

        pDlg->m_picture.SetBitmap(NULL);
        pDlg->m_picture_2.SetBitmap(NULL);
        pDlg->m_picture_3.SetBitmap(NULL);

        CString num1 = NULL;
        num.Format(_T("Stop"));
        pDlg->m_start.EnableWindow(true);
        pDlg->m_stop.EnableWindow(false);
        pDlg->m_stop.SetWindowTextW(num);
        num.Format(_T("Start"));
        pDlg->m_start.SetWindowTextW(num);
        //pDlg->m_pThread->SuspendThread();

    }

    return 0;
}
  • 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-06-11T16:38:43+00:00Added an answer on June 11, 2026 at 4:38 pm

    A reasonably simple option:

    Set a WM_TIMER for your dialog to fire every 40 milliseconds (if you want 25 frames per second). If not playing, the timer handler will do nothing.

    When the user hits play, you’ll load the first image, and then set the ‘playing’ flag. Inside the timer handler, it will take the currently loaded image and blit it to the screen, then load the next image and return. When there are no more images in the sequence you clear your ‘playing’ flag.

    Because you always display the current image when the timer fires, it doesn’t matter how long it takes to load the next image (as long as you can do it faster than the playback).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm pretty new to Visual Studio so this might be an easy issue :)
I'm pretty new to C# and Visual Studio. I'm writing a small program that
Question ONE: I'm still pretty new to .net, but have used Visual Studio for
I am pretty new to Visual Studio and .net framework and I need some
I'm pretty new to Visual Studio and I'm currently working on a project in
I'm pretty new to unit testing and currently experimenting a bit with Visual Studio's
I'm pretty new to this so here goes... I'm using Visual Studio 05 (C#)
i'm pretty new to ADO.NET using C# (Visual Studio 2010). Using LinqToSql isn't an
I'm pretty new to C++/Qt and I'm trying to create an application with Visual
I'm pretty new to CUDA. I use Microsoft Visual Studio 2010 where I don't

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.