1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-23 11:43:26 +00:00

Fixed Alert and MessageBox on windows to work with non-english characters

This commit is contained in:
Bryan Roe
2020-06-09 15:45:46 -07:00
parent fedd70072b
commit 946bbd5cb9
2 changed files with 10 additions and 9 deletions

File diff suppressed because one or more lines are too long

View File

@@ -128,9 +128,10 @@ function messageBox()
case 'ALERT': case 'ALERT':
this.GM = require('_GenericMarshal'); this.GM = require('_GenericMarshal');
this.user32 = this.GM.CreateNativeProxy('user32.dll'); this.user32 = this.GM.CreateNativeProxy('user32.dll');
this.user32.CreateMethod('MessageBoxA'); this.user32.CreateMethod('MessageBoxW');
layout = msg.command == 'YESNO' ? (MB_YESNO | MB_DEFBUTTON2 | MB_ICONEXCLAMATION | MB_TOPMOST | MB_SYSTEMMODAL) : (MB_OK | MB_DEFBUTTON2 | MB_ICONEXCLAMATION | MB_TOPMOST | MB_SYSTEMMODAL); layout = msg.command == 'YESNO' ? (MB_YESNO | MB_DEFBUTTON2 | MB_ICONEXCLAMATION | MB_TOPMOST | MB_SYSTEMMODAL) : (MB_OK | MB_DEFBUTTON2 | MB_ICONEXCLAMATION | MB_TOPMOST | MB_SYSTEMMODAL);
this.user32.MessageBoxA.async(0, this.GM.CreateVariable(msg.caption), this.GM.CreateVariable(msg.title), layout) this.user32.MessageBoxW.async(0, this.GM.CreateVariable(msg.caption, { wide: true }), this.GM.CreateVariable(msg.title, { wide: true }), layout)
.then(function (r) .then(function (r)
{ {
try try