Shell32.Dll - Excel Help & Excel Macro Help
SEARCH ENTIRE SITE LOADING..

Excel Help & Excel Best Practices Forums

 

Proudly Affiliated With: Intelligent Converters & AnalyserXL <Affiliate Program & ExcelUser Affiliate>

 

SPECIALS PAGE FOR BARGAINS | FREE EXCEL TRAINING | FREE CUSTOM FUNCTIONS ADD-IN


Go Back Excel Help & Excel Macro Help > TIP, TRICKS & CODE (NO QUESTIONS) > OPEN SOURCE: Hey! That is Cool!
HOME Register Forum Help Calendar Search For Today's Posts Mark Forums Read

Reply

Shell32.Dll



Javascript DHTML Drop Down Menu Powered by dhtml-menu-builder.com

Create Excel dashboards quickly with Plug-N-Play reports.


 
Thread Tools Search this Thread
Old April 6th, 2003
Ivan F Moala's Avatar
Ivan F Moala Ivan F Moala is offline
Established Member
 
I'm a Spammer: NO
MS Office Version: 2003 English
Op System: Windows XP
Assumed Experience: What's Excel?
Join Date: 27th January 2003
English is 1st Language: Yes
Location: Auckland, New Zealand
Posts: 396 -- Threads: 6
In this thread http://ozgrid.com/forum/viewthread.php?tid=1783 AJW references the VBS for copying files.

Thanks AJW, you have prompted me to TRY and finish one of my Site pages on this DLL....


What AJW has really found is the power of the Windows Core DLLs,
specifically the Shell32.Dll of which one of it's primary responsibilities is
managing and providing access to the wide variety of objects that make up the system
eg. Network printers, Other networked computers, Control Panel applications, The Recycle Bin etc.

The Shell object represents the objects in the Windows Shell.
You can use the methods exposed by the Shell object to:
Open, explore, and browse for folders.(See below)
Minimize, restore, cascade, or tile open windows.
Launch Control Panel applications.
Display system dialog boxes (The copy routine)

This DLL is referenced in AJW's code via this statement;

Set objShell = CreateObject("Shell.Application")

The code doesn't need to be executed via VBS, VBA or any Scripting language that
supports COM will do the job. eg Java
Also the Native VBA code will do it.

Most of the programming elements in the Shell and common controls are contained in three DLLs;
Comctl32.dll
Shell32.dll
and Shlwapi.dll. (Shell light weight API)

You should be mindful of the Shell version because of ongoing enhancements, different versions
of these DLLs implement different features.

Version DLL Distribution Platform
4.0 All Microsoft® Windows® 95/Microsoft Windows NT® 4.0.
4.7 All Microsoft Internet Explorer 3.x.
4.71 All Internet Explorer 4.0.
4.72 All Internet Explorer 4.01 and Windows 98.
5.0 Shlwapi.dll Internet Explorer 5.
6.0 Shlwapi.dll Internet Explorer 6 and Windows XP.
5.0 Shell32.dll Windows 2000 and Windows Millennium Edition (Windows Me).
6.0 Shell32.dll Windows XP.
5.8 Comctl32.dll Internet Explorer 5.
5.81 Comctl32.dll Windows 2000 and Windows Me.
6.0 Comctl32.dll Windows XP.

I am currently doing a write up on these powerful core DLLs of which the Shell32.Dll is one.

[One Example here for Now ]

http://www.xcelfiles.com/Shell32_01.html


Here is just a few examples of what you CAN DO, I'll leave the detailed explaination @ my site when finished.

VB: AutoLinked keywords will cause extra spaces before keywords. Extra spacing is NOT transferred when copy/pasting, but IS if the keyword uses "quotes".
Option Explicit '// Requires DLL version shell32.dll version 4.71 or later '// Operating systems '// Win2000, WinNT 4.0 with Internet Explorer*4.0, Win98, Win95 with Internet Explorer*4.0 'Item Identifiers and Identifier Lists 'The Shell uses object identifiers within the Shell's namespace. 'All objects visible in the Shell (files, directories, servers, workgroups, and so on) 'have unique identifiers among the objects within their parent folder. 'These identifiers are called item identifiers, and they have the SHITEMID data type 'as defined in the Shtypes.h header file. An item identifier is a variable-length byte 'stream that contains information that identifies an object within a folder. 'Only the creator of an item identifier knows the content and format of the identifier. 'The only part of an item identifier that the Shell uses is the first two bytes, 'which specify the size of the identifier. 'Each parent folder has its own item identifier that identifies it within its own parent folder. 'Thus, any Shell object can be uniquely identified by a list of item identifiers. 'A parent folder keeps a list of identifiers for the items it contains. 'The list has the ITEMIDLIST data type. Item identifier lists are allocated by the Shell 'and may be passed across Shell interfaces, such as IShellFolder. It is important to remember 'that each identifier in an item identifier list is only meaningful within the context of its parent folder. 'An application can set a shortcut's item identifier list by using the SetIDList method. 'This method is useful when setting a shortcut to an object that is not a file, such as 'a printer or disk drive. An application can retrieve a shortcut's item identifier list 'by using the GetIDList method. 'What is a PIDL? Why not just use file system paths? 'A PIDL (Program ID list) is a way of identifying any namespace object. 'You can also use paths to identify namespace objects, but only if they are part of 'the file system. With namespace objects that are not part of the file system, you must use PIDLs. Private Const BIF_BROWSEFORCOMPUTER = &H1000 Private Const BIF_BROWSEFORPRINTER = &H2000 Private Const BIF_BROWSEINCLUDEFILES = &H4000 Private Const BIF_BROWSEINCLUDEURLS = &H80 Private Const BIF_DONTGOBELOWDOMAIN = &H2 Private Const BIF_EDITBOX = &H10 Private Const BIF_NEWDIALOGSTYLE = &H40 Private Const BIF_RETURNFSANCESTORS = &H8 Private Const BIF_RETURNONLYFSDIRS = &H1 Private Const BIF_SHAREABLE = &H8000 Private Const BIF_STATUSTEXT = &H4 Private Const BIF_USENEWUI = &H40 Private Const BIF_VALIDATE = &H20 Sub BrowseForFolderShell() '//Minimum DLL version shell32.dll version 4.71 or later '//Minimum operating systems Windows*2000, Windows NT 4.0 with Internet Explorer*4.0, '//Windows*98, Windows 95 with Internet Explorer*4.0 Dim objShell As Object Dim objFolder As Object Dim strFolderFullPath As String Set objShell = CreateObject("Shell.Application") 'oFolder = Shell.BrowseForFolder(Hwnd, sTitle, iOptions [, vRootFolder]) Set objFolder = objShell.BrowseForFolder(0, "Please select a folder", BIF_NEWDIALOGSTYLE Or BIF_USENEWUI, SpecFolders.CSIDL_PERSONAL) 'SpecFolders.CSIDL_FAVORITES If (Not objFolder Is Nothing) Then '// NB: If SpecFolder= 0 = Desktop then .... On Error Resume Next If IsError(objFolder.Items.Item.path) Then strFolderFullPath = CStr(objFolder): Goto GotIt On Error Goto 0 '// Is it the Root Dir?...if so change If Len(objFolder.Items.Item.path) > 3 Then strFolderFullPath = objFolder.Items.Item.path & Application.PathSeparator Else strFolderFullPath = objFolder.Items.Item.path End If Else MsgBox "User cancelled": Goto Xit End If GotIt: MsgBox "You selected:= " & strFolderFullPath, vbInformation, "ObjectFolder:= " & objFolder Xit: Set objFolder = Nothing Set objShell = Nothing End Sub
__________________
Kind Regards,
Ivan F Moala From the City of Sails

http://www.xcelfiles.com
Print [Post / Thread] Reply With Quote
Reply Lifetime Upgrade To Ad Free Styles

   « PREVIOUS My Controls || Working With Folders using VB Script - Rating: Advanced NEXT »
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +9. The time now is 10:07.


Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ozgrid is Not Associated With Microsoft. Ozgrid Retains the Rights to ALL Posts and Threads