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 9117167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:50:37+00:00 2026-06-17T04:50:37+00:00

I must processing one image in main form , but the processing speed is

  • 0

I must processing one image in main form , but the processing speed is low for inc speed i use thread…

My thread code :

type
  TPaintThread = class(TThread)
    Source,Mask :TBitmap ;
    image : TImage;
    public
       procedure SetAll(src,msk:TBitmap;img:TImage);
    private
     procedure  DoWritePix;
    var
       mBit : TBitmap ;

    protected
      procedure Execute; override;
  end;

implementation

procedure TPaintThread.SetAll(src: TBitmap; msk: TBitmap; img: TImage);
begin
      Source := src ;
      mask := msk ;
      img := img ;
      mBit := TBitmap.Create ;
end;

procedure TPaintThread.DoWritePix;
begin
  image.Picture.Bitmap := mBit ;
end;

procedure TPaintThread.Execute;
var
    i: Integer;
    j: Integer;
begin
  mBit.Width := Source.Width ;
  mBit.Height := Source.Height ;
  for i := 1 to Source.Width do
    for j := 1 to Source.Width do
    begin
      // my processing event
    end;
    // result := mBit ;
    // write on form image 
    Synchronize(DoWritePix);
end;

and I’m use it in on timer :

procedure TForm1.tmr1Timer(Sender: TObject);
var
    pThread  : TPaintThread ;
begin
  pThread := TPaintThread.Create(True) ;
  pThread.SetAll(MyBmp,mask,img1);
  pThread.Resume ;
  pThread.FreeOnTerminate := True ;
end;

but I have error in DoWritePix in run time :

First chance exception at $005A81DE. Exception class $C0000005 with message 'access violation at 0x005a81de: read of address 0x000001b8'. Process myexe.exe (6032)
First chance exception at $754E9617. Exception class EAccessViolation with message 'Access violation at address 005A81DE in module 'myexe.exe'. Read of address 000001B8'. Process myexe.exe (6032) 

My question: Is that way correct for edit image in main form or not ? if not what is correct way access and write on thread? if yes how I can solve problem ?

  • 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-17T04:50:38+00:00Added an answer on June 17, 2026 at 4:50 am

    This code is wrong:

    procedure TPaintThread.SetAll(src: TBitmap; msk: TBitmap; img: TImage);
    begin
      Source := src ;
      mask := msk ;
      img := img ; // OOPS!
      mBit := TBitmap.Create ;
    end;
    

    When you write img := img; you are doing nothing – that is a no-op. You meant to write:

    image := img;
    

    And that’s why image is nil in DoWritePix which explains the access violation.

    Don’t be helpless when you face a runtime error. Run the code under the debugger and let the debugger tell you which variable is not initialised.

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

Sidebar

Related Questions

I have a CodeIgniter application, but one of my controllers must call a data
I'm using a wordpress plugin for advanced form design/logic/processing, and one of it's (biggest)
Must be missing something really obvious here but how do you change the size
Must be a way looping through this code: private void loadSprites() { this.sprites[0] =
There must be a simple solution to this problem but for the love of
This must be a duplicate. But with so many NSPredicate questions out there, I
I must be doing something wrong here. I'm trying to use Google Analytics to
In my program there is one thread (receiving thread) that is responsible for receiving
I'm considering a multi-threaded architecture for a processing pipeline. My main processing module has
I have some code that runs fairly well, but I would like to make

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.