OVH Cloud OVH Cloud

Microsoft Common Dialog Control

2 réponses
Avatar
Stephane-IMV
Lorsque j'essaie d'incoporer un activeX : le Microsoft Common Dialog Control
version 6.0, le système m'indique que je n'ai pas la licence et de contacter
le concepteur (très drôle !!!)
Je l'ai déinscrit et réinscrit dans la base de registre sans résultat. Merci

2 réponses

Avatar
Michel BERTRAND
Bonjour

il y a peut-etre moyen de contourner avec

dans le module general

Public 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


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


et sur command click


Private Sub Commande0_Click()
Me.Fichier.SetFocus
'Set the structure size
OFName.lStructSize = Len(OFName)
'Set the owner window
OFName.hwndOwner = Me.Hwnd
'Set the application's instance
OFName.hInstance = Application.hWndAccessApp
'Set the filet
' sequence type fichier :
'test (*.tst)" + Chr$(0) + "*.tst" + Chr$(0)

OFName.lpstrFilter = "images (*.jpg)" + Chr$(0) + "*.jpg" + Chr$(0) +
"Text Files (*.txt)" + Chr$(0) + "*.txt" + Chr$(0) + "All Files (*.*)" +
Chr$(0) + "*.*" + Chr$(0)
'Create a buffer
OFName.lpstrFile = Space$(254)
'Set the maximum number of chars
OFName.nMaxFile = 255
'Create a buffer
OFName.lpstrFileTitle = Space$(254)
'Set the maximum number of chars
OFName.nMaxFileTitle = 255
'Set the initial directory
OFName.lpstrInitialDir = "C:"
'Set the dialog title
OFName.lpstrTitle = "Open File - KPD-Team 1998"
'no extra flags
OFName.flags = 0
'Show the 'Open File'-dialog
If GetOpenFileName(OFName) Then
'on recupere 254 caractere il faut limiter au fichier et trouver chr(0)
a = InStr(OFName.lpstrFile, Chr(0))
Me.Fichier = Left(OFName.lpstrFile, a - 1)
Image5.Picture = Me.Fichier
Else

End If


Voila a tester

Cordialement

Michel BERTRAND
Avatar
Stephane-IMV
Avec quelques modifs c'est tout bon. Merci beaucoup.