troubleshooting Question

Basic question regarding Threads

Avatar of PeteMulford
PeteMulford asked on
Delphi
3 Comments1 Solution193 ViewsLast Modified:
I'm new to using threads and have a couple of simple (i think!) questions!

1) I'm following an example that uses that posts message back to the form when valid data has been assigned a shared memory resource. In the main form unit it has:
const
  WM_DATA_IN_BUF = WM_APP + 1000;
    procedure HandleNewData(var Message: TMessage); message WM_DATA_IN_BUF;

and the thread then has:
      PostMessage(PrimeFrm.Handle, WM_DATA_IN_BUF, 0, 0);

Am I correct in my understanding that the value '1000' used can be any value as long as i havent used it before?

2) The example also has:
type
  TPrimeFrm = class(TForm)
  private
    FStringBuf: TStringList;
  public
    property StringBuf: TStringList read FStringBuf write FStringBuf;
  end;

I'm not to sure that I understand the relationship between FstringBuf and stringBuf? Is this basically saying that there is a private property FstringBuf that the to the 'world outside' the form can be read and written to using StringBuf? If thats the case what is the advantage? Why 'F' StringBuf.


3) I have a thread that requires several tbitmap and Tmemorystream variables. I was going to declare and initialise these in the thread's .execute event, but I was wondering whether there was an oncreate event and whether I could initialise them there? I'm new to multithreaded programming so I thought I would ask before trying incase there are any problems that would not be apparent.

Thanks
Pete
ASKER CERTIFIED SOLUTION
Russell Libby
Software Engineer, Advisory

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Top Expert 2005

The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.

Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 3 Comments.
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>

Mike

Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 3 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004