Jump to content
Sign in to follow this  
jennico

mix up win... and gui... commands ?

Recommended Posts

jennico

hi there,

in my script i often use the line:

if winexists($i) then guidelete($i)

now i am not sure anymore if this works in every case. the question i ask myself is: can you mix up the win... and gui... commands in this way ? is the winhandle the same ?

and more general: what is the difference between gui and win ? why isn't there a command like 'guiexists' or 'windelete' (okay, there is 'winkill', i know).

if i use instead:

if winexists($i) then winkill($i)

does this mean that i really delete the gui with the handle ($i) in every case ?

sry, my explanation is a bit clumsy because i am somewhat confused. maybe someone understands my demand.

thanx

j.


Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Share this post


Link to post
Share on other sites
martin

hi there,

in my script i often use the line:

if winexists($i) then guidelete($i)

now i am not sure anymore if this works in every case. the question i ask myself is: can you mix up the win... and gui... commands in this way ? is the winhandle the same ?

and more general: what is the difference between gui and win ? why isn't there a command like 'guiexists' or 'windelete' (okay, there is 'winkill', i know).

if i use instead:

if winexists($i) then winkill($i)

does this mean that i really delete the gui with the handle ($i) in every case ?

sry, my explanation is a bit clumsy because i am somewhat confused. maybe someone understands my demand.

thanx

j.

You just need to read the Help file, as was recently pointed out to me on a similar point. Guicreate returns a windows handle so guidelete should be ok. You have to make sure that you have detetected the correct window with winexists which depends on the "WinTitleMatchMode" setting in AutoItSetOption. Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
jennico

thank you i read the help file. it says:

"Note: Window handles will work no matter what WinTitleMatchMode is currently in use."

this means to me: when i use hwnd instead of the title i can use the win... commands in the same way as gui..... commands. so far so good. but: 'windelete' helpfile says:

"Windows handle as returned by GUICreate (default is the previous used)."

no i will go deeper into my problem:

i create several guis in atwo dimensional array by

guicreate($gui[hwnd1][hwnd2])

then i want to delete all the guis in that array by:

for $i= 1 to hwnd1
for $j= 1 to hwnd2
if winexists($gui[$i][$j]) then guidelete($gui[$i][$j])
next
next

note: not all guis in the array are necessarily created!

but what happens now, is that the script erases more than only the array guis and additionally the most recent guis. this means to me that the detection method 'if winexists($gui[hwnd1][hwnd2])' does not work correctly. it seems to me that the detection of the hwnd fails and instead of deleting the (not existing) array gui another gui (the most recent) is erased. so what is wrong with:

if winexists($gui[hwnd1][hwnd2]) then guidelete($gui[hwnd1][hwnd2])
?

is therer a better way to detect if a gui exists ?

sry for bad explanation again.

j.

Edited by jennico

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Share this post


Link to post
Share on other sites
jennico

okay, i tried it in two different ways:

If WinExists($gui[$i][$j]) Then WinKill($gui[$i][$j])

If WinExists($gui[$i][$j]) Then WinClose($gui[$i][$j])

this doesn't close any window !

so the conclusion is: something with the hwnd is wrong. can anyone tell me what is wrong with

GuiCreate($gui[hwnd1][hwnd2])
?

j.


Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Share this post


Link to post
Share on other sites
martin

i create several guis in atwo dimensional array by

guicreate($gui[hwnd1][hwnd2])
This doen't make sense to me

guicreate($gui[hwnd1][hwnd2])

I know that in general you can use a windows handle in place of a title, but for guicreate the handle is what is returned by guicreate, and if the handle already exists then what are you creating? I don't think that works.

To create an array of guis you need to do this

for $a = 0 to ??
 for $b = 0 to ??
   $gui[$a][$b] = guicreate("...")

 next
nextoÝ÷ Ù8^Múè´ß¦´ß¦â²Ø^©ÝêÞ¶êçyÖòè­æ­xÚ0¶¬².Ü(®F®¶­sfbvæW7G2b33c¶wV²b33c¶Õ²b33c¶%ÒFVâwVFVÆWFRb33c¶wV²b33c¶Õ²b33c¶%Ò

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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
Sign in to follow this  

×