找回密码
 加入
搜索
楼主: thesnow

每周任务#1

[复制链接]
发表于 2009-5-9 22:58:23 | 显示全部楼层
每周任务B,完成。请指教..
#include <Misc.au3>
TrayTip ( "每周任务B", "当按住CTRL键时,如果鼠标指针在屏幕右上角则最小化当前窗口,左上角时则关闭当前窗口,左下角时则隐藏当前窗口,右下角时显示隐藏的窗口.alt+d退出",60)


While 1
    sleep (100)
    $xy=MouseGetPos()
    $title = WinGetTitle("", "")
    $Handle = WinGetHandle ($title, "")
    If _IsPressed("11", "user32.dll") And $xy[0] <50  And $xy[1] <50  Then  ;左上角时则关闭当前窗口
      IF $title <> "Program Manager" Then WinClose ($title, "")
    Endif
   IF _IsPressed("11", "user32.dll") And $xy[0] < 50 And $xy[1] > int (@DesktopHeight - 50)  Then ;左下角时则隐藏当前窗口
      IF $title <> "Program Manager" Then WinSetState ( $title, "", @SW_HIDE)
   Endif
   IF _IsPressed("11", "user32.dll") And $xy[0] > int (@DesktopWidth - 50) And $xy[1] > int (@DesktopHeight - 50) Then ;右下角时显示隐藏的窗口
     IF $title <> "Program Manager" Then WinSetState ( $title, "", @SW_SHOW)
   Endif
   IF _IsPressed("11", "user32.dll") And $xy[0] > int (@DesktopWidth - 50) And $xy[1] < int (@DesktopHeight - 50) Then ;右上角则最小化当前窗口
     IF $title <> "Program Manager" Then WinSetState ( $title, "", @SW_MINIMIZE)
   Endif
   HotKeySet ( "!d", "ext")
WEnd



func ext()
TrayTip( "每周任务B", "你选择了退出哦",2)
sleep(2000)
exit
endfunc

评分

参与人数 1金钱 +200 收起 理由
thesnow + 200 感谢你的支持

查看全部评分

发表于 2009-5-9 22:59:37 | 显示全部楼层
没发现论坛还有这个好地方,刚发现,真是好地方.
发表于 2009-5-11 15:52:56 | 显示全部楼层
学习AutoIt从每天做起
发表于 2009-5-11 17:56:34 | 显示全部楼层
每周任务A
可惜不完善,要手动去除自动排列,
还有就是要做到默认右边的话...还在努力中...

#include <GUIListView.au3>
Dim $num,$num_1=0
$hParent = WinGetHandle("Program Manager")
$hwnd = ControlGetHandle($hParent, "", "SysListView321")
_GUICtrlListView_SetView($hwnd, 3) ;小图标排列
_GUICtrlListView_SetItemPosition32($hwnd, 0, 1200, 0)
For $i = 1 to _GUICtrlListView_GetItemCount($hwnd)
     IF StringInStr ($i / 2, "." ) Then
        $Num = 20
     Else
        $Num = 10
     Endif
     $num_1 = $num_1 + $Num
    _GUICtrlListView_SetItemPosition32($hwnd, $i, 2000, $num_1)
Next
发表于 2009-5-12 20:46:48 | 显示全部楼层
老大发飙了,没想到老大文学水平这么高
发表于 2009-5-13 10:10:27 | 显示全部楼层
图标靠右的,
#include <GuiListView.au3>
Global $hWndManager = WinGetHandle("Program Manager")
Global $hWndDesktop = ControlGetHandle("Program Manager", "", 1)
$iCount = ControlListView($hWndManager, "", $hWndDesktop, "GetItemCount")
For $iIndex = 0 To $iCount - 1
        $xy = _GUICtrlListView_GetItemPosition($hWndDesktop, $iIndex)
        _GUICtrlListView_SetItemPosition($hWndDesktop, $iIndex, @DesktopWidth - 40 - $xy[0], $xy[1])
Next
同上,必须取消自动排列

评分

参与人数 1金钱 +15 贡献 +10 收起 理由
lynfr8 + 15 + 10 琢磨了很久,谢了!

查看全部评分

发表于 2009-5-13 20:16:08 | 显示全部楼层
都是高手 学习中
发表于 2009-5-13 21:32:08 | 显示全部楼层
#Include <SendMessage.au3>
#include <GuiListView.au3>
#Include <WinAPI.au3>
Global Const $GWL_STYLE               = 0xFFFFFFF0
Global Const $handle = WinGetHandle("Program Manager") ;窗口句柄
Global Const $ctrl = ControlGetHandle("Program Manager","","SysListView321")  ;控件句柄
_SendMessage($ctrl, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_SNAPTOGRID, 0)        ;;取消对齐到网络
$dwStyle = _WinAPI_GetWindowLong($ctrl, $GWL_STYLE )
_WinAPI_setWindowLong($ctrl, $GWL_STYLE , BitAnd($dwStyle,BitNot($LVS_AUTOARRANGE)))     ;;取消自动排列
发表于 2009-5-13 22:02:14 | 显示全部楼层
#Include <SendMessage.au3>
#include <GuiListView.au3>
#Include <WinAPI.au3>
Global Const $GWL_STYLE               = 0xFFFFFFF0
Global $hWndManager = WinGetHandle("Program Manager")
Global $hWndDesktop = ControlGetHandle("Program Manager", "", 1)
_SendMessage($hWndDesktop, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_SNAPTOGRID, 0)    ;;取消对齐到网络  
$dwStyle = _WinAPI_GetWindowLong($hWndDesktop, $GWL_STYLE )
If BitAND($dwStyle, $LVS_AUTOARRANGE) Then _WinAPI_setWindowLong($hWndDesktop, $GWL_STYLE , BitAnd($dwStyle,BitNot($LVS_AUTOARRANGE)))  ;取消自动排列

$iCount = ControlListView($hWndManager, "", $hWndDesktop, "GetItemCount")
For $iIndex = 0 To $iCount - 1
        $xy = _GUICtrlListView_GetItemPosition($hWndDesktop, $iIndex)
        _GUICtrlListView_SetItemPosition($hWndDesktop, $iIndex, @DesktopWidth - 40 - $xy[0], $xy[1])
Next

谢谢lynfr8。
前面不知道 $gwl_sytle这个参数如何设。
发表于 2009-5-13 22:44:10 | 显示全部楼层
本帖最后由 lynfr8 于 2009-5-13 22:59 编辑

不言谢,我还得多向你们学习
关于$gwl_sytle这个参数如何设
懂c++的可以借鉴此文
http://blog.chinaunix.net/u2/67530/showart_601459.html
发表于 2009-5-15 18:05:54 | 显示全部楼层
但是还是有一个问题,如何把默认左边改成默认右边呢??ListView不知道怎么实现
发表于 2009-5-15 23:18:57 | 显示全部楼层
但是还是有一个问题,如何把默认左边改成默认右边呢??ListView不知道怎么实现
aa147147 发表于 2009-5-15 18:05


跟帖不是有吗?认真点看
发表于 2009-5-17 07:29:32 | 显示全部楼层
呀.迟到了
努力中..
发表于 2009-5-21 22:11:06 | 显示全部楼层
跌倒。赞叹。失语。

原来老大口才这么好。

一段时间没来,感觉老大发愤了?
发表于 2009-5-22 15:40:48 | 显示全部楼层
好啊!
希望老师坚持这个每周任务
顶!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-22 17:40 , Processed in 0.074451 second(s), 14 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表