Saturday, July 24, 2010

KrzYoptimizer v1.13.2 finally

This time I'm trying to use API calls instead of built in VB componennts/objects. I managed to get rid of comdlg32.ocx requirement. What does that mean? Less memory, more performance, faster. Sometimes I noticed lag when opening a file when api WAS NOT USED (version 1.12 and less)! This time the dialog opens incredibly fast and also no ocx resides in memory this time. The DLL is called only when needed.

Adding PNG/JPG files was fixed, PK->ExtPK was flagging directories a compressed with maximum compression (shouldn't be, fixed; actually nothing really bad happened, except some few programs reporting directories as errors but they were decompressed successfully) Last file had wrong name after ExtPK->PK conversion, FIXED. New ZIPtoGZ algorithm used in Menu Convert, now also used after optimization. Removed requirement for MSSTDFMT.DLL (accidentally added in v1.12, sry about that).

Download
Changelog

Open Dialog api call I'm using:


Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long

Private Type OPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type

Public Function BrowseFile$(BF_FILTER$, Optional BF_MULTI& = 0)

Dim iStrip%
Dim lR&
Dim ofn As OPENFILENAME

ofn.lStructSize = Len(ofn)
ofn.hwndOwner = frmZipSlim.hwnd
ofn.hInstance = App.hInstance
ofn.lpstrFilter = BF_FILTER + vbNullChar
ofn.nFilterIndex = 1
ofn.lpstrFile = String$(257, 0)
ofn.nMaxFile = Len(ofn.lpstrFile) - 1
ofn.lpstrFileTitle = ofn.lpstrFile
ofn.nMaxFileTitle = ofn.nMaxFile
If FIRST_TIME_OPEN = 0 Then
ofn.lpstrInitialDir = App.Path
FIRST_TIME_OPEN = 1
End If
ofn.lpstrTitle = "Select File"
ofn.flags = &H80000 Or (&H200 * BF_MULTI)
lR = GetOpenFileName(ofn)
If lR <> 0 Then
iStrip = InStr(1, ofn.lpstrFile, vbNullChar + vbNullChar) - 1
If iStrip = 0 Then iStrip = ofn.nMaxFile
BrowseFile = Left(ofn.lpstrFile, iStrip)
End If
End Function

No comments: