?
Solved

Control Panel Programming

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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

719 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