Jump to content

How to close a window within an windows app?


andy09
 Share

Recommended Posts

Hi,

I've a windows softwarea running and I could like to close a window (file running within the software) WITHOUT CLOSING THE SOFTWARE.

I've tried

CODE
WinActivate("G2-La Doma 2 - GX IEC Developer - [apa.xls]")

;Controlclick("G2-La Doma 2 - GX IEC Developer - [apa.xls]" , "", "[CLASS:ToolbarWindow32;INSTANCE:13]")

WinClose ( "G2-La Doma 2 - GX IEC Developer - [apa.xls]" ,"Menu Bar" )

But WinClose closes the software as well, even though I use the option TEXT value "Menu Bar) to make sure it DOESN'T CLOSE the software.

COuld you help me?

Link to comment
Share on other sites

Link to comment
Share on other sites

HI again,

With the autoit window info i got this info regarding the window I want to close within the Software.

Advanced (Class): [CLASS:SPR32X60_SpreadSheet; INSTANCE:1]

Therefor I've tried this code without any luck:

CODE
WinActivate("G2-La Doma 2 - GX IEC Developer - [apa.xls]")

WinClose("[CLASS:SPR32X60_SpreadSheet]", "")

Could you help me out?

Br

Andy

Link to comment
Share on other sites

  • Moderators

andy09,

Try using the value you get from "Class" from the "Window" tab rather than the "Advanced (Class) value from the "Control" tab.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I've used this class that is the one for the top part of the window I want to close:

CLASS:Afx:400000:8:10011:0:590609

CODE
WinActivate("[CLASS:Afx:400000:8:10011:0:590609]", "")

WinClose("[CLASS:Afx:400000:8:10011:0:590609]", "")

This code closes down the correct window but 1 second later the hole applications shutsdown as well.

The class used is not very useful since the "afx:......." number changes when I start ut the application again.

What part of the window WITHIN the windows software should be used? I've tryed the "body" of that window was well as the class for the top part ofthe window containing the (X) button for closing the window without any luck.

PLease help!!

Link to comment
Share on other sites

Hi,

It's called GX IEC Developer. PLC programming.

I've found that the window I want to close within the software is called "Toolbarwindow32 instance 13"

So I've tried this code: (first activate the software, then the internal window and then closing the internal window)

CODE
WinActivate("G2-La Doma 2 - GX IEC Developer - [apa.xls]")

WinActivate("[CLASS:ToolbarWindow32;INSTANCE:13]", "")

WinClose("[CLASS:ToolbarWindow32;INSTANCE:13]", "")

Without any luck. Nothing happens except that the software is activated.

What's wrong?

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