Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Control Panel Programming

Posted on 1998-01-13
3
Medium Priority
?
203 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 200 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Loops Section Overview

916 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