Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Opening the  "Connections, LAN Settings" window from Delphi

Posted on 2004-03-27
9
Medium Priority
?
568 Views
Last Modified: 2010-05-18
Hi,

How do I open the "Connections, LAN Settings" window from a Delphi program. I need to display the proxy settings. I know that these can be found in the registry, but I need to open the `original` window.


Thanks,
Aleksandar
0
Comment
Question by:Aleksandar Bradarić
[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
  • 4
  • 3
  • 2
9 Comments
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10696315
WinExec('rundll32 shell32.dll,Control_RunDLL ncpa.cpl,,0',SW_SHOW);

Shane
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10696402
also note, that the command is

'netcpl.cpl' on Win9X/Me


detect which OS is running


case Win32Platform of
  VER_PLATFORM_WIN32_NT     : Caption := 'WinNT/2000';
  VER_PLATFORM_WIN32_WINDOWS: Caption := 'Win9x/ME';
  VER_PLATFORM_WIN32s       : Caption := 'Win32s';
else
  Caption := 'unknown;'
end;
 
Shane
0
 
LVL 17

Author Comment

by:Aleksandar Bradarić
ID: 10696599
> WinExec('rundll32 shell32.dll,Control_RunDLL ncpa.cpl,,0',SW_SHOW);

Thanks Shane, but this opened "Network Connections"... BTW, I'm using WinXP Pro
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 11

Expert Comment

by:shaneholmes
ID: 10696613
ah yeah, isn't that what you wanted.

You then have to choose a connection, to get to lan properties.

What if the person has two lan connections, a bridge connection,  and a wan connection in there, how would one know, which one to initialize....?

Shane
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10696761
are u talking about the browser (e.g. internet explorer) lan settings?

tools/internet options/connections/lan settings

Shane
0
 
LVL 17

Author Comment

by:Aleksandar Bradarić
ID: 10697808
> tools/internet options/connections/lan settings

Yes, that's what I had in mind. Sorry for not making it clear enough... How do I open it?
0
 
LVL 4

Accepted Solution

by:
HillGroover earned 2000 total points
ID: 10698176
This should *hopefully* do what you're wanting to accomplish. can't test it at my current location though.

function EnumChildProc(Wnd: hWnd; SL: TStrings): BOOL; stdcall;
var
   szFull: array[0..MAX_PATH] of Char;  //Buffer for window caption
begin
   Result := Wnd <> 0;
   if Result then
   begin
      GetWindowText(Wnd, szFull, SizeOf(szFull));  // put window text in buffer
      if (Pos(SL[0], StrPas(szFull)) > 0) and (SL.IndexOfObject(TObject(Wnd)) < 0) then
         SL.AddObject(StrPas(szFull), TObject(Wnd));  // Add item to list
      EnumChildWindows(Wnd, @EnumChildProc, Longint(SL));  //Recurse into child windows
   end;
end;

function ClickButton(ParentWindow: Hwnd; ButtonCaption: string): Boolean;
var
   SL: TStringList;
   H:  hWnd;
begin
   SL := TStringList.Create;
   try
      SL.AddObject(ButtonCaption, nil);  // First item in list is text to find
      EnumChildWindows(ParentWindow, @EnumChildProc, Longint(SL));
      H := 0;
      case SL.Count of
         1: Beep; {ShowMessage('Window text not found.');}
         2: H := hWnd(SL.Objects[1]);
      else
         Beep; {ShowMessage('Ambiguous text detected.');}
      end;
   finally
      SL.Free;
   end;
      Result := H <> 0;
   if Result then
      PostMessage(H, BM_CLICK, 0, 0);
end;

procedure TForm1.Button1Click(Sender: TObject);
var
   boo: hWnd;
begin
   { Run the Internet Options Dialog and display the Connections tab }
   WinExec('rundll32 inetcpl.cpl LaunchConnectionDialog', 0);

   { Create a Handle to the IE Options Dialog }
   boo := FindWindow(nil, 'Internet Properties');

   //Sleep(1000); //this shouldn't be required but can be used as a safeguard if
   //running on a slow machine and doesn't display the dialog quickly enough

   { Pretty Self Explanatory - Click The Button that says LAN Settings }
   ClickButton(boo, 'LAN Settings...');
end;
0
 
LVL 17

Author Comment

by:Aleksandar Bradarić
ID: 10698220
> This should *hopefully* do what you're wanting to accomplish. can't test it at my current location though.

Works :) Thanks a lot :)
0
 
LVL 4

Expert Comment

by:HillGroover
ID: 10698421
Glad it helped :o)

ali
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

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…
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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
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…
Suggested Courses

609 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