Jump to content

"Object" method to toggle desktop?


qwert
 Share

Recommended Posts

MSDN prescribes the following as a VB script to toggle the desktop:

dim objShell  
  set objShell = CreateObject("shell.application")
      objShell.ToggleDesktop
  set objShell = nothing

I'd like to replicate this in Au3 ... but don't see things beyond the obvious first step:

Global $objShell = ObjCreate("Shell.Application")

Beyond seeing them in a few example scripts, I have no experience with objects ... and haven't been able to garner anything from the two examples in Help.  Would someone mind showing me how to fashion this into a callable function?

Thanks for any help.

 

 

Link to comment
Share on other sites

Global $objShell = ObjCreate("Shell.Application")
       $objShell.ToggleDesktop

 

the last line in your example just sets the variable back to nothing, which is unnecessary

Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

I have partly answered my own questions.  I happened upon the section in the help file on the introduction to COM extensions ... "objects".

On the first line we create a new object called "shell.application". This is an internal Windows object, defined in shell32.dll. The pointer to this new object is assigned to the variable $oShell. $oShell is from now on an Object variable.

It seems to be "create once, use many".  I'll test that in my script.  It also says "no need to delete an object ... Au3 does so upon exit".

 

Link to comment
Share on other sites

The only consideration I can think of would be not throwing it in a never ending while loop.

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...