Shell.Application.Count or Shell.Application.Contents.Count 
Author Message
 Shell.Application.Count or Shell.Application.Contents.Count

I am looking at the Shell.Application object, and I can't
seem to find any help on it beside the following link:

http://www.*-*-*.com/
url=/library/en-
us/shellcc/platform/Shell/Objects/Shell/Application.asp

I have tried to find help on this such Application object
and the only one I have found that closely resembles it is
the Application object here:

http://www.*-*-*.com/
url=/library/en-us/iisref/html/psdk/asp/vbob8zw4.asp

In the latter of the two links, there is a contents
property for the Application object.  In the previous, I
believe the is a count.  The count property is in the
contents collection for the latter.  Either one I choose
to use doesn't work.  It come up with an error saying it
doesn't want to work, the following code is what i am
using:

<script language="VBScript">
  Dim oTest, oIE
  Set oTest = getInstance()
  Function getInstance()
    Dim oWin, oShellApp, intCtr, colWins
        oWin = Null
        Set oShellApp = CreateObject("Shell.Application")
        set colWins = oShellApp.Contents

        For intCtr = 0 to colWins.Count
          Set oWin = colWins.Contents(i)
          If (oWin.Document.ParentWindow = Me) Then
            oIE = oWin
                Set getInstance = oIE
          End If
        Next

        Set getInstance = Null
  End function
</script>

Please help...

Mythran



Tue, 08 Jun 2004 02:59:46 GMT  
 Shell.Application.Count or Shell.Application.Contents.Count
The Shell.Application object is totally unrelated to the ASP Application object, just as the Word.Application object has nothing to do with an Excel.Application object.

The collection you are after in the Windows collection, not Contents.  And what you are doing requires users to allow use of unsafe activex components (or actually an unsafe interface in this case).

--
Michael Harris
Microsoft.MVP.Scripting
--

Quote:

> I am looking at the Shell.Application object, and I can't
> seem to find any help on it beside the following link:

> http://msdn.microsoft.com/library/default.asp?
> url=/library/en-
> us/shellcc/platform/Shell/Objects/Shell/Application.asp

> I have tried to find help on this such Application object
> and the only one I have found that closely resembles it is
> the Application object here:

> http://msdn.microsoft.com/library/default.asp?
> url=/library/en-us/iisref/html/psdk/asp/vbob8zw4.asp

> In the latter of the two links, there is a contents
> property for the Application object.  In the previous, I
> believe the is a count.  The count property is in the
> contents collection for the latter.  Either one I choose
> to use doesn't work.  It come up with an error saying it
> doesn't want to work, the following code is what i am
> using:

> <script language="VBScript">
>   Dim oTest, oIE
>   Set oTest = getInstance()
>   Function getInstance()
>     Dim oWin, oShellApp, intCtr, colWins
> oWin = Null
> Set oShellApp = CreateObject("Shell.Application")
> set colWins = oShellApp.Contents

> For intCtr = 0 to colWins.Count
>   Set oWin = colWins.Contents(i)
>   If (oWin.Document.ParentWindow = Me) Then
>     oIE = oWin
> Set getInstance = oIE
>   End If
> Next

> Set getInstance = Null
>   End function
> </script>

> Please help...

> Mythran



Tue, 08 Jun 2004 03:36:32 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. FSO.CopyFolder works differently than Shell.Application.Namespace.CopyHere

2. WScript.Shell vs Shell.Application

3. How do I get Shell.Application to work in NT 4.0

4. Running NT shell commands from an HTML Application

5. Shell Function not shelling under Windows NT.

6. Shell & Shell Execute under NT

7. Shell.Application problem

8. shell.application does not exist in NT4?

9. Shell.application

10. shell.application

11. Help - shell.application Examples

12. Shell.Application object bug on Windows ME

 

 
Powered by phpBB® Forum Software