Solved

Control Panel Programming

Posted on 1998-01-13
3
196 Views
Last Modified: 2010-04-04
I wish to provide a control panel for an application which should be run from the control panel. Could someone give me a base to work from thanx....
0
Comment
Question by:jman112
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
JimBob091197 earned 100 total points
ID: 1356473
Here is an example for you to work from.  (I used Delphi 3.)

Steps:
1.  From file menu choose "New" then "DLL"

2.  Replace the DLL code with the following:
library TestCpl;

{$R *.res}

uses
  SysUtils, Windows, Messages, Dialogs, Classes,
  CPL;

function CPlApplet(hwndCPl: THandle; uMsg: DWORD; lParam1, lParam2: Longint): Longint; stdcall;
begin
  Result := 0;
  case uMsg of
    CPL_DYNAMIC_RES:;
    CPL_INIT:
      Result := 1;  // 1 = Continue.
    CPL_GETCOUNT:
      Result := 1;
    CPL_INQUIRE:; // See CPL_NEWINQUIRE.
    CPL_SELECT:;
    CPL_DBLCLK, CPL_STARTWPARMS:
      // Pop up your dialog here...
      ShowMessage('Applet #' + IntToStr(lParam1) + ' selected');
    CPL_STOP:;    // Control Panel is preparing to exit.
    CPL_EXIT:;    // Control Panel is now exiting.
    CPL_NEWINQUIRE:
      begin
        with PNewCPLInfo(lParam2)^ do
          begin
            dwSize := SizeOf(TNewCPLInfo);
            hIcon := 0; // Use DLL's main icon.  Make sure to include {$R *.res} above!!
            StrPCopy(@szName, 'Test');
            StrPCopy(@szInfo, 'This is a test Control Panel applet');
          end;
        Result := 1;    // Don't call CPL_INQUIRE.
      end;
    CPL_SETUP:;   // Internal. Used during system installation.
  end;
end;

exports
  CPlApplet;

begin
end.


3.  Compile the DLL, rename TestCpl.dll to TestCpl.cpl, and copy it to C:\Windows\System\.

4.  Now when you go into Control Panel, you should see an entry called "Test" with your DLL's main icon.  You can change the icon by choosing Project|Options on Delphi's menu (same as a normal app).


Regards,
JB
0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1356474
P.S.  For more info on the Applet messages, see CPL.pas in Delphi's Source\Rtl\Win directory.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1356475
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying 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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

679 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