CShell.DLL - FREE Windows Shell APIl utility .DLL 
Author Message
 CShell.DLL - FREE Windows Shell APIl utility .DLL

Read the below text, and if you would like a free copy of this DLL
(along with complete source code, test project, and .HLP file

"CShell Project" in the Subject field.

                --------  CShell.DLL, version 1.0 ----------

Copyright (c) 1998 by Pirate Pete's Software Emporium

Usage Rights
------------
User is hereby granted full access and usage rights to this
.DLL and its code.  No restrictions apply.  Use it freely,
but if you use it in something commercial, please give credit
where credit is due.

Disclaimer
----------
Neither Pirate Pete's Software Emporium, nor any of its officers,
employees or agents, shall be held liable for damages that may be
caused by the use or misuse of this product.  

Rationale and Purpose
---------------------
As anyone who has ever tried his hand programming Visual Basic
using the Windows API knows, the process tends to be extremely
time consuming and often frustrating.  Yet, for all of the
headaches involved, power programming with the Windows API is
one of the most mentally stimulating and emotionally rewarding
things you can do.  There's nothing quite like the satisfaction
you get when you implement a function to give your program a
little extra pizzazz.

For some time now, I've been toying with the idea of creating an
ActiveX .DLL to encapsulate a few of the more difficult Windows
API functions to be used with Visual Basic 5.0.  This project
meets that goal.  

CShell offers the following properties & methods:

        AddToRecentDocs         Adds a document to the list of recent
                                documents (Click Start/Documents to see
                                list).

        AddPath                 Appends a filename to a pathname to
                                form a fully-pathed file specification.

        AppTime                 Computes total time in seconds an
                                application has been running, assuming
                                app was called by either the .Execute
                                or .ShellExecuteEx method.

        AppWasInstanced         Returns TRUE if an application was
                                executed properly with either the .Execute
                                or .ShellExecuteEx methods

        ASCIIZ                  Converts a C-style string to a Visual
                                Basic string by stripping off the byte of
                                zeros at the end.

        AssociatedRunCommand    Returns the handler for a given file
                                extension or one of the following prefixes:
                                "http:", "file:", "ftp:", "gopher:",

        Cancel                  Terminates the wait loop in
                                .WaitUntilAppCloses method

        CloseApp                Terminates application that was
                                initiated by a call to either .Execute
                                or .ShellExecuteEx methods

        CommandLine             Returns complete comand line string that
                                was used to execute an application via
                                either the .Execute or .ShellExecuteEx
                                method.

        CVLBigEndian            Converts a 4-byte "big endian" double
                                word string value into a long integer.  
                                Big endian numbers are stored in MSB/LSB
                                format.

        CVLLittleEndian         Converts a 4-byte "little endian" double
                                word string value into a long integer.
                                Little endian numbers are stored in
                                LSB/MSB format (standard Intel format).

        Execute                 Executes an external application and
                                makes its hWnd property available.

        Exists                  Returns TRUE if the specified file
                                exists

        Ext                     Returns the file extension portion
                                of a filename.

        FileDOSAttributes       Returns DOS file attributes for a given file.

        FileIcon                Returns a handle to icon associated with a
                                given file.

        FileIconIndex   Returns the icon index number associated with a
                                given file.

        FileIconName    Use this property to return the icon filename of
                                a shortcut.  If the filename represents a shortcut
                                that uses the default icon for an application,
                        this property returns an empty string.
                        If user changed the default icon for a shortcut,
                        this property returns the name of the file which
                        contains the selected icon; FileIconIndex can be
                        used to obtain the icon index within that
                        file.

        FileSize                Returns the size of a file, in bytes

        FileSizeKB              Returns the size of a file, in Kilobytes

        FileTypeName    returns the Windows 95 Explorer "type name"
                                for a given file (e.g., "Visual Basic Group
                                Project").

        FileWIN95Attributes
                                returns Windows 95 Explorer attributes
                          for a given file.

        FindDir                 Calls up a common Windows95 style
                                treeview dialog for selecting a
                                directory.

        FindFile                Brings up Common Dialog "Open File"
                                box.  File user selects DOESN'T have
                                to exist.

        FindFileExist           Brings up Common Dialog "Open File" box.  
                                File user selects must exist.

        FindFilesExist          Brings up Common Dialog "Open File" box.  
                                User can select one or multiple files.
                                Files user selects must exist.

        GetSpecialFolder        Retrieves the name (and optionally the
                                Item ID list returned by WinShell API)
                                of one of the special system folder
                                objects (e.g., "Desktop").

        GetTitle                Returns the title of the application
                                window which was executed using either
                                the .Execute or .ShellExecuteEx methods.

        hProcess                Returns the "process handle" generated by
                                Visual Basic's "Shell" function, which is
                                used when executing apps via CShell's
                                .Execute method or .ShellExecuteEx methods.
                                The hProcess property can be used in
                                conjunction with OpenProcess and
                                CreateProcess Windows API calls.

        hProcessId              Returns the "process id" value
                                generated by a call to Windows API
                                "OpenProcess", which gets called by
                                executing apps via CShell's .Execute
                                method or .ShellExecuteEx method.
                                Use this property wherever a Windows
                                API requires an "hProcessId" property.

        hWnd                    Returns the hWnd property of an
                                application that was executed using
                                either the .Execute or .ShellExecuteEx
                                methods.  Many Windows API functions
                                require a property called "hWnd" --
                                this is the window "handle", a 32-bit
                                value used internally by Windows
                                to identify each window object.  C++
                                Windows programmers are intimately
                                familiar with the term, and are equally
                                familiar with how to access the property
                                when then need it.  Visual Basic programmers
                                have access to the hWnd property of
                                forms and controls which they
                                generate, but will find it much more
                                difficult to access the hWnd property
                                for non-VB applications, such as Notepad.Exe.  
                                This is the primary rationale behind
                                CShell.DLL

        HwndFromShell           Returns an application's primary Window
                                handle from the process handle returned
                                by the Shell function used to execute
                                the application.

        LongFilename            Converts a DOS 8.3 FILENAME to a Win95
                                LONG FILENAME.

        NewExt                  Strips off a file's old file extension
                                (if any) and replace it with a new one.

        ParsePath               Separates the path portion of a file
                                specification from the filename portion.

        RegStringValue          Returns the value of a Windows Registry key.

        ReplaceString           Replaces all occurrence of one substring
                                with another in a string.

        SaveFileName            Displays the common dialog's "Save" box,
                                which allows user to select name of
                                file to be saved.  Displays warning
                                message if file already exists.

        SetTitle                Sets the title of the application
                                window which was executed using either
                                the .Execute or .ShellExecuteEx methods.

        ShellExecuteEx          Emulates Windows API "ShellExecute", with
                                added functionality.

        ShortFilename           Converts Win95 LONG FILENAME a to a
                                DOS 8.3 FILENAME.

        Sleep                   Suspends execution of the currently
                                executing thread for given period of
                                time.

        VolumeId                Returns the volume id of a drive, if one
                                exists.

        WaitUntilAppCloses      Use after .Execute method to ensure
                                asynchronous processing of an application.  
                                This subroutine will wait for one of two
                                events to occur:  a) The application which
                                was opened using either the .Execute
                                or .ShellExecuteEx method terminates,
                                or b) The .Cancel method is executed.

Each function is well documented within the file "clsShell.cls", and
also within CShell.Hlp, included with the package.

Instructions for using the package
----------------------------------
After you download CShell.ZIP, unpack it in its own directory
(E.g., "C:\CShell") and run the associated setup procedure.  After
CShell.DLL is installed, you may begin using it on one of your
projects by clicking "Project/References"; find and select
"CShell - Wrapper DLL for extended ShellAPI functions".  In
your code, you can declare a new instance of CShell's
class, clsShell, like so:

        Dim myShell as New clsShell

Then, you access clsShell's properties and methods using
the dot (.) operator, like so:

        myShell.ReplaceString "test", "happy", x

Alternatively, since clsShell is declared as "Global Multiuse",
you can simply type in the name of the function you want as long
as CExec.Dll is included in your project's references:

        ReplaceString "test", "happy", x    

If you have additional questions, you may contact me at:


web:     http://www.*-*-*.com/ ~voltz/prog.htm
snail:  204 N. 8th St.
        Martins Ferry, OH  43935

If you find this .DLL useful, please send me a note to that

snail mail at:

     Jack Voltz
     204 N. 8th St.
     Martins Ferry, OH  43935

                  :)  Pirate Pete the Christian Privateer  :)
                  :)             aka Jack Voltz            :)
                  :)      M  A  R  A  N  A  T  H  A  !     :)


                  Web page:   http://www.*-*-*.com/ ~voltz
              Prolife page:   http://www.*-*-*.com/ ~voltz/prolife.htm
                     Music: http://www.*-*-*.com/ ~voltz/music.htm



Tue, 05 Dec 2000 03:00:00 GMT  
 CShell.DLL - FREE Windows Shell APIl utility .DLL



Quote:
>Copyright (c) 1998 by Pirate Pete's Software Emporium

If you are really legit, I'd suggest you change your company name...
It implies illegal activity, which I'm sure you don't want...?

Quote:
>As anyone who has ever tried his hand programming Visual Basic
>using the Windows API knows, the process tends to be extremely
>time consuming and often frustrating.  Yet, for all of the
>headaches involved, power programming with the Windows API is
>one of the most mentally stimulating and emotionally rewarding
>things you can do.  There's nothing quite like the satisfaction
>you get when you implement a function to give your program a
>little extra pizzazz.

I've found that API programming also has lots of problems when you
assume that a .dll file is on the user's computer but isn't. For
instance, I use KERNEL32.DLL in my VB 3.0 Long file name API calls and
folks runing WinNT can't use it. :( I try to avoid using API if at all
possible, unless I can be sure that the .dll that has the call will be
on everyone's system.

Quote:
>    AddPath                 Appends a filename to a pathname to
>                            form a fully-pathed file specification.

Just add two strings together. I do that successfully without APIs.

Quote:
>    ASCIIZ                  Converts a C-style string to a Visual
>                            Basic string by stripping off the byte of
>                            zeros at the end.

Can do that by using left$ and len().

Quote:
>    Exists                  Returns TRUE if the specified file
>                            exists

I have a non-api function that will do this. Also working on a
function that splits path names up into drive, path and filename.
These can be done easily without API.

Quote:
>    Ext                     Returns the file extension portion
>                            of a filename.

Can do that by using Instr to search for "." and right$ to get the
rest of the string.

Quote:
>    LongFilename            Converts a DOS 8.3 FILENAME to a Win95
>                            LONG FILENAME.

I have VB 3.0 API calls that do this, but as mentioned, WinNT users
can't use them (they get "permission denied" when trying to run the
program).

Quote:
>    NewExt                  Strips off a file's old file extension
>                            (if any) and replace it with a new one.

Can be done easily with Instr and string concatenation.

Quote:
>    ParsePath               Separates the path portion of a file
>                            specification from the filename portion.

I've had a working split path function that does this.

Quote:
>    ShortFilename           Converts Win95 LONG FILENAME a to a
>                            DOS 8.3 FILENAME.

see above regarding my VB 3.0 long file name API calls.

All in all most of what you describe would be useful though. Would
like one to create a .lnk to a program in the Start Menu too, but I
think VB 5's setup kit can do that (though I'd like to find an API
call that uses a .DLL that is on every system. One I found is only
provided with VB 4.0 which not everyone would have (myself included))

Quote:
>                  :)  Pirate Pete the Christian Privateer  :)
>                  :)             aka Jack Voltz            :)
>                  :)      M  A  R  A  N  A  T  H  A  !     :)

Not to be offending, but this seems like an oxymoron. :) Most
associate "Pirate" with theft and "Christian" with honesty. Might want
to make that Cap'n Pete's? :) Just a suggestion - it's your thing
though. But personally, I steer away from anything that says "Pirate"
or "warez" in it.

Phantom
====================================================
The Tube Garden: http://members.xoom.com/TubeGarden/
Phantom: http://www.frontiernet.net/~phantom7/
E-Mail easy to figure out from Phantom URL.



Tue, 05 Dec 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. CExec.DLL - FREE utility to encapsulate a few difficult Windows API calls

2. CShell DLL project

3. DLL DLL DLL DLL DLL DLL

4. free OCR dll for Windows?

5. NView.dll - a free dll that converts bmp to jpeg

6. VB6 DLLs and Windows 2000 DLLs

7. LogonUser API call in Windows 95/98 / How do you use Secur32.dll/Security.dll

8. LogonUser API call in Windows 95/98 / How do you use Secur32.dll/Security.dll

9. File missing for Utility Add-in? (MSAU8032.DLL)

10. * Utility for DLL's?

11. Utility for DLL's?

12. DLL Utility

 

 
Powered by phpBB® Forum Software