回复 1# zldfsz
你用的是QQ2012吧?试试这个.
#include <File.au3>
If @OSVersion <> "WIN_7" Then Exit
; 这里有图像图标,临时快捷方式
Global $QQ = @AppDataDir & "\Tencent\QQ\Misc\Shortcuts"
Global $file, $btn, $msg = 0, $LnkFile, $LnkPass, $ico
FileDelete($QQ & '\*.*')
$gui = GUICreate("QQ2012获得快捷方式 by lixiaolong", 320, 100, -1, -1)
$file = GUICtrlCreateInput("把QQ好友拖放到这里", 10, 5, 300, 20)
$file2 = GUICtrlCreateInput("", 10, 30, 300, 20, 0x0800)
$btn = GUICtrlCreateButton("在桌面创建快捷方式", 10, 65, 150, 20)
GUISetState()
While $msg <> -3
_FindFile($QQ, '.lnk')
$msg = GUIGetMsg()
Select
Case $msg = $btn
$dLink = GUICtrlRead($file)
If $dLink Then
If FileCreateShortcut($LnkPass[0], @DesktopDir & "\" & $dLink, '', $LnkPass[2], '', $ico) Then
MsgBox(0, '创建快捷方式', 'OK!')
EndIf
Run(@ComSpec & ' /c ping 127.0.0.1 -n 3&del /q "' & $QQ & '\*.ico"', '', 0)
EndIf
EndSelect
WEnd
Func _FindFile($sPath, $sFileName)
Local $aFileList = _FileListToArray($sPath)
If Not @error Then
Switch $sFileName
Case '.lnk'
For $i = 1 To $aFileList[0]
If StringInStr($aFileList[$i], $sFileName) Then
$LnkFile = $sPath & '\' & $aFileList[$i]
$LnkPass = FileGetShortcut($LnkFile)
setdate()
ExitLoop
EndIf
Next
Case '.ico'
For $i = 1 To $aFileList[0]
If StringInStr($aFileList[$i], $sFileName) Then
$ico = $sPath & '\' & $aFileList[$i]
ExitLoop
EndIf
Next
EndSwitch
EndIf
Sleep(10)
EndFunc ;==>_FindFile
Func setdate()
Local $Cursor = GUIGetCursorInfo($gui)
If $Cursor[4] = $file Then
GUICtrlSetData($file, StringRegExpReplace($LnkFile, '.+\\+', ''))
GUICtrlSetData($file2, '"' & $LnkPass[0] & '" ' & $LnkPass[2])
FileDelete($LnkFile)
_FindFile($QQ, '.ico')
EndIf
EndFunc ;==>setdate
|