How to use try catch in NSIS

Hi, I get a strange error on several machines in the nsis installer during installation. It provides an "Invalid win32 file descriptor" when installing fonts using fontreg.nsh

I tried Google but did not get an answer to this problem. now Im thinking to suppress this message, is there any way to suppress the message or, if possible, offer me a solution to the problem.

heres my code

! enable "FontReg.nsh" enable "FontName.nsh" enable "WinMessages.nsh"

StrCpy $ FONT_DIR $ FONTS

! insertmacro InstallTTFFont 'calibri_0.TTF'! insertmacro InstallTTFFont 'calibrib.TTF'! insertmacro InstallTTFFont 'calibriz.TTF'! insertmacro InstallTTFFont 'calibrii.TTF'

SendMessage $ {HWND_BROADCAST} $ {WM_FONTCHANGE} 0 0 / TIMEOUT = 5000

please help him urgently

+3
source share
2 answers

As far as I can see, robertinventor has a fix here (March 11, 2010, 11:16 p.m.):

http://forums.winamp.com/showthread.php?t=209326

+1
source

In response to your initial question (“is there a way to suppress a message”), this is actually not an exception, FontReg displays a MessageBox.

I edited FontReg.nsh and replaced line 84.

Old:

MessageBox MB_OK "$R2"

New:

DetailPrint "[ERROR] InstallTTFFont"
DetailPrint "[ERROR]     error: $R2"
DetailPrint "[ERROR]     FontFile: ${FontFile}"
DetailPrint "[ERROR]     FontFileName: ${FontFileName}"
DetailPrint "[ERROR]     Index: ${Index}"
0
source

Source: https://habr.com/ru/post/1771677/


All Articles