
LoadString(module, error, buffer, sizeof(buffer) / sizeof(TCHAR)) HMODULE module = LoadLibraryEx(_T("msimsg.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE) function to get error message from msimsg.dll resource dllĬString GetMessageFromMsiErrCode(DWORD error) Message.Format(_T("%s"), GetMessageFromMsiErrCode(result).GetBuffer())

MsiInstallProduct() in this caseĭWORD result = MsiInstallProduct(installerFullPath, commandLine)
#Windows message gpass string code#
The following code uses the error code from any MSI API function to get the error string from I wanted to convert the MSI error code to a human readable string and didn't find anything good on the Internet so I thought I would share my solution. Please remember to mark the replies as answers if they help and unmark them if they provide no help. MSDN Community Support | Feedback to us Get or Request Code Sample from Microsoft Static extern int LoadString(IntPtr hInstance, uint uID, StringBuilder lpBuffer, int nBufferMax) LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE = 0x00000040, Static extern IntPtr LoadLibraryEx( string lpFileName, IntPtr hFile, LoadLibraryFlags dwFlags) ĭONT_RESOLVE_DLL_REFERENCES = 0x00000001,

LoadString(hModuleInstance, errCode, sb, sb.Capacity + 1) StringBuilder sb = new StringBuilder(255) IntPtr hModuleInstance = LoadLibraryEx(libPath, IntPtr.Zero, LoadLibraryFlags.LOAD_LIBRARY_AS_DATAFILE) Public string GetDescriptionFromErrCode( uint errCode)
