Skip to main content

 none
Draw bmp picture in background while performing other computations in forground RRS feed

  • Question

  • Hi,

    I have a large data to process and draw a bmp picture from the data.

    I like to implement the procedure which draws picture in the background while I perform other computations and show the background picture when it is ready to be shown

    I started out with thread using   _beginthread(),  void Thread(PVOID pvoid)”,   and I cannot manage  myself through the process.  Maybe this is not the way to do it.

    Is there some simple example I can start with which will get me started on this procedure, or would someone show where I should start

    I use C language with Visual Studio 2013 editor on Window 10 platform.

    Thank you in advance

    ChangChiTheGraphics


    chang Chi

    Thursday, April 5, 2018 8:41 AM

Answers

  • Hi,

    Thank you for posting here.

    Did you try to mutex to notice other thread to run?  You can try to use the following code:

    WaitForSingleObject( hScreenMutex, INFINITE );  
    

    If the picture is ready to be shown, you can notice other thread to read the data, please remember to lock shared resource.

    About Sample Multithread C Program, please refer to this code.

    Best Regards,

    Hart


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by Hart WangModerator Tuesday, April 10, 2018 6:25 AM
    • Marked as answer by C.H.Chi Tuesday, April 24, 2018 6:23 AM
    Friday, April 6, 2018 2:55 AM
    Moderator

All replies

  • Hi,

    Thank you for posting here.

    Did you try to mutex to notice other thread to run?  You can try to use the following code:

    WaitForSingleObject( hScreenMutex, INFINITE );  
    

    If the picture is ready to be shown, you can notice other thread to read the data, please remember to lock shared resource.

    About Sample Multithread C Program, please refer to this code.

    Best Regards,

    Hart


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by Hart WangModerator Tuesday, April 10, 2018 6:25 AM
    • Marked as answer by C.H.Chi Tuesday, April 24, 2018 6:23 AM
    Friday, April 6, 2018 2:55 AM
    Moderator
  • Thank you, Hart

    I have some difficulties in getting project implemented with C language code you have given me.

    It seems that the procedure:   File, New, Project, win32, Console application leads to a project for C++ language.

    I am trying to modify files like xxx.pch and stdafx.cpp to C language version.

    Would you give me a sample code with C++ version, in case I cannot find a satisfactory solution.

    I would appreciate very much, Hart

    Thank you,

    ChabgChiTheGraphics


    chang Chi

    Tuesday, April 10, 2018 4:17 PM