Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Suite Pro
  New Posts New Posts RSS Feed - CommonDialog CJ13 Windows 10 freeze
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CommonDialog CJ13 Windows 10 freeze

 Post Reply Post Reply
Author
Message
Arnoutdv View Drop Down
Groupie
Groupie


Joined: 29 September 2010
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote Arnoutdv Quote  Post ReplyReply Direct Link To This Post Topic: CommonDialog CJ13 Windows 10 freeze
    Posted: 02 August 2016 at 10:38am
Some of our clients using an older application built using C.J. 13.0.0 on Windows 10 experience problems when using the CommonDialog control from the Suite Controls.
The application freezes and then crashes when the CommonDialog ShowSave/ShowOpen is executed.

I can not reproduce the problem using a small test application on the client computer.

In the event viewer you get the following entry (translated from dutch screen shot):
Exception: 0xc0000409
Path to module: c:\windows\system32\windows.storage.dll



The application is also skinned using the SkinFrameWork, also version 13.0.0

Any clues how to proceed?
VB6 SP6, SuitePro 16.3.0 / 18.2.0, Win10/64
Back to Top
Arnoutdv View Drop Down
Groupie
Groupie


Joined: 29 September 2010
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote Arnoutdv Quote  Post ReplyReply Direct Link To This Post Posted: 18 October 2016 at 11:36am
It's said to notice that CodeJock representatives not even react to this post.

I'm also experiencing now the same problem using CodeJock v16.3.0 in our latest application:
http://forum.codejock.com/forum_posts.asp?TID=23164&title=commondialog-crashes
VB6 SP6, SuitePro 16.3.0 / 18.2.0, Win10/64
Back to Top
olebed View Drop Down
Admin Group
Admin Group
Avatar

Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 654
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 18 October 2016 at 2:50pm
Hi, I think this helps.
Back to Top
Arnoutdv View Drop Down
Groupie
Groupie


Joined: 29 September 2010
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote Arnoutdv Quote  Post ReplyReply Direct Link To This Post Posted: 19 October 2016 at 6:37am
I placed the line 
SkinFramework1.ExcludeModule "AcLayers.dll"

before skin is loaded, doesn't help on the crashing the BrowseForFolder dialog

Option Explicit

'========================================================================================
' User control:  modUniBrowseForFolder
' Author:        Zhu JinYong
' Original By:   DaVBMan (http://vbcity.com/forums/t/67223.aspx)
' Dependencies:  -None-
' Compatibility: Unicode Tested on XP/Vista/Win7
' Last revision: 18/5/2011
' About Author:  P.R.China,Anhui Province,Anqing City
'                Zong Yang County,HuiGong Town,BaMao,Song Ke Village
'----------------------------------------------------------------------------------------
Private Type BrowseInfo
  hWndOwner As Long
  pIDLRoot As Long
  pszDisplayName As Long 'String
  lpszTitle As Long 'String
  ulFlags As Long
  lpfnCallback As Long
  lParam As Long
  iImage As Long
End Type

Private Const BIF_RETURNONLYFSDIRS = &H1
Private Const BIF_DONTGOBELOWDOMAIN = &H2
Private Const BIF_STATUSTEXT = &H4
Private Const BIF_RETURNFSANCESTORS = &H8
Private Const BIF_EDITBOX = &H10
Private Const BIF_VALIDATE = &H20
Private Const BIF_NEWDIALOGSTYLE = &H40
Private Const BIF_USENEWUI = (BIF_NEWDIALOGSTYLE Or BIF_EDITBOX)
Private Const BIF_BROWSEINCLUDEURLS = &H80
Private Const BIF_UAHINT = &H100
Private Const BIF_NONEWFOLDERBUTTON = &H200
Private Const BIF_NOTRANSLATETARGETS = &H400
Private Const BIF_BROWSEFORCOMPUTER = &H1000
Private Const BIF_BROWSEFORPRINTER = &H2000
Private Const BIF_BROWSEINCLUDEFILES = &H4000
Private Const BIF_SHAREABLE = &H8000
Private Const MAX_PATH = 260
Private Const WM_USER = &H400

Private Const BFFM_INITIALIZED = 1
Private Const BFFM_SELCHANGED = 2
Private Const BFFM_VALIDATEFAILEDA = 3  '// lParam:szPath ret:1(cont),0(EndDialog)
Private Const BFFM_VALIDATEFAILEDW = 4  '// lParam:wzPath ret:1(cont),0(EndDialog)
Private Const BFFM_IUNKNOWN = 5         '// provides IUnknown to client. lParam: IUnknown*

'// messages to browser
Private Const BFFM_SETSTATUSTEXT = (WM_USER + 100)
Private Const BFFM_SETSTATUSTEXTW = WM_USER + 104
Private Const BFFM_SETSELECTION = (WM_USER + 102)
Private Const BFFM_SETSELECTIONW = (WM_USER + 103)
Private Const BFFM_ENABLEOK = WM_USER + 101

'Private Declare Function SHGetPathFromIDListA Lib "shell32.dll" (ByVal pidl As Long, ByVal pszPath As String) As Long
Private Declare Function SHGetPathFromIDListW Lib "shell32" (ByVal pidList As Long, ByVal lpBuffer As Long) As Long

'Private Declare Function SHBrowseForFolderA Lib "shell32.dll" (lpBrowseInfo As BrowseInfo) As Long
Private Declare Function SHBrowseForFolderW Lib "shell32" (lpbi As BrowseInfo) As Long

Private Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal pv As Long)

'Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Private Declare Function SendMessageW Lib "user32" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (lpvDest As Any, lpvSource As Any, ByVal cbCopy As Long)
    
Public Function BrowseForFolderW(ByVal hWndModal As Long, Optional Title As String = "Please select a folder:", Optional StartFolder As String = "", _
   Optional IncludeFiles As Boolean = False, Optional IncludeNewFolderButton As Boolean = False) As String
    Dim bInf As BrowseInfo
    Dim RetVal As Long
    Dim PathID As Long
    Dim RetPath As String
    Dim Offset As Integer
    Dim szTitleInfo() As Byte
    Dim strSTARTFOLDER As String
    
    'Set the properties of the folder dialog
    With bInf
         .hWndOwner = hWndModal
         .pIDLRoot = 0
         szTitleInfo = Title & vbNullChar
         .lpszTitle = VarPtr(szTitleInfo(0))
         .ulFlags = IIf(IncludeFiles, BIF_BROWSEINCLUDEFILES, BIF_RETURNONLYFSDIRS) + BIF_DONTGOBELOWDOMAIN + BIF_USENEWUI + _
                    IIf(IncludeNewFolderButton, 0&, BIF_NONEWFOLDERBUTTON)
         If IncludeFiles Then .ulFlags = .ulFlags Or BIF_BROWSEINCLUDEFILES
         If IncludeNewFolderButton Then .ulFlags = .ulFlags Or BIF_NEWDIALOGSTYLE
         If StartFolder <> "" Then
            strSTARTFOLDER = StartFolder & vbNullChar
           .lpfnCallback = GetAddressofFunction(AddressOf BrowseCallbackProc) 'get address of function.
           .lParam = StrPtr(strSTARTFOLDER)
         End If
     End With
     
    'Show the Browse For Folder dialog
    PathID = SHBrowseForFolderW(bInf)
    If PathID = 0 Then Exit Function
    
    RetPath = Space$(MAX_PATH)
    RetVal = SHGetPathFromIDListW(PathID, StrPtr(RetPath))
    If RetVal Then
         'Trim off the null chars ending the path
         'and display the returned folder
         Offset = InStr(RetPath, Chr$(0))
         BrowseForFolderW = Left$(RetPath, Offset - 1)
         'Free memory allocated for PIDL
         CoTaskMemFree PathID
    Else
         BrowseForFolderW = ""
    End If
End Function

Private Function BrowseCallbackProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal lp As Long, ByVal pData As Long) As Long
   Dim lpIDList As Long
   Dim ret As Long
   Dim sBuffer As String
   
   On Error Resume Next
   
   Select Case uMsg
       Case BFFM_INITIALIZED
           Call SendMessageW(hwnd, BFFM_SETSELECTIONW, 1&, pData) 'StrPtr(mstrSTARTFOLDER)) 'Private mstrSTARTFOLDER As String
       Case BFFM_SELCHANGED
           sBuffer = Space(MAX_PATH)
           ret = SHGetPathFromIDListW(lp, StrPtr(sBuffer))
           If ret = 1 Then
               Call SendMessageW(hwnd, BFFM_SETSTATUSTEXTW, 0, StrPtr(sBuffer))
           End If
   End Select
   BrowseCallbackProc = 0
End Function

Private Function GetAddressofFunction(add As Long) As Long
   GetAddressofFunction = add
End Function

For Vista and up I also have the following code:
Private Function pBrowseForFolderIDialog(ByVal sPrompt As String, sInitDir As String) As String
  Dim cIFileDialog As IFileDialog
  Dim lMode As Long
  
  Set cIFileDialog = New IFileDialog
  
  cIFileDialog.propFlags = FOS__BrowseFoldersDefaults Or FOS_ALLNONSTORAGEITEMS
  'cIFileDialog.propDefaultFolder_Set sInitDir, ppType_AsString
  'cIFileDialog.propInitialFileName = sInitDir
  cIFileDialog.propStartupFolder_Set sInitDir, ppType_AsString
  lMode = cIFileDialog.DialogShow(0, FDLG_BROWSEFOLDERS, sPrompt)
  
  If lMode = 0 Then
    If cIFileDialog.ResultsCount = 1 Then
      pBrowseForFolderIDialog = cIFileDialog.IShellItem_GetDisplayName(ObjPtr(cIFileDialog.ResultsItem(1)), SIGDN_DESKTOPABSOLUTEEDITING, False)
    End If
  ElseIf lMode = FD_CANCEL Then
    ' Cancel clicked
  Else
    ' Other error
  End If
  
End Function
The above code refers to the class in the following ZIP

uploads/6401/clsIFileDialog.zip


Note:
Both methods using IFileDialog and the SHBrowseForFolderW API crashes on some Win10 64 bit configurations when the application is skinned.

VB6 SP6, SuitePro 16.3.0 / 18.2.0, Win10/64
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.078 seconds.