Jump to content

@SW_HIDE not working.


bigred
 Share

Recommended Posts

Why is this not hiding the window? Actually come to think of it I don't think I've ever got the @SW_HIDE command to work. Is it intended for something else?

Is there anyone method for hiding a window?

This is a little script that turns off the power managment feature of my Dell D610's Ethernet adaptor, and then turns it back on.

AutoItSetOption ( "RunErrorsFatal", 1 )

$run = Run("Control.exe NicConfigSvc.Cpl", "C:\WINDOWS\system32", @SW_HIDE)
$winchk = WinWait("Internal Network Card Power Management", "", 5)
ControlCommand("Internal Network Card Power Management", "", "Button2", "Check", "")
ControlClick("Internal Network Card Power Management", "", "Button7")
ControlClick("Internal Network Card Power Management", "", "Button8")

Sleep (5000)

$run = Run("Control.exe NicConfigSvc.Cpl", "C:\WINDOWS\system32", @SW_HIDE)
$winchk = WinWait("Internal Network Card Power Management", "", 5)
ControlCommand("Internal Network Card Power Management", "", "Button1", "Check", "")
ControlClick("Internal Network Card Power Management", "", "Button7")
ControlClick("Internal Network Card Power Management", "", "Button8")

Exit
Link to comment
Share on other sites

  • Developers

Why is this not hiding the window? Actually come to think of it I don't think I've ever got the @SW_HIDE command to work. Is it intended for something else?

Is there anyone method for hiding a window?

Control.exe isn't the program that you see... thats rundll32.exe. Maybe this post helps? http://www.autoitscript.com/forum/index.ph...ndpost&p=125175

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Is this as good as I can make it?

On the frist 'run' the windows is not displayed at all, but the second time through after the sleep it is displayed for a few seconds.

Is there any other way to hide the window? Is my code ok?

AutoItSetOption ( "RunErrorsFatal", 1 )

Opt('WinWaitDelay', 10)
$run = Run("Control.exe NicConfigSvc.Cpl", "C:\WINDOWS\system32")
$winchk = WinWait("Internal Network Card Power Management", "", 5)
WinSetState("Internal Network Card Power Management", "", @SW_HIDE)
Opt('WinWaitDelay', 250)
ControlCommand("Internal Network Card Power Management", "", "Button2", "Check", "")
ControlClick("Internal Network Card Power Management", "", "Button7")
ControlClick("Internal Network Card Power Management", "", "Button8")

Sleep (5000)

Opt('WinWaitDelay', 10)
$run = Run("Control.exe NicConfigSvc.Cpl", "C:\WINDOWS\system32")
$winchk = WinWait("Internal Network Card Power Management", "", 5)
WinSetState("Internal Network Card Power Management", "", @SW_HIDE)
Opt('WinWaitDelay', 250)
ControlCommand("Internal Network Card Power Management", "", "Button1", "Check", "")
ControlClick("Internal Network Card Power Management", "", "Button7")
ControlClick("Internal Network Card Power Management", "", "Button8")

Exit
Link to comment
Share on other sites

Does this work any better? --

Opt('RunErrorsFatal', 1)
Opt('WinWaitDelay', 0)

Local Const $Title = 'Internal Network Card Power Management'

Run('Control NicConfigSvc.Cpl', @SystemDir)
WinWait($Title)
WinSetState($Title, '', @SW_HIDE)
ControlCommand($Title, '', 'Button2', 'Check')
ControlClick($Title, '', 'Button7')
ControlClick($Title, '', 'Button8')
WinWaitClose($Title)

Run('Control NicConfigSvc.Cpl', @SystemDir)
WinWait($Title)
WinSetState($Title, '', @SW_HIDE)
ControlCommand($Title, '', 'Button1', 'Check')
ControlClick($Title, '', 'Button7')
ControlClick($Title, '', 'Button8')

Exit
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...