[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Control panel application

Posted on 2004-08-06
4
Medium Priority
?
993 Views
Last Modified: 2011-10-03
How is it possible in Delphi to make a .cpl file? and how could you make your standard Delphi program run with that extension?
0
Comment
Question by:KLOPEKS
[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
4 Comments
 
LVL 12

Expert Comment

by:andrewjb
ID: 11733664
You got Delphi pro? Don't you just do "New" and choose 'Control Panel appliction' of the 'Other' options somewhere?
0
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 11734149
andrewjb is right. Use File|New|Control Panel Application

When you create a new CPL project, you get a TAppletModule which is a kind of data module with special events to support a control panel. You can even add more of those panels if you like. Control Panel Applications have a special entry point called "CPlApplet" which is required.

Let's quote cpl.pas:
--------Start quote
General rules for being installed in the Control Panel:
      1) The DLL must export a function named CPlApplet which will handle the messages discussed below.
      2) If the applet needs to save information in CONTROL.INI minimize clutter by using the application name [MMCPL.appletname].
      3) If the applet is refrenced in CONTROL.INI under [MMCPL] use the following form:
              ...
              [MMCPL]
              uniqueName=c:\mydir\myapplet.dll
              ...
  The order applet DLL's are loaded by CONTROL.EXE is:
      1) MAIN.CPL is loaded from the windows system directory.
      2) Installable drivers that are loaded and export the CplApplet() routine.
      3) DLL's specified in the [MMCPL] section of CONTROL.INI.
      4) DLL's named *.CPL from windows system directory.

 CONTROL.EXE will answer this message and launch an applet

 WM_CPL_LAUNCH
      wParam      - window handle of calling app
      lParam      - LPTSTR of name of applet to launch

 WM_CPL_LAUNCHED
      wParam      - TRUE/FALSE if applet was launched
      lParam      - NULL

 CONTROL.EXE will post this message to the caller when the applet returns (ie., when wParam is a valid window handle)
--------End quote

In Delphi, the related units are CPL and CtlPanel. It is possible to make an executable that runs both as stand-alone exe and as CPL application but in general it's better to split this functionality. But if you really want to do this, create a CPlApplet according to above syntax and export it. Rename the exe to .cpl or include {$E cpl} in your project source.
0
 

Author Comment

by:KLOPEKS
ID: 11735532
I'm not to familiar with Control Panel Application, but i have an existing program that i would like to run as one, so do i make a dll, or add my current code to a CPlApplet ?  
0
 
LVL 18

Accepted Solution

by:
Johnjces earned 360 total points
ID: 11738798
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

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…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
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

649 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