khidotdn

Please check service code windows

5 posts in this topic

I would like to help on code check windows service , shown on the button. If it is disabled , the button serive out Enable and click Enable , then it displays Disable. Enable Service is also always . Thank you for your help

Share this post


Link to post
Share on other sites



Welcome to AutoIt and the forum!
Can you please show us what you have tried so far?

1 person likes this

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

@khidotdn, welcome to the forum. As water mentions, we try to adhere to the "teach a man to fish" motto. I do have the following snippet I use, however, that at least gets you started. You can change the $sService variable to the name of the service you're looking for.

$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$sService = "Application Identity"

$oWMI = ObjGet("winmgmts:\\.\root\cimv2")
$oItems = $oWMI.ExecQuery("SELECT * FROM Win32_Service", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

    If IsObj($oItems) Then
       For $oService In $oItems
           If $oService.DisplayName = $sService Then
               ConsoleWrite($oService.DisplayName & " | " & $oService.StartMode & @CRLF)
           EndIf
       Next
    EndIf

From here, I would suggest you take some time to read through the help file to create your GUI. Below is a simple framework that will get you started. I'll leave it to you to learn how to add your own button (look at GUICtrlCreateButton in the help file) and put the code together:

#include <GUIConstantsEx.au3>

    $hGUI = GUICreate("Test", 300, 300)
        GUISetState(@SW_SHOW)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                Exit
        EndSwitch
    WEnd

Once you have done some reading, and tried some things out on your own, feel free to post your code here if you run into issues. We will do our best to assist.

1 person likes this

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
 
I just do Autoit apprentice , you can give me a code ? so I can study on that platform ? Thank you

Share this post


Link to post
Share on other sites

@khidotdn, simply put - no. This forum is not a place where you put in a request and someone barfs up the code for you. You have been given more than enough to begin. How about you begin showing some effort?

1 person likes this

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
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