Bonjour,=20
j'ai une appli sous Access,
et je voudrais savoir si il est possible d'int=E9grer un=20
formulaire fait sous Visual Basic dans mon application=20
Access.
Merci d'avance
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
3stone
Salut,
j'ai une appli sous Access, et je voudrais savoir si il est possible d'intégrer un formulaire fait sous Visual Basic dans mon application Access.
Je ne pense pas.... La définition des sources du formulaire et des contrôles doit sûrement être différent...
Et puis... tu Access, les formulaires se créent rapidement ;-)
-- A+ Pierre (3stone) Access MVP -------------------------------------- Une pour tous, tous pour une ;-) http://users.skynet.be/mpfa/charte.htm --------------------------------------
Salut,
j'ai une appli sous Access,
et je voudrais savoir si il est possible d'intégrer un
formulaire fait sous Visual Basic dans mon application
Access.
Je ne pense pas....
La définition des sources du formulaire et des contrôles
doit sûrement être différent...
Et puis... tu Access, les formulaires se créent rapidement ;-)
--
A+
Pierre (3stone) Access MVP
--------------------------------------
Une pour tous, tous pour une ;-)
http://users.skynet.be/mpfa/charte.htm
--------------------------------------
j'ai une appli sous Access, et je voudrais savoir si il est possible d'intégrer un formulaire fait sous Visual Basic dans mon application Access.
Je ne pense pas.... La définition des sources du formulaire et des contrôles doit sûrement être différent...
Et puis... tu Access, les formulaires se créent rapidement ;-)
-- A+ Pierre (3stone) Access MVP -------------------------------------- Une pour tous, tous pour une ;-) http://users.skynet.be/mpfa/charte.htm --------------------------------------
Guy DETIENNE
Salut ;O)
Si tu parles d'un formulaire VB en mode création, bien entendu que ce n'est pas faisable. Par contre tu pourrais très bien intégrer un programme compilé en VB (donc un exe) contenant un formulaire dans ton formulaire Access et cela sans problème.
Pour cela, on utilisera la merveilleuse API SetParent et quelques autres. Je te propose un exemple (tiré de AllApi.Net) avec le NotePad qui s'intégre efficacement dans un formulaire Access. J'ai testé et ca fonctionne très bien.
Donc ce code est à intégrer dans un formulaire Access
Bonne chance.
Guy
---CODE------
Option Compare Database Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Long, ByVal lpWindowName As Long) As Long Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long Private Declare Function GetDesktopWindow Lib "user32" () As Long Private Declare Function DestroyWindow Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function Putfocus Lib "user32" Alias "SetFocus" (ByVal hwnd As Long) As Long Const GW_HWNDNEXT = 2 Dim mWnd As Long
Function InstanceToWnd(ByVal target_pid As Long) As Long Dim test_hwnd As Long, test_pid As Long, test_thread_id As Long 'Find the first window test_hwnd = FindWindow(ByVal 0&, ByVal 0&) Do While test_hwnd <> 0 'Check if the window isn't a child If GetParent(test_hwnd) = 0 Then 'Get the window's thread test_thread_id = GetWindowThreadProcessId(test_hwnd, test_pid) If test_pid = target_pid Then InstanceToWnd = test_hwnd Exit Do End If End If 'retrieve the next window test_hwnd = GetWindow(test_hwnd, GW_HWNDNEXT) Loop End Function Private Sub Form_Load() Dim Pid As Long 'Lock the window update LockWindowUpdate GetDesktopWindow 'Il suffit de changer le contenu du Shell par le chemin de ton programme VB Pid = Shell("c:winntnotepad.exe", vbNormalFocus) If Pid = 0 Then MsgBox "Error starting the app" 'retrieve the handle of the window mWnd = InstanceToWnd(Pid) 'Set the notepad's parent SetParent mWnd, Me.hwnd 'Put the focus on notepad Putfocus mWnd 'Unlock windowupdate LockWindowUpdate False End Sub Private Sub Form_Unload(Cancel As Integer) 'Unload notepad DestroyWindow mWnd 'End this program End Sub
-- __________________________________ Tchao.net: L'informatique à votre dimension www.tchao.net Pour toute réponse, retirer le .nospam de l'adresse mail ou cliquez ici http://cerbermail.com/?6nQ9U2fpkD
"jp" a écrit dans le message de news:08a601c3bfc1$ac13d4c0$ Bonjour, j'ai une appli sous Access, et je voudrais savoir si il est possible d'intégrer un formulaire fait sous Visual Basic dans mon application Access. Merci d'avance
Salut ;O)
Si tu parles d'un formulaire VB en mode création, bien entendu que ce n'est
pas faisable.
Par contre tu pourrais très bien intégrer un programme compilé en VB (donc
un exe) contenant un formulaire dans ton formulaire Access et cela sans
problème.
Pour cela, on utilisera la merveilleuse API SetParent et quelques autres.
Je te propose un exemple (tiré de AllApi.Net) avec le NotePad qui s'intégre
efficacement dans un formulaire Access.
J'ai testé et ca fonctionne très bien.
Donc ce code est à intégrer dans un formulaire Access
Bonne chance.
Guy
---CODE------
Option Compare Database
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal
lpClassName As Long, ByVal lpWindowName As Long) As Long
Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long,
ByVal hWndNewParent As Long) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd
As Long, lpdwProcessId As Long) As Long
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal
wCmd As Long) As Long
Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As
Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function DestroyWindow Lib "user32" (ByVal hwnd As Long) As
Long
Private Declare Function Putfocus Lib "user32" Alias "SetFocus" (ByVal hwnd
As Long) As Long
Const GW_HWNDNEXT = 2
Dim mWnd As Long
Function InstanceToWnd(ByVal target_pid As Long) As Long
Dim test_hwnd As Long, test_pid As Long, test_thread_id As Long
'Find the first window
test_hwnd = FindWindow(ByVal 0&, ByVal 0&)
Do While test_hwnd <> 0
'Check if the window isn't a child
If GetParent(test_hwnd) = 0 Then
'Get the window's thread
test_thread_id = GetWindowThreadProcessId(test_hwnd, test_pid)
If test_pid = target_pid Then
InstanceToWnd = test_hwnd
Exit Do
End If
End If
'retrieve the next window
test_hwnd = GetWindow(test_hwnd, GW_HWNDNEXT)
Loop
End Function
Private Sub Form_Load()
Dim Pid As Long
'Lock the window update
LockWindowUpdate GetDesktopWindow
'Il suffit de changer le contenu du Shell par le chemin de ton programme
VB
Pid = Shell("c:winntnotepad.exe", vbNormalFocus)
If Pid = 0 Then MsgBox "Error starting the app"
'retrieve the handle of the window
mWnd = InstanceToWnd(Pid)
'Set the notepad's parent
SetParent mWnd, Me.hwnd
'Put the focus on notepad
Putfocus mWnd
'Unlock windowupdate
LockWindowUpdate False
End Sub
Private Sub Form_Unload(Cancel As Integer)
'Unload notepad
DestroyWindow mWnd
'End this program
End Sub
--
__________________________________
Tchao.net: L'informatique à votre dimension
www.tchao.net
Pour toute réponse, retirer le .nospam de l'adresse mail
ou cliquez ici http://cerbermail.com/?6nQ9U2fpkD
"jp" <anonymous@discussions.microsoft.com> a écrit dans le message de
news:08a601c3bfc1$ac13d4c0$a301280a@phx.gbl...
Bonjour,
j'ai une appli sous Access,
et je voudrais savoir si il est possible d'intégrer un
formulaire fait sous Visual Basic dans mon application
Access.
Merci d'avance
Si tu parles d'un formulaire VB en mode création, bien entendu que ce n'est pas faisable. Par contre tu pourrais très bien intégrer un programme compilé en VB (donc un exe) contenant un formulaire dans ton formulaire Access et cela sans problème.
Pour cela, on utilisera la merveilleuse API SetParent et quelques autres. Je te propose un exemple (tiré de AllApi.Net) avec le NotePad qui s'intégre efficacement dans un formulaire Access. J'ai testé et ca fonctionne très bien.
Donc ce code est à intégrer dans un formulaire Access
Bonne chance.
Guy
---CODE------
Option Compare Database Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Long, ByVal lpWindowName As Long) As Long Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long Private Declare Function GetDesktopWindow Lib "user32" () As Long Private Declare Function DestroyWindow Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function Putfocus Lib "user32" Alias "SetFocus" (ByVal hwnd As Long) As Long Const GW_HWNDNEXT = 2 Dim mWnd As Long
Function InstanceToWnd(ByVal target_pid As Long) As Long Dim test_hwnd As Long, test_pid As Long, test_thread_id As Long 'Find the first window test_hwnd = FindWindow(ByVal 0&, ByVal 0&) Do While test_hwnd <> 0 'Check if the window isn't a child If GetParent(test_hwnd) = 0 Then 'Get the window's thread test_thread_id = GetWindowThreadProcessId(test_hwnd, test_pid) If test_pid = target_pid Then InstanceToWnd = test_hwnd Exit Do End If End If 'retrieve the next window test_hwnd = GetWindow(test_hwnd, GW_HWNDNEXT) Loop End Function Private Sub Form_Load() Dim Pid As Long 'Lock the window update LockWindowUpdate GetDesktopWindow 'Il suffit de changer le contenu du Shell par le chemin de ton programme VB Pid = Shell("c:winntnotepad.exe", vbNormalFocus) If Pid = 0 Then MsgBox "Error starting the app" 'retrieve the handle of the window mWnd = InstanceToWnd(Pid) 'Set the notepad's parent SetParent mWnd, Me.hwnd 'Put the focus on notepad Putfocus mWnd 'Unlock windowupdate LockWindowUpdate False End Sub Private Sub Form_Unload(Cancel As Integer) 'Unload notepad DestroyWindow mWnd 'End this program End Sub
-- __________________________________ Tchao.net: L'informatique à votre dimension www.tchao.net Pour toute réponse, retirer le .nospam de l'adresse mail ou cliquez ici http://cerbermail.com/?6nQ9U2fpkD
"jp" a écrit dans le message de news:08a601c3bfc1$ac13d4c0$ Bonjour, j'ai une appli sous Access, et je voudrais savoir si il est possible d'intégrer un formulaire fait sous Visual Basic dans mon application Access. Merci d'avance