函数参考


_WinAPI_SetCurrentProcessExplicitAppUserModelID

Specifies a unique application-defined Application User Model ID that identifies the current process to the taskbar.

#Include <WinAPIEx.au3>
_WinAPI_SetCurrentProcessExplicitAppUserModelID ( $sAppID )

参数

$sAppID The string that represents an Application User Model ID (AppUserModelID). This identifier allows an
application to group its associated processes and windows under a single taskbar button. An application
must provide its AppUserModelID in the following form and can have no more than 128 characters and
cannot contain spaces.

CompanyName.ProductName.SubProduct.VersionInformation

(查看MSDN得到更多信息)

返回值

成功: 返回 1.
失败: 返回 0 并设置 @error 标志为非 0 值, @extended 标志可能包含一个系统错误代码.

注意/说明

This method must be called during an application's initial startup routine before the application presents any
UI or makes any manipulation of its Jump Lists.

本函数需要 Windows 7 或以上版本系统.

相关

详情参考

在MSDN中搜索


示例/演示


#NoTrayIcon

#Include <WinAPIEx.au3>

Opt('MustDeclareVars', 1)

If _WinAPI_GetVersion() < '6.1' Then
    MsgBox(16, 'Error', 'Require Windows 7 or later.')
    Exit
EndIf

Global Const $sAppID = 'Yashied.WinAPIEx.UDF'

Global $Param

If Not $CmdLine[0] Then
    For $i = 1 To 5
        Switch $i
            Case 1 To 2
                $Param = $sAppID & '.' & $i
            Case Else
                $Param = $sAppID & '.3'
        EndSwitch
        If Not @compiled Then
            Run(@AutoItExe & ' "' & @ScriptFullPath & '" ' & $Param)
        Else
            Run(@AutoItExe & ' ' & $Param)
        EndIf
        Sleep(100)
    Next
    Exit
EndIf

_WinAPI_SetCurrentProcessExplicitAppUserModelID($CmdLine[1])

GUICreate($CmdLine[1], 400, 400)
GUISetState(@SW_SHOWMINIMIZED)

Do
Until GUIGetMsg() = -3