Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Message Handling in Simple Components

Posted on 2003-11-11
3
Medium Priority
?
185 Views
Last Modified: 2010-04-05
Greetings,

I've been developing a set of simple components (derived from TComponent) which need
to do 2 things :-

1. Generate and handle windows messages as a means of managing internal data without, for example, destroying classes from within their own methods.

2. Work in conjunction with other components - for example, hooking into method pointers of components which might not exist at the time of creation (hence the need for a create message)

The components in question are a server and services which hook into it
The server component maintains a list of connected clients and handles data transfer.  
The service component manages a subset of the servers clients, transfers them between other services and provides methods for the user.

I've been reading up on the windows API and from what I understand, I would need to create a window for each component.  Slightly less than straight-forward but on top of all that, there are considerations such as threads and use within DLL's and thats where it becomes more trouble than its worth.

Is there no easier way to do it since I would eventually like to make these components publically available
0
Comment
Question by:LordWolfy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 12

Expert Comment

by:Lee_Nover
ID: 9728962
for creating the message queue and handling messages is really simple
just create a new window using AllocateHWnd
then send messages to this handle
to destroy an object from it's own method post a message to it (PostMessage)
some reference code: http://leenover.homeip.net/isapi/pas2html.dll/pas2html?File=/delphi/lnMsgCompos/
two components for communication using messages (simplifying messaging)
0
 
LVL 2

Author Comment

by:LordWolfy
ID: 9735616

Thats the thing  - I remember reading soemthing about AllocateHWnd and the 32 bit VCL not being thread safe.

If these components are going to be available to everyone - they need to be able to work in all scenarios.

P.S. the reference you posted just comes up with a set of broken links.
0
 
LVL 12

Accepted Solution

by:
Lee_Nover earned 750 total points
ID: 9737304
.. crap .. probably messed up sumtin' on my server
anyway you can click the delphi sourcefile icon to display the source .. that works
download for some reason doesn't .. gotta fix that later
here are the links
http://leenover.homeip.net/isapi/pas2html.dll/pas2html?File=/delphi/lnMsgCompos/lnGlobalVar.pas
http://leenover.homeip.net/isapi/pas2html.dll/pas2html?File=/delphi/lnMsgCompos/lnMsgServer.pas
http://leenover.homeip.net/isapi/pas2html.dll/pas2html?File=/delphi/lnMsgCompos/lnMsgClient.pas
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question