Recent

Author Topic: Windows Explorer [All Drives View] - How to start the COMPUTER view ?  (Read 272 times)

RAW

  • Hero Member
  • *****
  • Posts: 867
Can anybody explain how to start the Windows-Explorer with COMPUTER-View (ALL DRIVES)?

Drive C:
Code: Pascal  [Select][+][-]
  1. ShellExecute(0,Nil,PChar('C:\'),Nil,Nil,SW_SHOWNORMAL);

Program Drive (EXE)
Code: Pascal  [Select][+][-]
  1. ShellExecute(0,Nil,PChar(''),Nil,Nil,SW_SHOWNORMAL);

Library
Code: Pascal  [Select][+][-]
  1. ShellExecute(0,Nil,'EXPLORER.EXE','',Nil,SW_SHOWNORMAL);

Own documents with treeview
Code: Pascal  [Select][+][-]
  1. ShellExecute(0,Nil,'EXPLORER.EXE','/E',Nil,SW_SHOWNORMAL);

Own documents folder only
Code: Pascal  [Select][+][-]
  1. ShellExecute(0,Nil,'EXPLORER.EXE','/',Nil,SW_SHOWNORMAL);


I don't know what I need to see all the drives ...
Windows 7 Pro (x64 Sp1) And Windows XP Pro (x86 Sp3) - LAZARUS 2.0.8 FPC 3.0.4 - TRUNK 2.1.0 FPC 3.3.1
// This is polarity (hell) and hell is reigned by lies, nothing but lies. Be careful what you believe ...
// There are 10 types of people in this world, those who understand mind control and ...

ASerge

  • Hero Member
  • *****
  • Posts: 1680
Code: Pascal  [Select][+][-]
  1.   ShellExecute(0, nil, 'explorer.exe', 'shell:MyComputerFolder', nil, SW_SHOW);

RAW

  • Hero Member
  • *****
  • Posts: 867
@ASerge:
Thank you very much! Works like a charm ...  :)

Code: Pascal  [Select][+][-]
  1. PROGRAM WINEX3;
  2. {$MODE DELPHI}
  3. USES Windows,Classes,SysUtils,ShellApi;
  4. VAR StrList:TStringlist;
  5.  
  6. Function SearchWndCallback(dwWND:DWORD;liParam:LongInt):BOOL;StdCall;
  7. Var arrChar: Array[0..255] Of Char;
  8. Begin
  9.   Result:= False;
  10.   If GetClassName(dwWND,arrChar,255) <> 0
  11.   Then
  12.    Begin
  13.     If Pos('CabinetWClass',String(arrChar)) <> 0
  14.     Then StrList.Add(IntToStr(dwWND));
  15.     Result:= True;
  16.    End;
  17. End;
  18.  
  19. Procedure MinAllWnds;
  20. Begin
  21.   Keybd_Event(VK_LWIN,0,0,0);
  22.   Keybd_Event(Byte('M'),0,0,0);
  23.   Keybd_Event(Byte('M'),0,KEYEVENTF_KEYUP,0);
  24.   Keybd_Event(VK_LWIN,0,KEYEVENTF_KEYUP,0);
  25. End;
  26.  
  27. Procedure StartEx;
  28. Var strDir:String;R:TRect;
  29. Begin
  30.   If DirectoryExists('I:\')
  31.   Then strDir:= 'I:\'
  32.   Else strDir:= 'D:\';
  33.   ShellExecute(0,Nil,'EXPLORER.EXE','SHELL:MyComputerFolder',Nil,SW_SHOW);
  34.   ShellExecute(0,Nil,PChar(strDir),Nil,Nil,SW_SHOW);
  35.   ShellExecute(0,Nil,PChar('C:\'),Nil,Nil,SW_SHOW);
  36.   Repeat
  37.    StrList.Clear;
  38.    EnumWindows(@SearchWndCallback,0);
  39.   Until StrList.Count >= 3;
  40.   SystemParametersInfo(SPI_GETWORKAREA,0,@R,0);
  41.   MoveWindow(StrToInt(StrList[0]),R.Left,R.Top,R.Right,R.Top+243,True);
  42.   MoveWindow(StrToInt(StrList[1]),R.Left,R.Top+243,
  43.    ((R.Right-R.Left) Div 2),(R.Bottom-R.Top-243),True);
  44.   MoveWindow(StrToInt(StrList[2]),((R.Right-R.Left) Div 2),
  45.    R.Top+243,((R.Right-R.Left) Div 2),(R.Bottom-R.Top-243),True);
  46. End;
  47.  
  48. BEGIN
  49.   StrList:= TStringlist.Create;
  50.   Try
  51.    MinAllWnds;
  52.    StartEx;
  53.   Finally
  54.    StrList.Free;
  55.   End;
  56. END.
Windows 7 Pro (x64 Sp1) And Windows XP Pro (x86 Sp3) - LAZARUS 2.0.8 FPC 3.0.4 - TRUNK 2.1.0 FPC 3.3.1
// This is polarity (hell) and hell is reigned by lies, nothing but lies. Be careful what you believe ...
// There are 10 types of people in this world, those who understand mind control and ...

 

TinyPortal © 2005-2018