There was a question in the Help section how to bring up the ShutdownWindows dialog. Actually, there are two methods: one documented, and one undocumented.
The documented one is via COM, but, I think it'll work only when explorer.exe is set as the shell. Anyway, here they are.
BOTH needs the latest build, 1.0.46.08.
Documented:
Code:
#NoEnv
CoInitialize()
GUID4String( CLSID_Shell, "{13709620-C279-11CE-A49E-444553540000}")
GUID4String(IID_IShellDispatch, "{D8F015C0-C278-11CE-A49E-444553540000}")
; CreateObject( "Shell.Application" )
psh := CreateObject(CLSID_Shell, IID_IShellDispatch)
DllCall(VTable(psh, 20), "Uint", psh)
DllCall(VTable(psh, 2), "Uint", psh)
CoUninitialize()
VTable(ppv, nID)
{
Return DecodeInteger( DecodeInteger(ppv) + nID * 4 )
}
DecodeInteger(ptr)
{
Return *ptr | *++ptr << 8 | *++ptr << 16 | *++ptr << 24
}
Ansi2Unicode(ByRef sString, ByRef wString, nLen = 0)
{
If !nLen
nLen := DllCall("MultiByteToWideChar"
, "Uint", 0
, "Uint", 0
, "Uint", &sString
, "int", -1
, "Uint", 0
, "int", 0)
VarSetCapacity(wString, nLen * 2)
DllCall("MultiByteToWideChar"
, "Uint", 0
, "Uint", 0
, "Uint", &sString
, "int", -1
, "Uint", &wString
, "int", nLen)
}
GUID4String(Byref CLSID, sString)
{
VarSetCapacity(CLSID, 16, 0)
Ansi2Unicode(sString, wString, 39)
DllCall("ole32\CLSIDFromString", "str", wString, "str", CLSID)
}
CreateObject(ByRef CLSID, ByRef IID)
{
If ( StrLen(CLSID) = 38 )
GUID4String(CLSID, CLSID)
If ( StrLen( IID) = 38 )
GUID4String( IID, IID)
DllCall("ole32\CoCreateInstance", "str", CLSID, "Uint", 0, "Uint", 1|2|4, "str", IID, "UintP", ppv)
Return ppv
}
CoInitialize()
{
DllCall("ole32\CoInitialize", "Uint", 0)
}
CoUninitialize()
{
DllCall("ole32\CoUninitialize")
}
Undocumented:
Code:
hModule := DllCall("LoadLibrary", "str", "shell32.dll")
DllCall(DllCall("GetProcAddress", "Uint", hModule, "Uint", 60), "Uint", 0)
DllCall("FreeLibrary", "Uint", hModule)