Solved

Delivering Delphi Component that works Design Time Only ?

Posted on 2010-11-26
9
450 Views
Last Modified: 2012-05-10
Delphi 2010

I am writing a simple component for someone. I want to deliver it to them for testing purposes, but i want it to work in Design Time Only

How do i do this?

Please describe the steps please

thanks
0
Comment
Question by:Looking_4_Answers
[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
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 32

Expert Comment

by:Ephraim Wangoya
ID: 34219264
add this function to your component
uses
  Windows;

function IsInIDE: Boolean;
begin
  Result := (FindWindow('TAppBuilder', nil) > 0) and (DebugHook <> 0);
end;

in the initialization section

initialization
  if not IsInIDE then
  begin
    MessageBox(0, 'Can only run in Delphi', 'Error', MB_OK);
    Application.Terminate; //Halt
  end;
0
 
LVL 25

Expert Comment

by:epasquier
ID: 34220169
The first test will tell you that Delphi is loaded, but not that your application is running from Delphi.

That is where the check of DebugHook global variable comes into play, that Delphi sets when integrated debugging is activated and you launch the application from Delphi.

If Delphi integrated debugging is deactivated, then there is no difference between your application launched from Delphi and from explorer while delphi is already loaded.

0
 

Author Comment

by:Looking_4_Answers
ID: 34220244
"That is where the check of DebugHook global variable comes into play, that Delphi sets when integrated debugging is activated and you launch the application from Delphi.

If Delphi integrated debugging is deactivated, then there is no difference between your application launched from Delphi and from explorer while delphi is already loaded."

Please Elaborate......maybe with code?
0
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!

 
LVL 25

Expert Comment

by:epasquier
ID: 34220274
ewangoya posted a code without explanation, I posted an explanation without code : both work together.

FindWindow('TAppBuilder', nil) >0  => Delphi is loaded somewhere

(DebugHook <> 0)  => that application is running under a debugger.

Both condition at the same time => most certainly that application has been launched from delphi and is being debugged
0
 

Author Comment

by:Looking_4_Answers
ID: 34220480
Ok, ill try that part of it....but, I do not want to delliver the code for the compoenent.  How do i deliever just the compiled stuff. Package, DCU's, etc
0
 
LVL 24

Expert Comment

by:jimyX
ID: 34220846
I have read sometime back that the Register procedure is only called in design mode. You can define a flag in your module and have your register procedure set that flag.  If that flag is clear in your constructor then you are not in design mode.
0
 
LVL 25

Accepted Solution

by:
epasquier earned 500 total points
ID: 34222778
design time is another issue. And one that is easily checked with the test :
csDesigning in ComponentState

Looking4Answers : just put all of it in a package, compile it and distribute .BPL and .DCU
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 34224430
if you want the absolute certain way :

within your component you could find if you have access to the IDE
basically you can query the IDE with IOTA (Open Tools Api) interfaces from within your component

uses ToolsApi;

function CheckInIde: Boolean;
begin
  Result := BorlandIdeServices <> nil;
end;

I think you need to add DesignEditors to your uses packages of your component
Don't have access to delphi here, i could test on monday

If you are looking for more such info, look for IOTA Delphi in google :)

0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 34224437
here is a simple wizard by Allen:
http://edn.embarcadero.com/article/20419

you even get access to the debugger ...
you could even post a message to the debugger window using IOTADebuggerServices;
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…

724 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