Old 29th January 2018, 16:12   #1
Junior Member
Join Date: Sep 2005
Location: MI
Posts: 6
VB6 app keeps having a comdlg32.ocx register error.

I was hoping the VB6 runtimes would solve this but still no go. When running this install on Win 7 it installs fine but when I run the app I get this error "Component 'Comdlg32.ocx' or one of its dependencies not correctly registered: a file is missing or invalid" and it crashes.

I have an old (2002) Installshield Express build that will install this app correctly on 7/10 and it does run, but I'm trying to break away from that with my own installer.

Could it be...
A. I'm missing a system file or something is not registering during the install?
B. that Installshield is downgrading a system file? Once that old installer is run on a new system my NSIS installs work fine.
C. my build is on XP, is it possible that newer system files aren't backwards compatible? i.e. setup VB6 on Win 10 and rebuild the exe?

; Define the application name
!define APPNAME "WinShear32 Viewer"
!define APPNAMEANDVERSION "WinShear32 Viewer 1.0.7"

; Main Install settings
InstallDir "$PROGRAMFILES\WinShear32 Viewer"
InstallDirRegKey HKLM "Software\${APPNAME}" ""
OutFile "WinShear32-Viewer_Setup.exe"
Icon C:\WS\NSIS\WS32v\WinShear32.ico
; Request application privileges for Windows Vista/7/10
RequestExecutionLevel admin

; Modern interface settings
!include "MUI2.nsh"
!include "Sections.nsh"
!include "FileAssociation.nsh"
!include "FileFunc.nsh"
!include "x64.nsh"
!include VB6RunTime.nsh
Var AlreadyInstalled

;Interface Settigns
!define MUI_ICON "..\NSIS\WS32v\WinShear32.ico"

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "..\NSIS\WS32v\WS32vLicense.rtf"
!insertmacro MUI_PAGE_FINISH

; Set languages (first is default language)
!insertmacro MUI_LANGUAGE "English"
!insertmacro RefreshShellIcons

Section "-Install VB6 run-time files"

;Add code here that sets $AlreadyInstalled to a non-zero value
;if the application is already installed. For example:
;(Replace MyApp.exe with your application filename)
IfFileExists "$INSTDIR\WS32viewer.exe" 0 new_installation
StrCpy $AlreadyInstalled 1

;Replace C:\vb6runtimes with the location of the files
!insertmacro VB6RunTimeInstall C:\WS\NSIS\vb6runtimes $AlreadyInstalled


Section "WinShear32 Viewer" Section1

; Set Section properties
SetOverwrite ifnewer

; Set Section Files and Shortcuts
SetOutPath "$INSTDIR\"
File "..\NSIS\WS32v\Pegraphs.gid"
File "..\NSIS\WS32v\Pegraphs.hlp"
File "..\NSIS\WS32v\Welcome.txt"
File "..\NSIS\WS32v\WS32viewer.exe"
File "..\NSIS\WS32v\Winshear32.ico"
File "..\NSIS\WS32v\WS32viewer.chm"
File "..\NSIS\WS32v\thermo_j.tbl"
File "..\NSIS\WS32v\thermo_k.tbl"
File "..\NSIS\WS32v\thermo_t.tbl"
File "..\NSIS\WS32v\Measurement of Fluid Rheology.pdf"

SetOutPath "$INSTDIR\files\"
File "..\NSIS\WS32v\files\A bob 1100.vis"
File "..\NSIS\WS32v\files\Blank.vis"
File "..\NSIS\WS32v\files\E bob 4400.vis"
File "..\NSIS\WS32v\files\FF bob 6600.vis"
File "..\NSIS\WS32v\files\F25 bob 8800.vis"

SetOutPath "$WINDIR\"
${If} ${RunningX64}
File "..\NSIS\WS32v\windows\64\WS32view.ini"
File "..\NSIS\WS32v\windows\32\WS32view.ini"

;These will go to Windows\sysWOW64 on 64 bit OS's
SetOutPath "$SYSDIR\"
File "..\NSIS\WS32v\system\TAB32X30.ocx"
File "..\NSIS\WS32v\system\Pesgo32a.ocx"
File "..\NSIS\WS32v\system\PEGRP32a.dll"
File "..\NSIS\WS32v\system\msflxgrd.ocx"
File "..\NSIS\WS32v\system\comctl32.ocx"
; File "..\NSIS\WS32v\system\comctl32.dll"
; File "..\NSIS\WS32v\system\msvbvm60.dll"

;Register some of these guys
RegDLL $SYSDIR\Pesgo32a.ocx
RegDLL $SYSDIR\msflxgrd.ocx
RegDLL $SYSDIR\comctl32.ocx
; RegDLL $SYSDIR\msvbvm60.dll

CreateShortCut "$DESKTOP\WinShear32 Viewer.lnk" "$INSTDIR\WS32viewer.exe"
CreateShortCut "$DESKTOP\Measurement of Fluid Rheology.lnk" "$INSTDIR\Measurement of Fluid Rheology.pdf"
CreateDirectory "$SMPROGRAMS\WinShear32 Viewer"
CreateShortCut "$SMPROGRAMS\WinShear32 Viewer\WinShear32 Viewer.lnk" "$INSTDIR\WS32viewer.exe"
CreateShortCut "$SMPROGRAMS\WinShear32 Viewer\Measurement of Fluid Rheology.lnk" "$INSTDIR\Measurement of Fluid Rheology.pdf"
CreateShortCut "$SMPROGRAMS\WinShear32 Viewer\Uninstall.lnk" "$INSTDIR\uninstall.exe"

;Register the vis extension
${registerExtension} "c:\Program Files\WinShear32 Viewer\WS32viewer.exe" ".vis" "VIS_File"
;Assign the icon to vis files.
WriteRegStr HKCR "WS32viewer.Document\DefaultIcon" "" \
;Call RefreshShellIcons

Section /o "Adobe Acrobat Reader" Section2

; Set Section properties
SetOverwrite ifnewer

; Set Section Files and Shortcuts
SetOutPath "$TEMP\"
; File "..\NSIS\WS32v\AdbeRdr11006_en_US.exe"
; ExecWait '"$TEMP\AdbeRdr11006_en_US.exe"'


Section -FinishSection

WriteRegStr HKLM "Software\${APPNAME}" "" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteUninstaller "$INSTDIR\uninstall.exe"


; Modern install component descriptions
!insertmacro MUI_DESCRIPTION_TEXT ${Section1} "Installs the WinShear32 Viewer software to view and analyse the saved test data from the Hercules High Shear Viscometer."
!insertmacro MUI_DESCRIPTION_TEXT ${Section2} "Install Adobe Acrobat Reader 11 to view the manuals in PDF format."

;Uninstall section
Section Uninstall

;Remove from registry...
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"

${unregisterExtension} ".vis" "VIS File"

; Delete self
Delete "$INSTDIR\uninstall.exe"

; Delete Shortcuts
Delete "$DESKTOP\WinShear32 Viewer.lnk"
Delete "$DESKTOP\Measurement of Fluid Rheology.lnk"
Delete "$SMPROGRAMS\WinShear32 Viewer\WinShear32 Viewer.lnk"
Delete "$SMPROGRAMS\WinShear32 Viewer\Measurement of Fluid Rheology.lnk"
Delete "$SMPROGRAMS\WinShear32 Viewer\Uninstall.lnk"

; Clean up WinShear32 Viewer
Delete "$INSTDIR\Pegraphs.gid"
Delete "$INSTDIR\Pegraphs.hlp"
Delete "$INSTDIR\Welcome.txt"
Delete "$INSTDIR\WS32viewer.exe"
Delete "$INSTDIR\Winshear32.ico"
Delete "$INSTDIR\WS32viewer.chm"
Delete "$INSTDIR\thermo_j.tbl"
Delete "$INSTDIR\thermo_k.tbl"
Delete "$INSTDIR\thermo_t.tbl"
Delete "$INSTDIR\Measurement of Fluid Rheology.pdf"

;Clean up the default files
Delete "$INSTDIR\files\A bob 1100.vis"
Delete "$INSTDIR\files\Blank.vis"
Delete "$INSTDIR\files\E bob 4400.vis"
Delete "$INSTDIR\files\FF bob 6600.vis"
Delete "$INSTDIR\files\F25 bob 8800.vis"

;Clean up proprietary system files
Delete "$SYSDIR\TAB32X30.ocx"
Delete "$SYSDIR\Pesgo32a.ocx"
Delete "$SYSDIR\PEGRP32a.dll"
Delete "$WINDIR\WS32view.ini"

; Clean up Adobe Acrobat Reader
Delete "$TEMP\AdbeRdr11006_en_US.exe"

; Remove remaining directories
RMDir "$SMPROGRAMS\WinShear32 Viewer\files"
RMDir "$SMPROGRAMS\WinShear32 Viewer"


Section "-un.Uninstall VB6 run-time files"

!insertmacro VB6RunTimeUnInstall


BrandingText "2018 Kaltec Scientific, Inc."

; eof

Thanks for any input.
Scottswan is offline   Reply With Quote
Old 29th January 2018, 16:30   #2
Anders's Avatar
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,658
VB6RunTimeInstall does not register ocx files. See "Appendix B: DLL/TLB Library Setup" in the helpfile or use RegDll.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 30th January 2018, 16:24   #3
Junior Member
Join Date: Sep 2005
Location: MI
Posts: 6
I tried RegDLL on every ocx, same error. I tried manually registering ocx's and dll's on Win 7 using the 32 bit ver of regsvr32 and all of them would load but error that a dependency is missing in order to register. Very confusing. Something is still missing. MS has a vbrun60.exe that has everything to run a VB6 app, I'm going to try that tonight.
Scottswan is offline   Reply With Quote
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump