Prev: Copy a Folder
Next: Vista Crashes, XP does not
From: Ed from AZ on 9 Aug 2010 13:32 The video driver used to do it, but it broke with the upgrade from XP SP2 to SP3. Known issue, no fix, so brainstorming for other possible solutions. Older laptop, not worth it to get a new video card. A free 3rd-party driver solution would be nice - a whole lot nicer than trying to rotate this form and deal with all the fallout! That Samsung program looks great and might even be compatible - I'll have to give that a try. Thanks!! Ed On Aug 9, 9:55 am, H-Man <S...(a)bites.fs> wrote: > On Mon, 9 Aug 2010 07:05:23 -0700 (PDT), Ed from AZ wrote: > > I have a problem that could be solved more easily if my VB6 form with > > a text input field and several drop-down controls can be rotated 90 > > degrees clockwise. (Monitor is being turned sideways - long story - > > exploring solutions.) Is this possible with Classic VB? Not just to > > rotate text on the form, but to rotate the entire form so it looks and > > functions normally? If so, what commands do I need? > > > Ed > > Generally done at the video driver level. AFAIK, it would be much harder to > rotate a single form that it would be to just rotate the entire display. > Samsung has a program called MagicRotate. This consists of an EXE, DLL and > SYS file. Still it's done at the driver level. > > -- > HK
From: Mike Williams on 9 Aug 2010 15:22 "Ed from AZ" <prof_ofwhat(a)yahoo.com> wrote in message news:fedb7345-02f1-43da-ace4-290750f314a0(a)o7g2000prg.googlegroups.com... > The video driver used to do it, but it broke with the > upgrade from XP SP2 to SP3. Known issue, no fix, > so brainstorming for other possible solutions. Older > laptop, not worth it to get a new video card. I'm not sure what card you have but the above problem (as you appear to already know) is a known issue with some cards, and specifically with ATI cards using Catalyst driver version 8.2: http://support.microsoft.com/kb/947309 On a laptop it is not usually wise to install anything other than the laptop manufacturer's custom modifed drivers so unless the manufacturer of your specific laptop has an updated driver available for download then you might be screwed. It would still be worth trying the orientation utility at the link I provided in my previous response though, because your card obviously still has the capacity to rotate the display and it is just a driver problem. I don't know whether the utility will circumvent your driver to achieve orientation, but it is definitely worth giving it a try. Here is the link again: http://www.softpedia.com/progDownload/iRotate-Download-17093.html You could always ditch SP3 of course and go back to your SP2 setup, unless of course Micro$oft in their infinite wisdom have prevented SP2 systems from obtaining other security updates :-) Mike
From: Mike Williams on 10 Aug 2010 18:17 "mbyerley" <mDotByerley(a)VerizonDottieNettie> wrote in message news:x42dnaCzcIm1jf3RnZ2dnUVZ_gydnZ2d(a)giganews.com... >> "Ed from AZ" <prof_ofwhat(a)yahoo.com> wrote in message >> news:a7ed093e-38d2-49f2-a606-f5621b34cf0c(a)i19g2000pro.googlegroups.com... >> I have a problem that could be solved more easily if my VB6 form >> with a text input field and several drop-down controls can be rotated >> 90 degrees clockwise. (Monitor is being turned sideways - long story >> - exploring solutions.) Is this possible with Classic VB? > > What about mouse movements? Actually the mouse movements can easily be dealt with. In this specific case, the OP (as indicated by his later postings) is having problems getting his display to rotate to portrait mode due to a video card driver problem brought about by a WinXP SP3 update, and I and others have given him some suggestions as to how he may solve that problem. However, if SP3 has totally knackered the video card driver in that respect and if all of those suggestions fail then there is always the "last resort" of drawing his own Controls in portrait mode (although that of course would itself require a great deal of work) and then manipulating the user's mouse movements at a low level so as to finish the job. In fact, the OP's question got me to thinking about how we can "fiddle" the user's mouse movements system wide in VB code in general, and it turns out to be not too difficult a task if you use a low level hook with the appropriate logic. Here, for example, is some VB code I have just written that changes the x and y mouse movements for the entire system so that "up becomes down" and "left becomes right". I decided to perform that specific task because it is slightly easier (from a logical viewpoint) than the "swap mouse orientation" that the OP might require if all else fails, and because this example code of mine was really just a "proof of concept" thing, but swapping orientation is very definitely just as "doable" with a little more thought. There are two blocks of code below (the first small block to be pasted into a Form and the second larger block to be pasted into a standard code Module). The code is just a first "proof of concept" model and I have not bothered with lots of things (multiple monitors and all sorts of stuff) and it is written in a bit of a "suck it and see" way that does not usually produce the neatest code, but it definitelty does seem to work okay (although of course there is always room for improvement). In fact, I've just this minute noticed a little problem with it if you drag a Form down so that its Caption Bar is partially below the taskbar, but these of course are just "teething troubles" and the basic idea seems to be fairly sound. Mike ' ***** START OF FORM CODE ***** Option Explicit Private Sub Form_Load() Caption = "Close this Form to return " _ & "mouse movement to normal." SetHook End Sub Private Sub Form_Unload(Cancel As Integer) ReleaseHook End Sub ' ***** END OF FORM CODE ***** ' ' ' ***** START OF MODULE CODE ***** Option Explicit ' Code by Mike Williams (2010) to modify the user's ' mouse movement in accordance with any set of rules ' (this specific example reverses the direction of ' both the x and y mouse movements, but it can easily ' be modified to perform other tasks, for example to ' swap the mouse orientation from landscape to portrait Private Declare Function SetWindowsHookEx _ Lib "user32" Alias "SetWindowsHookExA" _ (ByVal idHook As Long, ByVal lpfn As Long, _ ByVal hmod As Long, ByVal dwThreadId As Long) As Long Private Declare Function UnhookWindowsHookEx _ Lib "user32" (ByVal hHook As Long) As Long Private Declare Function CallNextHookEx _ Lib "user32" (ByVal hHook As Long, _ ByVal nCode As Long, ByVal wParam As Long, _ lParam As Any) As Long Private Declare Sub CopyMemory Lib "kernel32" _ Alias "RtlMoveMemory" (Destination As Any, _ Source As Any, ByVal Length As Long) Private Declare Function SetCursorPos Lib "user32" _ (ByVal X As Long, ByVal Y As Long) As Long Private Const WH_MOUSE_LL As Long = 14 'low level Private Const WH_MOUSE As Long = 7 ' app level Private Const HC_ACTION = 0 Private Const WM_RBUTTONDOWN As Long = &H204 Private Const WM_RBUTTONUP As Long = &H205 Private Const WM_RBUTTONDBLCLK As Long = &H206 Private Const WM_MOUSEMOVE As Long = &H200 Private Const WM_LBUTTONDOWN As Long = &H201 Private Const WM_LBUTTONUP As Long = &H202 Private Const WM_MBUTTONDOWN As Long = &H207 Private Const WM_MBUTTONUP As Long = &H208 Private Const WM_SCROLL As Long = &H20A Private Type POINTAPI X As Long Y As Long End Type Private Type MOUSELLHOOKSTRUCT point As POINTAPI data As Long flags As Long time As Long extra As Long End Type Private mousedata As MOUSELLHOOKSTRUCT Private oldCoords As POINTAPI Private Hook As Long Private xMax As Long, yMax As Long Public Sub SetHook() xMax = (Screen.Width / Screen.TwipsPerPixelX) - 1 yMax = (Screen.Height / Screen.TwipsPerPixelY) - 1 Hook = SetWindowsHookEx(WH_MOUSE_LL, _ AddressOf MouseProc, App.hInstance, 0) End Sub Public Sub ReleaseHook() UnhookWindowsHookEx Hook End Sub Private Function MouseProc(ByVal nCode As Long, _ ByVal wParam As Long, ByVal lParam As Long) As Long Static Initialised As Boolean, temp As Long Dim diffX As Long, diffY As Long If (nCode = HC_ACTION) And (wParam = WM_MOUSEMOVE) Then CopyMemory mousedata, ByVal lParam, Len(mousedata) If Not Initialised Then oldCoords.X = mousedata.point.X oldCoords.Y = mousedata.point.Y Initialised = True MouseProc = CallNextHookEx _ (0, nCode, wParam, ByVal lParam) End If diffX = mousedata.point.X - oldCoords.X diffY = mousedata.point.Y - oldCoords.Y If diffX = 0 And diffY = 0 Then ' same coords as previous coords, so this must be ' the move triggered by our Call to SetCursorPos, ' in which case we need to allow the system to ' deal with it MouseProc = CallNextHookEx _ (0, nCode, wParam, ByVal lParam) Else ' different coords, so this must be a standard mouse ' movement not triggered by our Call to SetCursorPos, ' in which case we need to modify the mouse movement ' in accordance with whatever rules we have set (this ' specific example reverses the movement in both the ' x plane and the y plane) abd we then need to tell ' the system to ignore the unwanted mouse movement ' that triggered this event. ' We modify the movement by first setting the mouse ' to the position we want it to be (using a call to ' SetCursorPos) and we instruct the system to ignore ' the "unwanted" mouse movement that triggered this ' event by setting the return value to True oldCoords.X = mousedata.point.X - diffX - diffX oldCoords.Y = mousedata.point.Y - diffY - diffY If oldCoords.X < 0 Then oldCoords.X = 0 If oldCoords.X > xMax Then oldCoords.X = xMax If oldCoords.Y < 0 Then oldCoords.Y = 0 If oldCoords.Y > yMax Then oldCoords.Y = yMax SetCursorPos oldCoords.X, oldCoords.Y MouseProc = True Exit Function End If End If End Function ' ***** END OF MODULE CODE *****
From: mbyerley on 10 Aug 2010 23:09 "Mike Williams" <Mike(a)WhiskyAndCoke.com> wrote in message news:i3sj50$dp1$1(a)speranza.aioe.org... > "mbyerley" <mDotByerley(a)VerizonDottieNettie> wrote in message > news:x42dnaCzcIm1jf3RnZ2dnUVZ_gydnZ2d(a)giganews.com... >>> "Ed from AZ" <prof_ofwhat(a)yahoo.com> wrote in message >>> news:a7ed093e-38d2-49f2-a606-f5621b34cf0c(a)i19g2000pro.googlegroups.com... >>> I have a problem that could be solved more easily if my VB6 form >>> with a text input field and several drop-down controls can be rotated >>> 90 degrees clockwise. (Monitor is being turned sideways - long story >>> - exploring solutions.) Is this possible with Classic VB? >> >> What about mouse movements? > > Actually the mouse movements can easily be dealt with. In this specific > case, the OP (as indicated by his later postings) is having problems > getting his display to rotate to portrait mode due to a video card driver > problem brought about by a WinXP SP3 update, and I and others have given > him some suggestions as to how he may solve that problem. However, if SP3 > has totally knackered the video card driver in that respect and if all of > those suggestions fail then there is always the "last resort" of drawing > his own Controls in portrait mode (although that of course would itself > require a great deal of work) and then manipulating the user's mouse > movements at a low level so as to finish the job. In fact, the OP's > question got me to thinking about how we can "fiddle" the user's mouse > movements system wide in VB code in general, and it turns out to be not > too difficult a task if you use a low level hook with the appropriate > logic. > > Here, for example, is some VB code I have just written that changes the x > and y mouse movements for the entire system so that "up becomes down" and > "left becomes right". I decided to perform that specific task because it > is slightly easier (from a logical viewpoint) than the "swap mouse > orientation" that the OP might require if all else fails, and because this > example code of mine was really just a "proof of concept" thing, but > swapping orientation is very definitely just as "doable" with a little > more thought. > > There are two blocks of code below (the first small block to be pasted > into a Form and the second larger block to be pasted into a standard code > Module). The code is just a first "proof of concept" model and I have not > bothered with lots of things (multiple monitors and all sorts of stuff) > and it is written in a bit of a "suck it and see" way that does not > usually produce the neatest code, but it definitelty does seem to work > okay (although of course there is always room for improvement). In fact, > I've just this minute noticed a little problem with it if you drag a Form > down so that its Caption Bar is partially below the taskbar, but these of > course are just "teething troubles" and the basic idea seems to be fairly > sound. > > Mike Hey Mike... The lazy way would be to rotate the mouse 90 deg in your hand.... ;-) > ' ***** START OF FORM CODE ***** > Option Explicit > > Private Sub Form_Load() > Caption = "Close this Form to return " _ > & "mouse movement to normal." > SetHook > End Sub > > Private Sub Form_Unload(Cancel As Integer) > ReleaseHook > End Sub > ' ***** END OF FORM CODE ***** > ' > ' > ' ***** START OF MODULE CODE ***** > Option Explicit > ' Code by Mike Williams (2010) to modify the user's > ' mouse movement in accordance with any set of rules > ' (this specific example reverses the direction of > ' both the x and y mouse movements, but it can easily > ' be modified to perform other tasks, for example to > ' swap the mouse orientation from landscape to portrait > Private Declare Function SetWindowsHookEx _ > Lib "user32" Alias "SetWindowsHookExA" _ > (ByVal idHook As Long, ByVal lpfn As Long, _ > ByVal hmod As Long, ByVal dwThreadId As Long) As Long > Private Declare Function UnhookWindowsHookEx _ > Lib "user32" (ByVal hHook As Long) As Long > Private Declare Function CallNextHookEx _ > Lib "user32" (ByVal hHook As Long, _ > ByVal nCode As Long, ByVal wParam As Long, _ > lParam As Any) As Long > Private Declare Sub CopyMemory Lib "kernel32" _ > Alias "RtlMoveMemory" (Destination As Any, _ > Source As Any, ByVal Length As Long) > Private Declare Function SetCursorPos Lib "user32" _ > (ByVal X As Long, ByVal Y As Long) As Long > Private Const WH_MOUSE_LL As Long = 14 'low level > Private Const WH_MOUSE As Long = 7 ' app level > Private Const HC_ACTION = 0 > Private Const WM_RBUTTONDOWN As Long = &H204 > Private Const WM_RBUTTONUP As Long = &H205 > Private Const WM_RBUTTONDBLCLK As Long = &H206 > Private Const WM_MOUSEMOVE As Long = &H200 > Private Const WM_LBUTTONDOWN As Long = &H201 > Private Const WM_LBUTTONUP As Long = &H202 > Private Const WM_MBUTTONDOWN As Long = &H207 > Private Const WM_MBUTTONUP As Long = &H208 > Private Const WM_SCROLL As Long = &H20A > Private Type POINTAPI > X As Long > Y As Long > End Type > Private Type MOUSELLHOOKSTRUCT > point As POINTAPI > data As Long > flags As Long > time As Long > extra As Long > End Type > Private mousedata As MOUSELLHOOKSTRUCT > Private oldCoords As POINTAPI > Private Hook As Long > Private xMax As Long, yMax As Long > > Public Sub SetHook() > xMax = (Screen.Width / Screen.TwipsPerPixelX) - 1 > yMax = (Screen.Height / Screen.TwipsPerPixelY) - 1 > Hook = SetWindowsHookEx(WH_MOUSE_LL, _ > AddressOf MouseProc, App.hInstance, 0) > End Sub > > Public Sub ReleaseHook() > UnhookWindowsHookEx Hook > End Sub > > Private Function MouseProc(ByVal nCode As Long, _ > ByVal wParam As Long, ByVal lParam As Long) As Long > Static Initialised As Boolean, temp As Long > Dim diffX As Long, diffY As Long > If (nCode = HC_ACTION) And (wParam = WM_MOUSEMOVE) Then > CopyMemory mousedata, ByVal lParam, Len(mousedata) > If Not Initialised Then > oldCoords.X = mousedata.point.X > oldCoords.Y = mousedata.point.Y > Initialised = True > MouseProc = CallNextHookEx _ > (0, nCode, wParam, ByVal lParam) > End If > diffX = mousedata.point.X - oldCoords.X > diffY = mousedata.point.Y - oldCoords.Y > If diffX = 0 And diffY = 0 Then > ' same coords as previous coords, so this must be > ' the move triggered by our Call to SetCursorPos, > ' in which case we need to allow the system to > ' deal with it > MouseProc = CallNextHookEx _ > (0, nCode, wParam, ByVal lParam) > Else > ' different coords, so this must be a standard mouse > ' movement not triggered by our Call to SetCursorPos, > ' in which case we need to modify the mouse movement > ' in accordance with whatever rules we have set (this > ' specific example reverses the movement in both the > ' x plane and the y plane) abd we then need to tell > ' the system to ignore the unwanted mouse movement > ' that triggered this event. > ' We modify the movement by first setting the mouse > ' to the position we want it to be (using a call to > ' SetCursorPos) and we instruct the system to ignore > ' the "unwanted" mouse movement that triggered this > ' event by setting the return value to True > oldCoords.X = mousedata.point.X - diffX - diffX > oldCoords.Y = mousedata.point.Y - diffY - diffY > If oldCoords.X < 0 Then oldCoords.X = 0 > If oldCoords.X > xMax Then oldCoords.X = xMax > If oldCoords.Y < 0 Then oldCoords.Y = 0 > If oldCoords.Y > yMax Then oldCoords.Y = yMax > SetCursorPos oldCoords.X, oldCoords.Y > MouseProc = True > Exit Function > End If > End If > End Function > ' ***** END OF MODULE CODE ***** > > > > >
From: Mike Williams on 11 Aug 2010 05:38
"mbyerley" <mDotByerley(a)VerizonDottieNettie> wrote in message news:haOdnVcxE6Ybif_RnZ2dnUVZ_qqdnZ2d(a)giganews.com... >> >> "Mike Williams" <Mike(a)WhiskyAndCoke.com> wrote: >> Here, for example, is some VB code I have just written that >> changes the x and y mouse movements for the entire system > > Hey Mike... The lazy way would be to rotate the > mouse 90 deg in your hand.... ;-) Now that's really Cool� . . . I like it ;-) Mike |