Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than kernel32, prefix the name with the module name and a period.
GetApplicationUserModelId (kernel32)
.
Summary
Windows 8+. Gets the application user model ID for the specified process. For instance, reveals the application ID for HTML/JavaScript applications running inside wwahost.exe.
C# Signature:
[DllImport("kernel32.dll", SetLastError=true)]
internal static extern Int32 GetApplicationUserModelId(
internal static extern long GetApplicationUserModelId(
IntPtr hProcess,
ref UInt32 AppModelIDLength,
[MarshalAs(UnmanagedType.LPWStr)] StringBuilder sbAppUserModelID);
VB Signature:
Declare Function GetApplicationUserModelId Lib "kernel32.dll" (TODO) As TODO
User-Defined Types:
Alternative Managed API:
Do you know one? Please contribute it!
Notes:
None.
Tips & Tricks:
Please add some!
Sample Code:
const int QueryLimitedInformation = 0x1000;
const int ERROR_INSUFFICIENT_BUFFER = 0x7a;
const int ERROR_SUCCESS = 0x0;
[DllImport("kernel32.dll")]
internal static extern IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId);
[DllImport("kernel32.dll")]
static extern bool CloseHandle(IntPtr hHandle);
if (sProcessName.ToLower().Contains("wwahost")
&& ((Environment.OSVersion.Version.Major == 6) && (Environment.OSVersion.Version.Minor > 1)))
{
IntPtr ptrProcess = OpenProcess(QueryLimitedInformation, false, iPID);
if (IntPtr.Zero != ptrProcess)
{
uint cchLen = 130;
uint cchLen = 128;
StringBuilder sbName = new StringBuilder((int)cchLen);
Int32 lResult = GetApplicationUserModelId(ptrProcess, ref cchLen, sbName);
long lResult = GetApplicationUserModelId(ptrProcess, ref cchLen, sbName);
if (ERROR_SUCCESS == lResult)
{
sResult = sbName.ToString();
}
else if (ERROR_INSUFFICIENT_BUFFER == lResult)
{
sbName = new StringBuilder((int)cchLen);
if (ERROR_SUCCESS == GetApplicationUserModelId(ptrProcess, ref cchLen, sbName))
{
sResult = sbName.ToString();
}
}
CloseHandle(ptrProcess);
}
}
Documentation
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).