Re : événement rotation d'écran introuvable
[h=4]j'ai repris tes recherches tatiak et je suis tombé sur le même site microsoft que toi : Ce lien n'existe plus
ci-après les explications qu'ils donnent et dont je ne sais pas quoi faire vu que je ne pratique pas les userform.
si quelqu'un pouvait mettre ça sur un fichier excel cela me dépannerait[/h]To detect screen rotation in applications written in Visual Basic 6.0, you hook the WindowProc function to listen for a Ce lien n'existe plus message. You then use the lParam parameter of the WindowProc function to retrieve the height and width of the full screen, as in the previous Visual Basic 6.0 example. Finally, you unhook, restoring the default WindowProc function. The following Visual Basic 6.0 example illustrates this process.
The form's code:
Private Sub Form_Load() gHW = Me.hwnd HookEnd SubPrivate Sub Form_Terminate() UnhookEnd Sub
The module's code:
Declare Function CallWindowProc Lib "user32" Alias _"CallWindowProcA" (ByVal lpPrevWndFunc As Long, _ByVal hwnd As Long, ByVal Msg As Long, _ByVal wParam As Long, ByVal lParam As Long) As LongDeclare Function SetWindowLong Lib "user32" Alias _"SetWindowLongA" (ByVal hwnd As Long, _ByVal nIndex As Long, ByVal dwNewLong As Long) As LongPublic Const GWL_WNDPROC = -4Public Const WM_DISPLAYCHANGE = 126Global lpPrevWndProc As LongGlobal gHW As LongPublic Sub Hook() lpPrevWndProc = SetWindowLong(gHW, GWL_WNDPROC, _ AddressOf WindowProc)End SubPublic Sub Unhook() Dim temp As Long temp = SetWindowLong(gHW, GWL_WNDPROC, _ lpPrevWndProc)End SubFunction WindowProc(ByVal hw As Long, ByVal uMsg As _Long, ByVal wParam As Long, ByVal lParam As Long) As _Long 'Activated when display changes If uMsg = WM_DISPLAYCHANGE Then 'Separate the width and height and then 'check to see if screen width is greater than screen height If lParam Mod &H10000 > lParam \ &H10000 Then 'Run the application in landscape, for example: MsgBox "Run in landscape." Else 'Run the application in portrait, for example: MsgBox "Run in portrait." End If End If 'Pass windows messages on to the default WindowProc WindowProc = CallWindowProc(lpPrevWndProc, hw, _ uMsg, wParam, lParam)End Function