Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Freecell sur UserForm

6 réponses
Avatar
RV
Bonjour,
Je souhaite mettre un raccourci Freecell sur un UserForm. Je n'y arrive pas
car je vais le chercher en tant qu' image. Qu'elle est la solution? Mettre
un CommandButton et écrire la procédure d'ouverture de Freecell ou bien
l'insertion du raccourci, si elle est possible, suffit-elle?
Merci et bonne journée.
Cordialement.
RV

6 réponses

Avatar
anonymousA
Bonjour,

Qu'est ce que Freecell ?

A+
Avatar
RV
Bonjour AnonymousA,
C'est un jeux de cartes sur Windows.
J'en profite pour demander pourquoi je n'ai aucun affichage dans mes
TextBox. Je tourne en rond depuis ce matin. Aurais-je oublié de modifier
certains paramètres dans la fenêtre des propriétés, mais je ne vois pas
lesquels.
Merci de ton aide.

Private Sub ComboBox1_Change()
a = "Parties"
b = "Etats"
c = "Difficultés"
d = "Dates"
On Error Resume Next
With FrmJeux.Frame3.Frame1
.Controls("TextBox1") =
Range(b).Item(Application.Match(FrmJeux.Frame3.Frame1.ComboBox1.Value,
Range(a), 0))
.Controls("TextBox4") =
Range(c).Item(Application.Match(FrmJeux.Frame3.Frame1.ComboBox1.Value,
Range(a), 0))
.Controls("TextBox5") =
Range(d).Item(Application.Match(FrmJeux.Frame3.Frame1.ComboBox1.Value,
Range(a), 0))
End With
End Sub


RV



"anonymousA" a écrit dans le message de news:

Bonjour,

Qu'est ce que Freecell ?

A+



Avatar
michdenis
Bonjour RV,

Pour lancer FreeCell,

'Il est possible que le chemin soit différent selon les systèmes d'exploitation.
Chemin sur windows xp pro.

Shell "c:windowssystem32freecell.exe", vbNormalFocus



Salutations!




"RV" a écrit dans le message de news:
Bonjour,
Je souhaite mettre un raccourci Freecell sur un UserForm. Je n'y arrive pas
car je vais le chercher en tant qu' image. Qu'elle est la solution? Mettre
un CommandButton et écrire la procédure d'ouverture de Freecell ou bien
l'insertion du raccourci, si elle est possible, suffit-elle?
Merci et bonne journée.
Cordialement.
RV
Avatar
RV
Bonjour Michdenis,
Le chemin est bon et je te remercie de ton aide.
Comment faire pour récupérer l'icone du jeu pour la placer sur un bouton.
Merci
Bonne soirée.
RV



"michdenis" a écrit dans le message de news:

Bonjour RV,

Pour lancer FreeCell,

'Il est possible que le chemin soit différent selon les systèmes
d'exploitation.
Chemin sur windows xp pro.

Shell "c:windowssystem32freecell.exe", vbNormalFocus



Salutations!




"RV" a écrit dans le message de news:

Bonjour,
Je souhaite mettre un raccourci Freecell sur un UserForm. Je n'y arrive
pas
car je vais le chercher en tant qu' image. Qu'elle est la solution? Mettre
un CommandButton et écrire la procédure d'ouverture de Freecell ou bien
l'insertion du raccourci, si elle est possible, suffit-elle?
Merci et bonne journée.
Cordialement.
RV





Avatar
Jacques93
Bonjour RV,

Tu peux essayer,inspiré de :

http://www.vb-fun.de/cgi-bin/loadframe.pl?ID=vb/tipps/tip0326.shtml

Option Explicit

Private Declare Function ExtractIcon Lib "shell32.dll" Alias _
"ExtractIconA" (ByVal hInst As Long, ByVal _
lpszExeFileName As String, _
ByVal nIconIndex As Long) As Long
Private Declare Function SHGetFileInfo Lib "shell32.dll" Alias _
"SHGetFileInfoA" (ByVal pszPath As String, ByVal _
dwFileAttributes As Long, psfi As SHFILEINFO, ByVal _
cbFileInfo As Long, ByVal uFlags As Long) As Long
Private Declare Function OleCreatePictureIndirect Lib _
"olepro32.dll" (ByRef pPictDesc As PICTDESC, _
ByRef riid As GUID, ByVal fOwn As Long, _
ByRef ppvObj As IPictureDisp) As Long

Private Type PICTDESC
cbSizeofStruct As Long
PicType As Long
hImage As Long
xExt As Long
yExt As Long
End Type

Private Type GUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(0 To 7) As Byte
End Type

Private Const MAX_PATH = 260
Private Const SHGFI_ICON = &H100
Private Const SHGFI_SMALLICON = &H1

Private Type SHFILEINFO
hIcon As Long
iIcon As Long
dwAttributes As Long
szDisplayName As String * MAX_PATH
szTypeName As String * 80
End Type

Public Function GetPictureFromFile(ByVal fName As String, _
Optional bSmallIcon As Boolean = False) _
As IPictureDisp

Dim shFI As SHFILEINFO
Dim PicTmp As IPictureDisp
Dim PicDes As PICTDESC
Dim IID_IDispatch As GUID

SHGetFileInfo fName, -1, shFI, -1, SHGFI_ICON Or _
IIf(bSmallIcon, SHGFI_SMALLICON, 0)
If shFI.hIcon = 0 Then
shFI.hIcon = ExtractIcon(Application.Hinstance, fName, 0)
End If

IID_IDispatch.Data1 = &H20400
IID_IDispatch.Data4(0) = &HC0
IID_IDispatch.Data4(7) = &H46

PicDes.cbSizeofStruct = Len(PicDes)
PicDes.PicType = 3 'vbPicTypeIcon
PicDes.hImage = shFI.hIcon

OleCreatePictureIndirect PicDes, IID_IDispatch, True, PicTmp
Set GetPictureFromFile = PicTmp
End Function

Private Sub UserForm_Initialize()
Dim pic As IPictureDisp

Set pic = GetPictureFromFile("C:WindowsSystem32Freecell.exe")
With Me.CommandButton1
.Height = 60
.Width = 90
.Caption = "Freecell"
.PicturePosition = fmPicturePositionAboveCenter
.Picture = pic
End With
End Sub

Bonjour Michdenis,
Le chemin est bon et je te remercie de ton aide.
Comment faire pour récupérer l'icone du jeu pour la placer sur un bouton.
Merci
Bonne soirée.
RV


--
Cordialement,

Jacques.

Avatar
RV
Bonsoir Jacques93,
Ces lignes de code dépassent largement mes compétences, mais il n'en reste
pas moins que cela fonctionne.
J'ai adapté à mes besoins(...).
Je te remercie de ton aide précieuse.
Bonne soirée
Cordialement
RV


"Jacques93" a écrit dans le message de news:

Bonjour RV,

Tu peux essayer,inspiré de :

http://www.vb-fun.de/cgi-bin/loadframe.pl?ID=vb/tipps/tip0326.shtml

Option Explicit

Private Declare Function ExtractIcon Lib "shell32.dll" Alias _
"ExtractIconA" (ByVal hInst As Long, ByVal _
lpszExeFileName As String, _
ByVal nIconIndex As Long) As Long
Private Declare Function SHGetFileInfo Lib "shell32.dll" Alias _
"SHGetFileInfoA" (ByVal pszPath As String, ByVal _
dwFileAttributes As Long, psfi As SHFILEINFO, ByVal _
cbFileInfo As Long, ByVal uFlags As Long) As Long
Private Declare Function OleCreatePictureIndirect Lib _
"olepro32.dll" (ByRef pPictDesc As PICTDESC, _
ByRef riid As GUID, ByVal fOwn As Long, _
ByRef ppvObj As IPictureDisp) As Long

Private Type PICTDESC
cbSizeofStruct As Long
PicType As Long
hImage As Long
xExt As Long
yExt As Long
End Type

Private Type GUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(0 To 7) As Byte
End Type

Private Const MAX_PATH = 260
Private Const SHGFI_ICON = &H100
Private Const SHGFI_SMALLICON = &H1

Private Type SHFILEINFO
hIcon As Long
iIcon As Long
dwAttributes As Long
szDisplayName As String * MAX_PATH
szTypeName As String * 80
End Type

Public Function GetPictureFromFile(ByVal fName As String, _
Optional bSmallIcon As Boolean = False) _
As IPictureDisp

Dim shFI As SHFILEINFO
Dim PicTmp As IPictureDisp
Dim PicDes As PICTDESC
Dim IID_IDispatch As GUID

SHGetFileInfo fName, -1, shFI, -1, SHGFI_ICON Or _
IIf(bSmallIcon, SHGFI_SMALLICON, 0)
If shFI.hIcon = 0 Then
shFI.hIcon = ExtractIcon(Application.Hinstance, fName, 0)
End If

IID_IDispatch.Data1 = &H20400
IID_IDispatch.Data4(0) = &HC0
IID_IDispatch.Data4(7) = &H46

PicDes.cbSizeofStruct = Len(PicDes)
PicDes.PicType = 3 'vbPicTypeIcon
PicDes.hImage = shFI.hIcon

OleCreatePictureIndirect PicDes, IID_IDispatch, True, PicTmp
Set GetPictureFromFile = PicTmp
End Function

Private Sub UserForm_Initialize()
Dim pic As IPictureDisp

Set pic = GetPictureFromFile("C:WindowsSystem32Freecell.exe")
With Me.CommandButton1
.Height = 60
.Width = 90
.Caption = "Freecell"
.PicturePosition = fmPicturePositionAboveCenter
.Picture = pic
End With
End Sub

Bonjour Michdenis,
Le chemin est bon et je te remercie de ton aide.
Comment faire pour récupérer l'icone du jeu pour la placer sur un bouton.
Merci
Bonne soirée.
RV


--
Cordialement,

Jacques.