Magnifie by Lebans...!

  • Thread starter Thread starter ALESSANDRO Baraldi
  • Start date Start date
A

ALESSANDRO Baraldi

I use this very good example of Magnifie, but some time my machine
have a "OUT OF MEMORY" and Crash my application.
I need to whait some minute before execute any other application...!
I read about GetDC and ResleseDC, so i tried to execute it on every
Current_Event
but with no good effect....!

Some one know how can i correct this truble....!

Many Thanks.

Alessandro(IT).
 
What modifications have you made to my code Alessandro?
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
Stephen Lebans said:
What modifications have you made to my code Alessandro?

Hi Stephen...!
Some weeks ago i ask about Lens effect in VB...did you remember...?
Look for something in your Site i find Magnifie exemple it' perfect...!

I don't modify in any way your code, i import the "Normal" form in my
application.
Before open your Form i limit the Mouse_movement into Immage Area
because i use it only to have ZOOM effect of my Hight_resolution Immage.

This type of Error exit only some time, but the strange thing is that my
machine for some minute work wery slow.....!

To limit Mouse_area i use this code (ctl is my ImmageControl)

Public Sub GetMouseArea(frm As Access.Form, ctl As Access.Control)
Dim client As RECT
Dim upperleft As POINT
Call ClientToScreen(frm.hWnd, upperleft)
Call GetWindowRect(frm.hWnd, client)
With client
.Left = .Left + fTwipsToPixels(ctl.Left, 0) - 5
.Right = .Right - 15
.Top = .Top + fTwipsToPixels(ctl.Top, 1) - 5
.Bottom = .Bottom - 15
End With
ClipCursor client
End Sub

Good week End.
Sorry for my bad English.
;-)

Alessandro(IT)
 
Alessandro if you open my Magnify app and then open the WIndow REsource
monitor/meter you will see that my code does not cause the system
resources to diminish while it is running, period.
Since it does run on a Form timer event it will slow down other access
forms running at the same time. Increase my Form's Timer Interval
slightly to help fix this issue.

To try to pinpoint the casue of the error try commenting out my code
completely and see if the error still happens.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
Stephen Lebans said:
Alessandro if you open my Magnify app and then open the WIndow REsource
monitor/meter you will see that my code does not cause the system
resources to diminish while it is running, period.
Since it does run on a Form timer event it will slow down other access
forms running at the same time. Increase my Form's Timer Interval
slightly to help fix this issue.

To try to pinpoint the casue of the error try commenting out my code
completely and see if the error still happens.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Hi Stephen.
I'm check my System Memory untill running, with:
1)Normal(your form magnifie) Open
2)My Form with an Hi-Resolution Image loaded(Runtime with your Loader)
Looking on Meter if i Run on the Image my CPU run to 100% and after
some minute if i stay on the Image moving the mouse my Application(Only)
Crash, but the SO work very very SLOW, and it need a few minute to run
again....!
If i move the mouse outside the Image nothing all of this, and My CPU
work around 20%÷50% and all OK.

CPU=P3-733Mhz
RAM_MEMORY=512Mb(I hope is not the problem)
SO=W2000
Version=A_XP, but also with A97.

I don't know if i give you the right info to understand.

Thanks.
Alessadro(IT)
 
Alessandro it must be the code you have running on the Form's Timer
event or on the Mousemove of the Image control. Comment out your code in
those two Events and see if the error dissappears.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
Stephen Lebans said:
Alessandro it must be the code you have running on the Form's Timer
event or on the Mousemove of the Image control. Comment out your code in
those two Events and see if the error dissappears.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Yes, may be....!
So i try to give you all the info about:
1)I have no set any Timer_Event on My MainForm
2)On MouseMove i only change the CursorType in this way:
Missing API declaration because you know much better then i...:

Function PointM(strPathToCursor As String)
Dim lngRet As Long
lngRet = LoadCursorFromFile(strPathToCursor)
lngRet = SetCursor(lngRet)
End Function

I don't know if this code can cause my problem...!
The strange thing is that on Normalscreen(without Image)
nothing all...!

The solution will be to use some OCX, but i don't like
it and for my free development i really don't wont use it
So i must understand the problem and Kill it.
Thank you very much.

Alessandro(IT).
 
Yes, may be....!
So i try to give you all the info about:
1)I have no set any Timer_Event on My MainForm
2)On MouseMove i only change the CursorType in this way:
Missing API declaration because you know much better then i...:

Function PointM(strPathToCursor As String)
Dim lngRet As Long
lngRet = LoadCursorFromFile(strPathToCursor)
lngRet = SetCursor(lngRet)
End Function

I don't know if this code can cause my problem...!
The strange thing is that on Normalscreen(without Image)
nothing all...!

The solution will be to use some OCX, but i don't like
it and for my free development i really don't wont use it
So i must understand the problem and Kill it.
Thank you very much.

Alessandro(IT).



I FIND THE PROBLEM.
It's the ChangeCursor Function.
If the two sistem work togheter the cpu resources jump to 100%.
I try the Magnifie without CursorFunction and CPU don't go UP 40%....!

Have you any idea about this....??

Bye.
Alessandro(IT)
 
You do not LOAD the cursor on every MouseMove event. Load it once in the
Forms's Load event and then store the handle returned to a global
variable. Use this handle in your call to SetCursor.
Really though, the proper way to handle this is to set the window's
Default Cursor class property to NULL. Then you only have to SetCursor
once on the first MouseMove event of the Image control and then return
everything back to normal on the first MouseMove event of the Form.

Why are you setting a custom cursor anyway. Have you looked at the
available supported system cursors than be set directly with Access?
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
Stephen Lebans said:
You do not LOAD the cursor on every MouseMove event. Load it once in the
Forms's Load event and then store the handle returned to a global
variable. Use this handle in your call to SetCursor.
Really though, the proper way to handle this is to set the window's
Default Cursor class property to NULL. Then you only have to SetCursor
once on the first MouseMove event of the Image control and then return
everything back to normal on the first MouseMove event of the Form.

Why are you setting a custom cursor anyway. Have you looked at the
available supported system cursors than be set directly with Access?
--


He....He.........! ;-)
After my last i read again my code, and so i understand that wos stupid
reload everytime the cursor.
The problem was not only the crash, but also the Poiter flashing each
reload....!
So i do exactly you say about it.......!
Why are you setting a custom cursor anyway. Have you looked at the
available supported system cursors than be set directly with Access?

Why....? I'm silly.

Thank's about all....!

At last i'll public my FotoApplication on Access Italian site, all your code
will be
INTEGER with copyright.........!

Now i try to use PictureBox and HDC properety to use all the grafic Effect i
can....!

I have no much time to work on my Application, but slowly i'll do
it............!

Marry Christmas and Good 2004 to you and all your family.

Alessandro.(ITALY)
 
Back
Top