Sign in to follow this  
Followers 0
Achilles

Problem with converting a Opt(WintitleMatchMode 1 to 4..

9 posts in this topic

#1 ·  Posted (edited)

My new problem is how to write this:

$handle = ControlGetHandle(ControlGetHandle('[Class:Progman]', '', '[Class:SHELLDLL_DefView]'), '', '[Class:SysListView32;Instance:1]')
So that it works with Opt('WinTitleMatchMode', 4)...

Fixed problem that doesn't matter anymore:

#include<GuiListView.au3>

HotKeySet('`', '_CountItems')

While 1 
    Sleep(200)
WENd 

Func _CountItems() 
    For $i = 1 to 2
        $handle = ControlGetHandle('Program Manager', '', 'SysListView321')
        _GUICtrlListView_BeginUpdate($handle)
        $itemCount = _GUICtrlListView_GetItemCount($handle)

        Msgbox(0, '$itemCount', 'is equal to: ' & $itemCount)

        _GUICtrlListView_EndUpdate($handle)
    Next
EndFunc
Instructions: Run this. Press ` and it will tell you have x number of items on your desktop two times. Press Win + D. Press ` and it will tell you have 0 items once and then that you have x amount of items once. WHY?

Edit: Managed to make an example... Is anybody getting this problem or is this just my computer?

Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites



Piano_Man

Hi! I tryed your code and getting said problem... Hmm... i`m interesting why... :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

The actual Listview is not a direct child of 'Program Manager', but its grandchild. So the more reliable way of getting ListView handle is

$handle = ControlGetHandle(ControlGetHandle('[Class:Progman]', '', '[Class:SHELLDLL_DefView]'), '', '[Class:SysListView32;Instance:1]')
Edited by Siao

"be smart, drink your wine"

Share this post


Link to post
Share on other sites

The actual Listview is not a direct child of 'Program Manager', but its grandchild. So the more reliable way of getting ListView handle is

$handle = ControlGetHandle(ControlGetHandle('[Class:Progman]', '', '[Class:SHELLDLL_DefView]'), '', '[Class:SysListView32;Instance:1]')
Thanks, that works good.

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

Would there be a way to make this work with Opt('WinTitleMatchMode', 4)? I thought that it should, but it doesn't.... I could add a Opt('WinTitleMatchMode', 1) before these commands but it seems inefficient.. I thought that the style that I have now was designed to work for option 4, but it doesn't....


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

For me works fine, with Opt('WinTitleMatchMode', 4).

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

For me works fine, with Opt('WinTitleMatchMode', 4).

That's really weird. I'm running this:

#include<GuiListView.au3>
Opt('WinTitleMatchMode', 4) 

HotKeySet('`', '_CountItems')

While 1
    Sleep(200)
WENd

Func _CountItems()
        $handle = ControlGetHandle(ControlGetHandle('[Class:Progman]', '', '[Class:SHELLDLL_DefView]'), '', '[Class:SysListView32;Instance:1]')
        $itemCount = _GUICtrlListView_GetItemCount($handle)
        
        Msgbox(0, '$itemCount', 'is equal to: ' & $itemCount)
EndFunc
And when I run it the first time it returns 3, which is right. I press Win + D and then it's wrong, it shows 0. And if I press it again it returns 3 again. Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

So this work correct for me:

#include<GuiListView.au3>

Opt('WinTitleMatchMode', 4) 

HotKeySet('`', '_CountItems')

While 1
    Sleep(200)
WENd

Func _CountItems()
    Opt('WinTitleMatchMode', 1) 
    $handle = ControlGetHandle(ControlGetHandle('[Class:Progman]', '', '[Class:SHELLDLL_DefView]'), '', '[Class:SysListView32;Instance:1]')
    $itemCount = _GUICtrlListView_GetItemCount($handle)
    
    Msgbox(0, '$itemCount', 'is equal to: ' & $itemCount)
EndFunc ;==>_CountItems

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  
Followers 0