桌面显示 机子号问题
本帖最后由 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
Return SetError(4, 0, 0)
Case Else
Return 1
EndSelect
EndFunc ;==>_API_SetLayeredWindowAttributes
上面的代码怎么实现读取name.ini来实现桌面显示的机子号与本机相同。
例如:56号机 运行后就显示贵宾区 56号机
100号运行后就显示 包间区 100号机
用name.ini 来 控制 前面前面区域的名称。
机器名字·我可以显示 ··但是不知道 怎么根据机子来识别·包间 或者贵宾区 ·和普通区
那位大哥给帮忙改下 ··
另外 ·改下·怎么 运行后只有进程 ··然后锁定 机子号信息·· 可以用MAC地址来判断啊哈哈。 能给个思路吗··或者给写下 · 得到用户名后
switch
case 多少号 to 多少号
包间区
case 多少号 to 多少号
贵宾区
endswitch #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
$B2 = IniReadSection("name.ini", $B1[$i])
If @error Then
Exit
Else
For $i2 = 1 To $B2
If @ComputerName = $B2[$i2] 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
Return SetError(4, 0, 0)
Case Else
Return 1
EndSelect
EndFunc ;==>_API_SetLayeredWindowAttributes
INI内容:
[贵宾区]
K56=
[包间区]
K65= 5楼虽然把代码写出来了··但是运行后提示有错误···
4楼的想法不错··
5楼谢谢你· 我自己在研究下··这几天很忙 晚上要12点多才能上来看看·然后再去研究au3··
au3真的很不错··解决了我不少问题·
也不是很难学··
页:
[1]