简体   繁体   中英

How to use try catch in NSIS

hi im getting a weird error on few machines in my nsis installer while installing. Its is giving "Invalid win32 file handle" while installing fonts using fontreg.nsh

i've tried google but didnt got an answer to this issue. now im thinking to suppress this message, so is there any way to suppress the message or if possible suggest me solution to the issue.

heres my code

!include "FontReg.nsh" !include "FontName.nsh" !include "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 its urgentt

as far I see, robertinventor has a fix here (11th March 2010, 23:16):

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

In answer to your original question ("is there any way to suppress the message"), it's not actually an exception, FontReg is displaying 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}"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM