Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Delphi: Using form components in COM+

Posted on 2004-09-15
5
Medium Priority
?
416 Views
Last Modified: 2010-05-18
I'm writing a COM+ application in delphi that reads some information from a file, processes it and saves it to another file.

I'm running the app via a PHP webpage - the webpage simply calls a single method within the app via COM+.

As part of the application, I need to use a few non-visible components (such as Data Sources etc). Because the app runs in the background, there is no need for a user interface, so forms should not be needed.

But I need somewhere to stick my data components. So I created a form called "dm" and associated unit "dmU". I add my data components to the form and use the object inspector to set the properties how I want them. All good so far.

The program builds and I can run it ok, except the program will crash every time I try to access the component on the form, or even the form itself via code.

eg
dm.mycomponent.clear;

likewise "dm.show;" will crash the program, as you would expect.

Because I'm running the program via PHP, I don't get any more details on the error. It just says an exception occured, and by commenting backwards I have found this line to be the culprit.

So my question is....

How can I access these hidden data components without crashing the program?

Is there a property of the form I need to set, or perhaps a special form I need to use instead?
0
Comment
Question by:harveykane
[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
  • 2
5 Comments
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 12072144
"So I created a form"...
What form do you create... If you are inside the COM+ and need some place to put DB controls, use Remote Data Module (on Multitier tab).

"How can I access these hidden data components without crashing the program."
Open the _TLB.pas file, press F12 and you see the declaration of the COM component. Put there a new method called for example "ClearDataSets" and press refresh... It will appear in the Remote Data Module I mentioned above. And you will put your code inside this method.
0
 
LVL 17

Accepted Solution

by:
Wim ten Brink earned 500 total points
ID: 12072897
Don't use a form, use a data module for these components!
And remember that a datamodule is just a class, not an object. You will have to create it at some point. As Ivanov already says, you could use a remote data module instead.

However, I wonder why you haven't noticed this yourself, while you're working on something complicated as COM. Are you using Delphi 2 or 3?
0
 
LVL 2

Author Comment

by:harveykane
ID: 12073189
This is just a one off project for me, I normally do PHP based projects or if I use delphi, I do standard exe programs. I need to use COM for this project so it will fit in with how the server is set up. I'm using Delphi 7.

Thanks for the feedback so far - I will try the remote data module and keep you posted.
0
 
LVL 2

Author Comment

by:harveykane
ID: 12168209
OK, I have solved the problem by using a Data Module instead of a form. I couldn't find any option for a remote data module though - the help says I can find it in File - New - Other - Multitier - Remote data module
I'm using Delphi 7 Professional, and there is no "multitier" tab to be found. Is this feature unique to enterprise edition, or am I missing something.
Points will be awarded anyway, this question is just for interests sake :)
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 12168444
"I couldn't find any option for a remote data module though"
Probably you are not using Enterpris versions of Delphi. Is some educational versions it doesn't exists I think... I don't know about professional.

Using Data Module will be OK for you if you don't want to use the data sets from the client. Else, if you need MIDAS act as application server - you need Remote Data Module.


0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

618 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