Solved

Browse Windows95 special directory

Posted on 1999-01-06
36
210 Views
Last Modified: 2010-04-04
Followwing code can open Printer directory:
  WinExec('control Printers', sw_ShowNormal);
but How to open Dialup Networking?
0
Comment
Question by:qdyoung
  • 12
  • 8
  • 8
  • +3
36 Comments
 

Author Comment

by:qdyoung
ID: 1354851
Edited text of question
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1354852
Hmm. Which dialog do you mean? I'm not sure about that...

Is it one of the folders that are described under winAPI SHGetSpecialFolderLocation?

Regards, Madshi.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1354853
Hi qdyoung,

the dialup networking, normally automatically pops up, if you try to make a connection.

You can use the RasDailA function for that...

also look at  http://sme.belgium.eu.net/~vip107/rasdial.zip

Regards, Zif.

please, inform me if this is what you want or not
0
Independent Software Vendors: 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!

 

Author Comment

by:qdyoung
ID: 1354854
Thanks. Sorry for nor clear. Dial-up networking folder is not
one of the folders that are described under winAPI
SHGetSpecialFolderLocation. And I do not need to make a connection.Just need to explore this folder in code, just like this:
ShellExecute(Handle, 'explore', 'C:\', nil, nil, SW_Show);
Of cause, I don't know whether this methord can apply to Dial-up networking folder.



0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1354855
what about looking them up in the registry?
0
 

Author Comment

by:qdyoung
ID: 1354856
It do has a GUID {992CFFA0-F557-101A-88EC-00DD010CCC48}.
Also this GUID is a subkey under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\explorer\mycomputer\NameSpace\
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1354857
I can't tell you in detail how to do it. Here is how you can browse an "PItemIDList" object (here I used SHGetSpecialFolderLocation, because it's the easiest way to get a PItemIDList object):

function ExecutePidl(pidl: PItemIDList) : boolean;
var ei : TShellExecuteInfo;
begin
  zeroMemory(@ei,sizeOf(ei));
  with ei do begin
    cbSize:=SizeOf(ei);
    fMask:=SEE_MASK_FLAG_NO_UI or SEE_MASK_IDLIST;
    WND:=Application.handle;
    lpVerb:='Open';
    lpIDList:=pidl;
    nShow:=SW_SHOWNORMAL;
  end;
  result:=ShellExecuteEx(@ei);
end;

procedure FreePidl(var pidl: PItemIDList);
var malloc : IMalloc;
begin
  if (pidl<>nil) and (SHGetMalloc(malloc)=NOERROR) then begin
    malloc.Free(pidl);
    pidl:=nil;
  end;
end;

function ExecuteSpecialFolderLocation(sfl: cardinal) : boolean;
var pidl : PItemIDList;
begin
  result:=SHGetSpecialFolderLocation(INVALID_HANDLE_VALUE,sfl,pidl)=NOERROR;
  if result then
    try
      ExecutePidl(pidl);
    finally FreePidl(pidl) end;
end;

if ExecuteSpecialFolderLocation(CSIDL_CONTROLS) then messageBox(0,'yes','did it work?',0)
else                                                 messageBox(0,'no', 'did it work?',0);

Of course this doesn't solve your problem, because the Dialup Networking object you want to browse is unfortunately not in the SHGetSpecialFolderLocation objects. Don't know why...  :-(

However, there is definitely a PItemIDList object for the Dialup Networking object. The problem is: How can you get this pidl?

You could enumerate the content of the "MyComputer" object (CSIDL_DRIVES is the SHGetSpecialFolderLocation const for MyComputer). If you want to know how to do this you should look either in the demo sources directory that is being shipped with Delphi4 - if you have Delphi4. Otherwise you could look at this page:
http://members.aye.net/~bstowers/delphi/
There's a component in the beta section called "TSystemTreeView" that does this enumeration stuff and much more.

It's quite complicated, isn't it!?    :-(((

Regards, Madshi.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1354858
I've found another interesting possibility. Unfortunately I can't get it to work. Look at the following. If I understand the documentation right, it should work this way, but it doesn't...  :-(
If you find an error, please tell it to me.

var DialupGuid : string = '{992CFFA0-F557-101A-88EC-00DD010CCC48}';

function ExecuteGuid : boolean;
var ei : TShellExecuteInfo;
    s1 : string;
begin
  zeroMemory(@ei,sizeOf(ei));
  with ei do begin
    cbSize:=SizeOf(ei);
    fMask:=SEE_MASK_FLAG_NO_UI or SEE_MASK_CLASSNAME;
    WND:=Application.handle;
    lpClass:=pchar(DialupGuid);
    nShow:=SW_SHOWNORMAL;
  end;
  result:=ShellExecuteEx(@ei);
end;

Regards, Madshi.
0
 
LVL 3

Expert Comment

by:williams2
ID: 1354859
I intent to put my cards on qdyoung's comment. Though I think this thread might become very interesting.

Regards,
Williams
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1354860
Hi Williams, my english is not so well. What does that mean: "I intend to put my cards on qdyoung's comment"?
Thank you...

Regards, Madshi.
0
 
LVL 5

Accepted Solution

by:
heathprovost earned 50 total points
ID: 1354861
This is one way to do it.

unit REGTEST;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Registry,
  StdCtrls, ShellApi, ShlObj;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

const
  NameSpaceKey = 'Software\Microsoft\Windows\CurrentVersion\explorer\MyComputer\NameSpace';
  MyComputerGUID = '{20D04FE0-3AEA-1069-A2D8-08002B30309D}';
  DunValue = 'Dial-Up Networking';
  DefaultStr = '(Default)';
  ExplorerName = 'EXPLORER.EXE';
var
  Form1: TForm1;

implementation

{$R *.DFM}

function GetDunGuid: String;
var
  Reg: TRegistry;
  KeyNames: TStringList;
  I: integer;
begin
  Result := 'Not Installed';
  Reg := TRegistry.Create;
  KeyNames := TStringList.Create;
  try
        Reg.RootKey := HKEY_LOCAL_MACHINE;
    if Reg.OpenKey(NameSpaceKey, False) then
    begin
      Reg.GetKeyNames(KeyNames);
      for I := 0 to KeyNames.Count - 1 do
      begin
        Reg.CloseKey;
        Reg.OpenKey(NameSpaceKey + '\' + KeyNames[I], False);
        if Reg.ReadString('') = DunValue then
        begin
          Result := KeyNames[I];
          break;
        end;
      end;
    end;
  finally
    Reg.Free;
    KeyNames.Free;
  end;
end;


procedure TForm1.Button1Click(Sender: TObject);
var
  DunGuid: String;
  WindowsDir: array [0..255] of char;
  ExplorerCmd: String;
begin
  GetWindowsDirectory(@WIndowsDir, 256);
  ExplorerCmd := String(WindowsDir) + '\' + ExPlorerName;
  DunGuid := GetDunGuid;
  if DunGuid <> 'Not Installed' then
        WInExec(Pchar(ExplorerCmd + ' ::' + MyComputerGuid + '\::' + DunGuid), SW_SHOWNORMAL)
  else
    MessageBox(Form1.Handle, 'DUN is not installed', 'Error', 0);
end;

end.

You could probably write this MUCH cleaner, but I am in a hurry.  Hope this helps
0
 
LVL 5

Expert Comment

by:heathprovost
ID: 1354862
BTW, the "correct" way to do this would be by using the ITEMIDLIST as Madshi pointed out.  However my method will work and is much less complicated.
0
 
LVL 10

Expert Comment

by:ptmcomp
ID: 1354863
I found another solution:

procedure TForm1.Button1Click(Sender: TObject);
var
  MyHomeDir, DialUpFolder: String;
begin
  MyHomeDir:=ExtractFilePath(ParamStr(0));
  DialUpFolder:=PChar(MyHomeDir+'Dial-Up Networking.{992CFFA0-F557-101A-88EC-00DD010CCC48}');
  if not DirectoryExists(DialUpFolder) then
    CreateDirectory(PChar(DialUpFolder), nil);  // Unit FileCtrl
  ShellExecute(Handle, 'explore', PChar(DialUpFolder), nil, nil, SW_Show); // Unit ShellApi
//  ShellExecute(Handle, 'open', PChar(DialUpFolder), nil, nil, SW_Show); // Unit ShellApi
end;

I hope that'll help you.
regards, ptm
0
 
LVL 5

Expert Comment

by:heathprovost
ID: 1354864
ptmcomp:  Your code creates a NEW directory in the directory the application started in.  It doesnt open the shell folder for DUN.  It also does not determine if DUN is installed.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1354865
Hmm, heathprovost, it works. But please tell me: Where did you learn this strange syntax???

BTW, you could shorten the sources to this:

function ExecuteDialup : boolean;
begin
  result:=WinExec(pchar('C:\WINDOWS\EXPLORER.EXE ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{992CFFA0-F557-101A-88EC-00DD010CCC48}'), SW_SHOWNORMAL)>31;
end;

Since the Guids are the same on every computer on every windows system, you can hardcode them...

ptm, nice hack, but IMHO heathprovost's code (respectively my version of it) it even a little bit nicer...  :-)

Regards, Madshi.
0
 
LVL 5

Expert Comment

by:heathprovost
ID: 1354866
Madshi, I know that the GUIDs are always the same.  The reason I didnt hardcode it is since not everyone has Dialup networking installed, Your code would have failed.  After thinking about it though, I feel stupid.  I should have just hardcoded it and then if the winexec call fails, I could have caught it there.  My mind must be wandering......

As for my strange syntax, at the moment I suffer for a deplorable condition called code confusion.  It occurs whenever you are writing 3 different programs in 3 different languages at the same time. :) lol
0
 
LVL 5

Expert Comment

by:heathprovost
ID: 1354867
qdyoung, you should DEFINITELY do it Madshi's way.  It is much less confusing.

Heath
0
 
LVL 5

Expert Comment

by:heathprovost
ID: 1354868
qdyoung, I would suggest the following change however:

function ExecuteDialup: boolean;
var
  WindowsDir: array [0..255] of char;
  ExplorerCmd: String;
begin
  GetWindowsDirectory(@WIndowsDir, 256);
  ExplorerCmd := String(WindowsDir) + '\' + 'EXPLORER.EXE';
  result:=WinExec(pchar(ExplorerCmd + ' ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{992CFFA0-F557-101A-88EC-00DD010CCC48}'), SW_SHOWNORMAL)>31;  
end;

This way you can be sure that it will work regardless of what directory windows (or windows NT) is installed in.

Heath
0
 
LVL 3

Expert Comment

by:williams2
ID: 1354869
Madshi: I ment, that I believe qdyoungs comment was the closest answer to this, I didn't make your code above to work either :-(

Cheers,
Williams
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1354870
heathprovost,

what about this:

function ExecuteDialup : boolean;
begin
  result:=WinExec(pchar('Explorer ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{992CFFA0-F557-101A-88EC-00DD010CCC48}'), SW_SHOWNORMAL)>31;
end;

Windows finds the explorer for us...  :-)))

With "strange syntax" I didn't mean your style of programming...  :-)
I meant this "::{}\::{}" syntax. I didn't find something like this in my win32.hlp file...

Hmmm. One problem with the shortened code. If the WinExec fails there comes a quite nasty windows error message. So perhaps we should add a second function called "function IsDialupInstalled : boolean" that just checks if the registry key "HKEY_CLASSES_ROOT\CLSID\{992CFFA0-F557-101A-88EC-00DD010CCC48}" exists. What do you think?

Another thing, ptm's code DOES work (I didn't test it, but I'm quite sure). He creates a Dialup directory in his application's root path AND THEN EXECUTES it. That will really open up the Dialup Folder. But nevertheless your code is nicer...

Regards, Madshi.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1354871
Williams, aha...   :-)
0
 
LVL 3

Expert Comment

by:williams2
ID: 1354872
Madshi, hehe... :-)
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1354873
Williams, hihi...  :-)
0
 
LVL 3

Expert Comment

by:williams2
ID: 1354874
Hmm... madshi your good'n'old hack coder :-), I get an error:

Windows Explorer:
The path ''Explorer ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{992CFFA0-F557-101A-88EC-00DD010CCC48}' does not exist or is not a directory.

Which OS does you run ?

Cheers,
Williams
0
 
LVL 5

Expert Comment

by:heathprovost
ID: 1354875
>>"what about this:

function ExecuteDialup : boolean;
begin
  result:=WinExec(pchar('Explorer ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{992CFFA0-F557-101A-88EC-00DD010CCC48}'), SW_SHOWNORMAL)>31;
end;
What about this"

Much better! :)

>>"With "strange syntax" I didn't mean your style of programming...  :-)
I meant this "::{}\::{}" syntax. I didn't find something like this in my win32.hlp file..."

This stuff is just from observation.  It isnt in the API reference.  If you create a shortcut to DUN and then look at the target in properties, you will see something like this:

C:\WINDOWS\EXPLORER.EXE ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{992CFFA0-F557-101A-88EC-00DD010CCC48}

I just copied the syntax.

>>"Hmmm. One problem with the shortened code. If the WinExec fails there comes a quite nasty windows error message. So perhaps we should add a second function called "function IsDialupInstalled : boolean" that just checks if the registry key "HKEY_CLASSES_ROOT\CLSID\{992CFFA0-F557-101A-88EC-00DD010CCC48}" exists. What do you think?"

I cant test because I have DUN installed and am not going to remove it (it is working and that is enough !)  But if Winexec cause error that is the way to go.

>>"Another thing, ptm's code DOES work (I didn't test it, but I'm quite sure). He creates a Dialup directory in his application's root path AND THEN EXECUTES it. That will really open up the Dialup Folder. But nevertheless your code is nicer..."

On my machine his code makes a folder called 'Dial-Up Networking', but there is nothing in it.  I dont understand how that would be of any help.  

Heath
0
 
LVL 5

Expert Comment

by:heathprovost
ID: 1354876
This is a clearer and better answer and includes Madshi's suggestions:

>>CODE STARTS
unit DUNStuff;

interface

uses
  Windows, Registry;

  function DunIsInstalled: boolean;
  function ExecuteDun : boolean;

const
  DunClassKey = 'CLSID\{992CFFA0-F557-101A-88EC-00DD010CCC48}';
  ExploreDunCmd = 'Explorer ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{992CFFA0-F557-101A-88EC-00DD010CCC48}';

implementation

function DunIsInstalled: boolean;
var
  Reg: TRegistry;
begin
  Reg := TRegistry.Create;
  Reg.RootKey := HKEY_CLASSES_ROOT;
  Result := Reg.KeyExists(DunClassKey);
  Reg.Free;
end;

function ExecuteDun : boolean;
begin
  Result := False;
  if DunIsInstalled then
    Result := WinExec(ExploreDunCmd, SW_SHOWNORMAL) > 31;
end;

end.
>>CODE ENDS

Just include this unit and call ExecuteDun.

Heath


0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1354877
hey great, you guys cleared it. Pitty I wasn't around :-(
0
 
LVL 3

Expert Comment

by:williams2
ID: 1354878
Hey Heath, I still can't get your code to work, it just fail on the command DunIsInstalled, but ok, maybe it's because I run Windows NT :-)

But just for the generel interest, I got this hack to work with NT4.0 ..

function TForm1.ExecuteDialup : Boolean;
var
  Reg: TRegistry;
  List: TStringList;
  Res,i: Integer;
  found: Boolean;
  S: String;
  pS: Array[0..MAX_PATH] of Char;
begin
  Result:= False;
  Reg:= TRegistry.Create;
  Reg.Rootkey:= HKEY_LOCAL_MACHINE;
  If Reg.OpenKey('SOFTWARE\Microsoft\Windows\CurrentVersion\explorer\mycomputer\NameSpace',false) then
  begin
    List:= TStringList.Create;
    Reg.GetKeyNames(List);
    i:= 0; found:= False;
    While (i<List.count) and not(found) do
    begin
      If List.Strings[i][1] = '{' then
      If Reg.OpenKey(List.Strings[i],false) then
      Begin
        Try
          found:= Reg.ReadString('') = 'Dial-Up Networking';
        Except
        End;
        Reg.CloseKey;
      End;
      if not(found) then inc(i);
    End;
    Reg.CloseKey;
    If found then
    If Reg.OpenKey('Software\Classes\CLSID\'+List.Strings[i]+'\shell\open\command',false) then
    begin
      S:= Reg.ReadString('');
      i:= pos('%SystemRoot%',S);
      If i>0 then
      Begin
        Delete(S,i,Length('%SystemRoot%'));
        GetWindowsDirectory(pS,MAX_PATH);
        Insert(StrPas(pS),S,i);
      End else
      Begin
        i:= pos('%SystemRoot%',S);
        If i>0 then
        Begin
          Delete(S,i,Length('%SystemRoot%'));
          GetWindowsDirectory(pS,MAX_PATH);
          Insert(StrPas(pS),S,i);
        End else
      End;
      res:=  ShellExecute(Handle,'open',pChar(S),nil,nil,SW_SHOWNORMAL);
      S:= '';
      Case Res of
        0: S:='The operating system is out of memory or resources.';
        ERROR_FILE_NOT_FOUND: S:='The specified file was not found.';
        ERROR_PATH_NOT_FOUND: S:='The specified path was not found.';
        ERROR_BAD_FORMAT: S:='The .EXE file is invalid (non-Win32 .EXE or error in .EXE image).';
        SE_ERR_ACCESSDENIED: S:='Windows 95 only: The operating system denied access to the specified file.';
        SE_ERR_ASSOCINCOMPLETE: S:='The filename association is incomplete or invalid.';
        SE_ERR_DDEBUSY: S:='The DDE transaction could not be completed because other DDE transactions were being processed.';
        SE_ERR_DDEFAIL: S:='The DDE transaction failed.';
        SE_ERR_DDETIMEOUT: S:='The DDE transaction could not be completed because the request timed out.';
        SE_ERR_DLLNOTFOUND: S:='Windows 95 only: The specified dynamic-link library was not found.';
        SE_ERR_NOASSOC: S:='There is no application associated with the given filename extension.';
        SE_ERR_SHARE: S:='A sharing violation occurred.';
      End;
      If S<>'' then
        ShowMessage(S)
      else
        Result:= True;
      Reg.CloseKey;
    End;
    List.free;
  End;
  reg.free;
end;

Regards,
Williams
0
 
LVL 5

Expert Comment

by:heathprovost
ID: 1354879
Ok Williams2, how about this:

unit DUNStuff;

interface

uses
  Windows, Registry;

  function DunIsInstalled: boolean;
  function ExecuteDun : boolean;

const
  DunClassKey = 'SOFTWARE\Microsoft\Windows\CurrentVersion\explorer\mycomputer\NameSpace\{992CFFA0-F557-101A-88EC-00DD010CCC48}';
  ExploreDunCmd = 'Explorer ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{992CFFA0-F557-101A-88EC-00DD010CCC48}';

implementation

function DunIsInstalled: boolean;
var
  Reg: TRegistry;
begin
  Reg := TRegistry.Create;
  Reg.RootKey := HKEY_LOCAL_MACHINE;
  Result := Reg.KeyExists(DunClassKey);
  Reg.Free;
end;

function ExecuteDun : boolean;
begin
  Result := False;
  if DunIsInstalled then
    Result := WinExec(ExploreDunCmd, SW_SHOWNORMAL) > 31;
end;

end.

This will work under NT and 95.  Also a bit simpler than yours. Although your errorcode is more robust, I would personally rather go the simple route.

BTW - This is fun!
0
 
LVL 5

Expert Comment

by:heathprovost
ID: 1354880
By the time we all finish with this one it will consist of 2 lines of assembler...........  :)
0
 
LVL 3

Expert Comment

by:williams2
ID: 1354881
hehehehehehehehe :-)
0
 
LVL 3

Expert Comment

by:williams2
ID: 1354882
Ahem heathprovost.. It still doesn't work. The keys doesn't exist in my registry. :-( (I though checked it with win98 and it worked fine) But on the other hand my example does not work in my version of windows 98 because the CLSID described as the 'dial-up networking' does not appear to exist anywhere else in the registry (why ?).

But you are right, this IS fun hehe

Cheers,
Williams
0
 
LVL 5

Expert Comment

by:heathprovost
ID: 1354883
OK, this WILL work on both Windows 95 and NT. I PROMISE.

unit DUNStuff;

interface

uses
  Windows, Registry;

  function DunIsInstalled: integer;
  function ExecuteDun : boolean;

const
  Win95DunClassKey = 'CLSID\{992CFFA0-F557-101A-88EC-00DD010CCC48}';
  WinNTDunClassKey = 'CLSID\{a4d92740-67cd-11cf-96f2-00aa00a11dd9}';
  Win95ExploreDunCmd = 'Explorer ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{992CFFA0-F557-101A-88EC-00DD010CCC48}';
  WinNTExploreDunCmd = 'RasPhone.exe';
implementation

function DunIsInstalled: integer;
var
  Reg: TRegistry;
begin
  Result := 0;
  Reg := TRegistry.Create;
  Reg.RootKey := HKEY_CLASSES_ROOT;
  If Reg.KeyExists(Win95DunClassKey) then
    Result := 1;
  If Reg.KeyExists(WinNTDunClassKey) then
    Result := 2;
  Reg.Free;
end;

function ExecuteDun: boolean;
var
  I: integer;
begin
  Result := False;
  I := DunIsInstalled;
  Case I of
    0: exit;
    1: Result := WinExec(Win95ExploreDunCmd, SW_SHOWNORMAL) > 31;
    2: Result := WinExec(WinNTExploreDunCmd, SW_SHOWNORMAL) > 31;
  end;
end;

end.

The reason the other stuff didnt work is because the shell interface of WIndows NT is different.  There is no folder object for DUN under NT.  The object refers back to an executable so the explorer command wont work with its GUID. The above code takes this into account and will work with both (at least currently).  I wont promise forward compatibility since NT's shell interface WILL change in the future (MS already has stated that it will be changed to be more like 98's).

Heath
0
 
LVL 5

Expert Comment

by:heathprovost
ID: 1354884
DAMN!!!!!! I broke it under 95/98. This fixes it FOR BOTH. I really promise this time.

unit DUNStuff;

interface

uses
  Windows, Registry;

  function DunIsInstalled: integer;
  function ExecuteDun : boolean;

const
  Win95DunClassKey = 'CLSID\{992CFFA0-F557-101A-88EC-00DD010CCC48}';
  WinNTDunClassKey = 'CLSID\{a4d92740-67cd-11cf-96f2-00aa00a11dd9}';
  Win95ExploreDunCmd = 'Explorer ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{992CFFA0-F557-101A-88EC-00DD010CCC48}';
  WinNTExploreDunCmd = 'RasPhone.exe';
implementation

function DunIsInstalled: integer;
var
  Reg: TRegistry;
  Version: TOSVersionInfo;
begin
  Result := VER_PLATFORM_WIN32s;
  Reg := TRegistry.Create;
  Reg.RootKey := HKEY_CLASSES_ROOT;
  Version.dwOSVersionInfoSize := SizeOf(Version);
  GetVersionEx(Version);
  if Version.dwPlatformId = VER_PLATFORM_WIN32_NT then
  begin
        If Reg.KeyExists(WinNTDunClassKey) then
          Result := VER_PLATFORM_WIN32_NT;
  end
  else
  begin
        if Version.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS then
              If Reg.KeyExists(Win95DunClassKey) then
                Result := VER_PLATFORM_WIN32_WINDOWS;
  end;
  Reg.Free;
end;

function ExecuteDun: boolean;
var
  I: integer;
begin
  Result := False;
  I := DunIsInstalled;
  Case I of
    VER_PLATFORM_WIN32s: exit;
            VER_PLATFORM_WIN32_NT: Result := WinExec(WinNTExploreDunCmd, SW_SHOWNORMAL) > 31;
    VER_PLATFORM_WIN32_WINDOWS: Result := WinExec(Win95ExploreDunCmd, SW_SHOWNORMAL) > 31;
  end;
end;

end.


It is getting tedious to boot back and forth.......
0
 
LVL 3

Expert Comment

by:williams2
ID: 1354885
hahahahaha, I guess you are a bit tired now

Now we are talking, it works allright :-) ..I promise you though I will report back when I install Windows 2000 in a few days hehe :-)

Regards,
Williams
0
 

Author Comment

by:qdyoung
ID: 1354886
Oh, so many experts. Maybe this site should add a function so that
I can share points to other participators.

Thanks.

Young
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi Spellcheck in Webbrowser 1 47
Delphi 2 77
tvirtualstringtree freeze when load too manny images 10 80
Drag & Drop... Data from one grid to another 2 47
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…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

756 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