Solved

Control Panel Programming

Posted on 1998-01-13
3
190 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now