Solved

Control Panel Programming

Posted on 1998-01-13
3
198 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
[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
  • 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

Industry Leaders: 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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
select query - oracle 16 103
Delphi...Split view - idea? 1 147
DBCtrlGrid, Delphi, Scroll 8 87
"Could not obtain OLE control window handle" under Delphi XE8 8 87
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

752 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