找回密码
 加入
搜索
查看: 1733|回复: 6

桌面显示 机子号问题

[复制链接]
发表于 2009-3-28 13:36:34 | 显示全部楼层 |阅读模式
本帖最后由 huoqingpo 于 2010-6-4 20:41 编辑

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 231, 81,-1,0, $WS_POPUP, $WS_EX_LAYERED)
$name1 = IniRead("name.ini","section","key","")
GUISetBkColor(0xABCDEF)
_API_SetLayeredWindowAttributes($Form1, 0xABCDEF)
$Label1 = GUICtrlCreatelabel ($name1&@ComputerName, 1, 16, 200, 200, -1, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetFont(-1, 20, 400, 0, "宋体")
GUICtrlSetColor(-1,000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
        EndSwitch
WEnd

Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $isColorRef = False)
        Local Const $AC_SRC_ALPHA = 1
        Local Const $ULW_ALPHA = 2
        Local Const $LWA_ALPHA = 0x2
        Local Const $LWA_COLORKEY = 0x1
        If Not $isColorRef Then
                $i_transcolor = Hex(String($i_transcolor), 6)
                $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
        EndIf
        Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $LWA_COLORKEY + $LWA_ALPHA)
        Select
                Case @error
                        Return SetError(@error, 0, 0)
                Case $Ret[0] = 0
                        Return SetError(4, 0, 0)
                Case Else
                        Return 1
        EndSelect
EndFunc   ;==>_API_SetLayeredWindowAttributes


上面的代码怎么实现读取name.ini来实现桌面显示的机子号与本机相同。  
例如:56号机 运行后就显示  贵宾区 56号机     
     100号  运行后就显示   包间区 100号机
用name.ini 来 控制 前面前面区域的名称。
机器名字·我可以显示 ··但是不知道 怎么根据机子来识别  ·包间 或者贵宾区 ·和普通区

那位大哥给帮忙改下 ··
另外 ·改下·怎么 运行后只有进程 ··然后锁定 机子号信息··
发表于 2009-3-28 15:16:47 | 显示全部楼层
可以用MAC地址来判断啊哈哈。
 楼主| 发表于 2009-3-28 17:40:16 | 显示全部楼层
能给个思路吗··或者给写下 ·
发表于 2009-3-28 18:07:42 | 显示全部楼层
得到用户名后
switch
case 多少号 to 多少号
包间区
case 多少号 to 多少号
贵宾区
endswitch
发表于 2009-3-28 21:19:17 | 显示全部楼层
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 231, 81,-1,0, $WS_POPUP, $WS_EX_LAYERED)

$B1 = IniReadSectionNames(@ScriptDir & "\name.ini")
If @error Then 
Exit
Else
 For $i = 1 To $B1[0]
$B2 = IniReadSection("name.ini", $B1[$i])
If @error Then 
Exit
Else
    For $i2 = 1 To $B2[0][0]
        If @ComputerName = $B2[$i2][0] Then
                ;MsgBox(64,'提示','该机在:' & $B1[$i])
                $name1 = $B1[$i]
                EndIf
    Next
EndIf
Next
EndIf


GUISetBkColor(0xABCDEF)
_API_SetLayeredWindowAttributes($Form1, 0xABCDEF)
$Label1 = GUICtrlCreatelabel ($name1  & Chr(32) & @ComputerName, 1, 16, 200, 200, -1, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetFont(-1, 20, 400, 0, "宋体")
GUICtrlSetColor(-1,000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
        EndSwitch
WEnd

Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $isColorRef = False)
        Local Const $AC_SRC_ALPHA = 1
        Local Const $ULW_ALPHA = 2
        Local Const $LWA_ALPHA = 0x2
        Local Const $LWA_COLORKEY = 0x1
        If Not $isColorRef Then
                $i_transcolor = Hex(String($i_transcolor), 6)
                $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
        EndIf
        Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $LWA_COLORKEY + $LWA_ALPHA)
        Select
                Case @error
                        Return SetError(@error, 0, 0)
                Case $Ret[0] = 0
                        Return SetError(4, 0, 0)
                Case Else
                        Return 1
        EndSelect
EndFunc   ;==>_API_SetLayeredWindowAttributes


INI内容:
[贵宾区]
K56=
[包间区]
K65=
 楼主| 发表于 2009-3-29 01:13:57 | 显示全部楼层
5楼虽然把代码写出来了··但是运行后提示有错误···
4楼的想法不错··
5楼谢谢你·
 楼主| 发表于 2009-3-29 01:28:45 | 显示全部楼层
我自己在研究下··这几天很忙 晚上要12点多才能上来看看·然后再去研究au3··
au3真的很不错··解决了我不少问题·
也不是很难学··
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-23 03:24 , Processed in 0.078450 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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