i'm trying build a method in my Sprite control for destroy it self, but until now without sucess:(
(in these case) the control is created in project-mode and deleted in run-mode...
any sugestions?
thanks
Printable View
i'm trying build a method in my Sprite control for destroy it self, but until now without sucess:(
(in these case) the control is created in project-mode and deleted in run-mode...
any sugestions?
thanks
Why not create it dynamically, when the app starts. Easier to destroy.
Well, without seeing any code, it seems that you want a magic answer, when the solution is to do some legwork now.
sorry, you have right.
heres my procedure
i have try using the destroywindow() api function and the and releaseDc() api function, ~but without sucess:(Quote:
Private Sub Destroyed()
On Error Resume Next
RaiseEvent Destroyed(lngOldPosX, lngOldPosY)
tmrNewEvents.Enabled = False
tmrAnimation.Enabled = False
tmrMouseStoped.Enabled = False
FileName = Empty
Set UserControl.MaskPicture = Nothing
Unhook2 UserControl.ParentControls(0).hWnd
HoverTime = 0
End Sub
i acept advices
i recive o(zero) in messagebox
information in these api function: http://www.ex-designz.net/apidetail.asp?api_id=330Code:MsgBox (ReleaseDC(Me.hWnd, UserControl.hdc))
(i'm portuguese)
On Error Resume Next is hiding your problem. Comment that line out, and try it again.
You still need to supply more code. How do you get the values? How do you create them?
Why don't you create a file of icons, and load them?
ok... i put here my group project, now you can see everything.
in UC you have the Destroyed procedure in Declaration section.
see and tell me what you think.... the FileName property is for you change the image(animateg cursors and gifs can be showed too).
thanks
I can't help with Vista/64, as I recall. I can try later.
Well, trying to exit with the Close 'X' crashes the IDE. Clicking on STOP in the IDE works correctly. I would use XML files to access the data in the property bag that is named.
yes i know about that error, but why?
for me it's strange:(
thanks for help me
did you want my msn(messenger) for more help(honestly i need more help in more things, in my sprite)?
(i found something interesting: http://books.google.pt/books?id=kVqB...um=8#PPA371,M1 )thanks
Because your app is sub-classing memory locations to fool the IDE into thinking something is different. The caution is that you can toast Windows, not only the IDE when you're writing memory that goes awry.
The exception in your program is generated when you try to set the UserControl.Height/Width in ShowImage after the window is destroyed. This will trigger UserControl_Resize which in turn calls ShowImage again, which will trigger the UserControl_Resize again and so on. It's a kind of stack overflow although the error says something else.
To prevent this error, you can add validation in your UserControl_Resize. If the UserControl.hWnd is valid (not 0), then perform the codes, otherwise, do nothing.
You can also check the hWnd even earlier than calling ShowImage if you want (e.g. even before calling Destroyed)Code:Private Sub UserControl_Resize()
If UserControl.hWnd = 0 Then
Debug.Print "UserControl_Resize ignored (HWND = 0)"
Else
On Error Resume Next
If blnAutoSize = False Then
picGraphicsEffects.Width = UserControl.ScaleWidth
picGraphicsEffects.Height = UserControl.ScaleHeight
End If
Call ShowImage
If (UserControl.Width <> lngOldWidth And UserControl.Height <> lngOldHeight) Then
ResizeTyp = ResizeVerticalHorizontal
ElseIf UserControl.Width <> lngOldWidth Then
ResizeTyp = ResizeHorizontal
ElseIf UserControl.Height <> lngOldHeight Then
ResizeTyp = ResizeVertical
End If
lngOldWidth = UserControl.Width
lngOldHeight = UserControl.Height
If strFileName = Empty Then Call SubTransparent
RaiseEvent Resize(UserControl.Width, UserControl.Height, ResizeTyp)
End If
End Sub
Hope it will help you :)
The memory location for UserControl.Height/Width might have been valid at one point, but not after the pointer was no longer pointing to a vaild width.