Jump to content

Recommended Posts

Posted (edited)

In the following topic:

 

is discusion about using:

_WinAPI_SetThreadExecutionState()

 

I want to focus on HelpFile Remarks for this function:

 

  On 10/11/2018 at 2:11 PM, Danyfirex said:

Remarks say: This function does not stop the screen saver from executing.

Expand  

Microsoft Docs  say:

  Quote

The SetThreadExecutionState function cannot be used to prevent the user from putting the computer to sleep. Applications should respect that the user expects a certain behavior when they close the lid on their laptop or press the power button.

Expand  

On my understanging this shoud be stated like this:

  Quote

The SetThreadExecutionState function should not be used by developer to intentionally prevent the windows end user from putting the computer to sleep. Applications should respect that the user expects a certain behavior when they close the lid on their laptop or press the power button.

Expand  

I think the same about change in AutoIt HelpFile :
This function should not does be used by AutoIt user, to prevent windows end user from putting the computer to sleep.
instead:
The _WinAPI_SetThreadExecutionState() function cannot be used to prevent the user from putting the computer to sleep.

And: "This function does not stop the screen saver from executing." should be removed from HelpFile as this is not true on my Win10Pro ( btw. could somebody test and confirm the same behavior on another windows version ? )

What is your's opinion ?

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)
  On 10/12/2018 at 7:42 PM, mLipok said:

The _WinAPI_SetThreadExecutionState() function cannot be used to prevent the user from putting the computer to sleep

Expand  

Using _WinAPI_SetThreadExecutionState() does not prevent the user from putting the computer to sleep.

Edited by czardas
Posted (edited)

Look in Microsoft Docs  for ES_AWAYMODE_REQUIRED remarks .

I thought that this function very well preventing, but should not be used to prevent - is't she ?

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

Sorry mLipok, I have no time to check what these things do. I was simply trying to interpret, and correct, your English.

Using [funcName] does not prevent the user from putting the computer to sleep.
[funcName] should not be used to put the computer to sleep.

These have two very different meanings. Short and easy to understand sentences are best IMHO.

Edited by czardas
Posted (edited)

Just had a quick look at the link, and what is written makes sense in context. I would add a link to this page in the help file. I don't see any reason to alter the text for the help file.

Edited by czardas
Posted

ok.

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 10/16/2018 at 9:56 AM, czardas said:

I would add a link to this page in the help file.

Expand  

like this one:

  Quote

According to <a href="https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-setthreadexecutionstate">Microsoft Docs</a> $ES_USER_PRESENT should not be used, and $ES_AWAYMODE_REQUIRED should be used only when absolutely necessary.

Expand  

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Something like your example above is possible - or you could simply list the constants and add a single link for the description: See Microsoft Documentation about <a href="https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-setthreadexecutionstate"> SetThreadExecutionState</a>.

Posted

@mLipok I think ES_AWAYMODE_REQUIRED prevent a true sleep. So It means it prevents it. I think.

The ES_AWAYMODE_REQUIRED value should be used only when absolutely necessary by media applications that require the system to perform background tasks such as recording television content or streaming media to other devices while the system appears to be sleeping. Applications that do not require critical background processing or that run on portable computers should not enable away mode because it prevents the system from conserving power by entering true sleep.

 

About help file I think is enough to remove "This function does not stop the screen saver from executing." and let the developer deal with the msdn link.

 

Saludos

 

 

Posted

currently in helpfile (not published yet) this look like this:

  Quote

 

###Remarks###
The <a href="_WinAPI_SetThreadExecutionState.htm">_WinAPI_SetThreadExecutionState()</a> function cannot be used to prevent the user from putting the computer to sleep.
Applications should respect that the user expects a certain behavior when they close the lid on their laptop or press the power button.

This function does not stop the screen saver from executing.
According to <a href="https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-setthreadexecutionstate">Microsoft Docs</a> $ES_USER_PRESENT should not be used, and $ES_AWAYMODE_REQUIRED should be used only when absolutely necessary.

 

Expand  

This BOLD text is from the begining (documentation for this function was added in 2013).

Maybe just remove them all, and put this short description:

  Quote

[MS DOC] says to use this function with special attention. Read the remarks from [MS DOC] carefully.

Expand  

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 10/16/2018 at 10:18 AM, Danyfirex said:

About help file I think is enough to remove "This function does not stop the screen saver from executing." and let the developer deal with the msdn link.

Expand  

current helpFile which you can read , have this description:
 

  Quote

Remarks

The _WinAPI_SetThreadExecutionState() function cannot be used to prevent the user from putting the computer to
sleep. Applications should respect that the user expects a certain behavior when they close the lid on their
laptop or press the power button.

This function does not stop the screen saver from executing.

Expand  

As I understand @czardas meant that the literal quote from "MS DOC" is not good idea.
So the conclusion to me is that we should remove them all and only say somethink like this:

  Quote

[MS DOC] says to use this function with special attention. Read the remarks from [MS DOC] carefully.

Expand  

unless I've got lost in it a bit.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
Posted

I mean that it's difficult to rewrite all the detail without making it harder to understand or overly verbose. Anyone using such advanced functions should be able to interpret the description on MSDN. I do believe the constant names ought to be listed, but rewording MSDN descriptions seems like a huge effort.

  • 4 weeks later...
Posted (edited)

The -WinAPI-MoveWindow documentation doesn't mention that it can also be used to resize a control / multiple controls inside of a window as well as resizing a window. Like this

This was incredibly helpful, but also incredibly hard to find. I want a status bar at the bottom of my GUI that is toggle-able, but that would leave a white space without this function.

Edit: Underlined underscores  = space :D

Edited by seadoggie01

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

  Reveal hidden contents
  • 4 weeks later...
Posted

Example for TimerInit:
 

#include <MsgBoxConstants.au3>

Local $hTimer = TimerInit() ; Begin the timer and store the handle in a variable.
Sleep(3000) ; Sleep for 3 seconds.
Local $fDiff = TimerDiff($hTimer) ; Find the difference in time from the previous call of TimerInit. The variable we stored the TimerInit handlem is passed as the "handle" to TimerDiff.
MsgBox($MB_SYSTEMMODAL, "Time Difference", $fDiff)

Is there typo in:

  Quote

The variable we stored the TimerInit handlem is passed as the "handle" to TimerDiff.

Expand  

?

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

  • 2 weeks later...
Posted (edited)

Anyone (native english speeker) who would explain this form of this word to me ?

Is this just a typo ?

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Typo, unnecessary m at the end.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

  Reveal hidden contents

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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
×
×
  • Create New...