emy
New Member
Hello
Posts: 45
|
Post by emy on Jan 30, 2022 16:37:46 GMT -5
The bas file is very small Right now is 10:35 PM in Switzerland. Tomorrow after noon, I will post only the bas file. Emy
|
|
emy
New Member
Hello
Posts: 45
|
Post by emy on Jan 31, 2022 4:21:41 GMT -5
Following code modified without BMP and without cursor$. I pick up a cursor from windows.
'------------------------------------------------- ' Wpaning.bas "cadres.bmp" = Stitch Drawing '------------------------------------------------- 'cursor$ = "harrow.cur" 'cursor$ = "hand.cur" cursor$ = DefaultDir$ + "\hand.cur" 'This one I made by my self '................................................ nomainwin WindowWidth = 345 WindowHeight = 570 UpperLeftX = 100 UpperLeftY = 100 graphicbox #w.gbx, 20, 20, 300, 500 '................................................ open "Moving BMP (Paning)" for Window_nf as #w #w, "trapclose [quit]" '.....................................Load cursor. h = hwnd(#w.gbx) 'window handle 'Hand.cur only in gbx area ! calldll #user32, "LoadImageA",_ 0 as long,_ 'instance - use 0 for image from file cursor$ as ptr,_ 'path and filename of image _IMAGE_CURSOR as long,_ 'type of image 0 as long,_ 'desired width 0 as long,_ 'desired height _LR_LOADFROMFILE as long,_ 'load flag = load-from-file hCursor as ulong 'handle of cursor '.....................................Set cursor. calldll #user32,"SetClassLongA",_ h as ulong,_ 'window handle _GCL_HCURSOR as long,_ 'flag to change cursor hCursor as ulong,_ 'handle of cursor r as long '................................................ #w.gbx, "down" loadbmp "image", "cadres.bmp" #w.gbx, "cls; drawbmp image 0 0;flush" '................................................ x2 = x1 : y2 = y1 '................................................ #w.gbx "when leftButtonDown [startmove]" #w.gbx "when leftButtonUp [endmove]" wait '------------------------------------------------- [startmove] imagex = x1 - MouseX : imagey = y1 - MouseY #w.gbx "when leftButtonMove [move]" wait '------------------------------------------------- [move] x1 = MouseX + imagex : y1 = MouseY + imagey '................................................ if x1 < -180 then x1 = -180 '\ if y1 < -308 then y1 = -308 ': Prevent to move the bmp if x1 > 0 then x1 = 0 ': out of the graphicbox! if y1 > 0 then y1 = 0 '/ '................................................ #w.gbx "cls" #w.gbx "drawbmp image ";x1;" ";y1 wait '------------------------------------------------- [endmove] #w.gbx "when leftButtonMove" cursor normal x2 = x1 : y2 = y1 wait '------------------------------------------------- [quit] unloadbmp "image" cursor normal CallDLL #user32, "DestroyCursor",_ hCursor As ulong,_ DestroyCursor As long close #w end '--------
|
|
|
Post by Rod on Jan 31, 2022 4:47:44 GMT -5
I altered this little section of code so folks trying it can load their own .bmp.
'................................................ #w.gbx, "down" filedialog "Open image file", "*.bmp", fileName$ loadbmp "image", fileName$ #w.gbx, "cls; drawbmp image 0 0;flush" '................................................
|
|
|
Post by Brandon Parker on Jan 31, 2022 9:30:39 GMT -5
Can you share the cursor image that you made?
Other than a completely open and then completely closed hand, I think applications also use the four arrow cursor for indicating panning is available.
The cursor value for that is 32646...
{:0)
Brandon Parker
|
|
|
Post by Brandon Parker on Jan 31, 2022 9:41:29 GMT -5
Also, if you use the "Segment" and "DelSegment" commands as shown in the updated version of your example below, you will be able to move the window off of the screen or cover it with another window and still have the graphic show up afterward without panning it.
'------------------------------------------------- ' Wpaning.bas "cadres.bmp" = Stitch Drawing '------------------------------------------------- 'cursor$ = "harrow.cur" 'cursor$ = "hand.cur" cursor$ = DefaultDir$ + "\hand.cur" 'This one I made by my self '................................................ nomainwin WindowWidth = 345 WindowHeight = 570 UpperLeftX = 100 UpperLeftY = 100 graphicbox #w.gbx, 20, 20, 300, 500 '................................................ open "Moving BMP (Paning)" for Window_nf as #w #w, "trapclose [quit]" '.....................................Load cursor. h = hwnd(#w.gbx) 'window handle 'Hand.cur only in gbx area ! calldll #user32, "LoadImageA",_ 0 as long,_ 'instance - use 0 for image from file cursor$ as ptr,_ 'path and filename of image _IMAGE_CURSOR as long,_ 'type of image 0 as long,_ 'desired width 0 as long,_ 'desired height _LR_LOADFROMFILE as long,_ 'load flag = load-from-file hCursor as ulong 'handle of cursor '.....................................Set cursor. calldll #user32,"SetClassLongA",_ h as ulong,_ 'window handle _GCL_HCURSOR as long,_ 'flag to change cursor hCursor as ulong,_ 'handle of cursor r as long '................................................ #w.gbx, "down" filedialog "Open image file", "*.bmp", fileName$ loadbmp "image", fileName$ #w.gbx, "cls; drawbmp image 0 0;flush" '................................................ x2 = x1 : y2 = y1 '................................................ #w.gbx "when leftButtonDown [startmove]" #w.gbx "when leftButtonUp [endmove]" wait '------------------------------------------------- [startmove] #w.gbx "DelSegment currentImage" imagex = x1 - MouseX : imagey = y1 - MouseY #w.gbx "when leftButtonMove [move]" wait '------------------------------------------------- [move] x1 = MouseX + imagex : y1 = MouseY + imagey '................................................ if x1 < -180 then x1 = -180 '\ if y1 < -308 then y1 = -308 ': Prevent to move the bmp if x1 > 0 then x1 = 0 ': out of the graphicbox! if y1 > 0 then y1 = 0 '/ '................................................ 'CLS commented out to reduce flickering #w.gbx "cls" #w.gbx "drawbmp image ";x1;" ";y1 #w.gbx "Flush currentImage" wait '------------------------------------------------- [endmove] #w.gbx "when leftButtonMove" cursor normal x2 = x1 : y2 = y1 wait '------------------------------------------------- [quit] unloadbmp "image" cursor normal CallDLL #user32, "DestroyCursor",_ hCursor As ulong,_ DestroyCursor As long close #w end '--------
{:0)
Brandon Parker
|
|
|
Post by Rod on Jan 31, 2022 15:20:37 GMT -5
Yes, that will keep the image on display. I would just tweak a line or two, naming the initial segment and only using cls once. the image should flash less while panning.
'at the start cls once, draw and flush but to a named segment #w.gbx, "cls; drawbmp image 0 0;flush currentImage"
[startmove] 'we dont need this here because we have not drawn anything yet #w.gbx "DelSegment currentImage"
[move] x1 = MouseX + imagex : y1 = MouseY + imagey '................................................ if x1 < -180 then x1 = -180 '\ if y1 < -308 then y1 = -308 ': Prevent to move the bmp if x1 > 0 then x1 = 0 ': out of the graphicbox! if y1 > 0 then y1 = 0 '/ '................................................ 'this is wrong because cls wipes out all segments anyway ' #w.gbx "cls" 'this is what to do, del the current segment so there is none #w.gbx "delsegment currentImage" #w.gbx "drawbmp image ";x1;" ";y1 'and now since you have drawn, flush it again #w.gbx "flush currentImage" wait
|
|
|
Post by Brandon Parker on Jan 31, 2022 16:59:18 GMT -5
I agree with Rod about moving the #w.gbx "Delsegment currentImage" code. I do not believe removing the CLS without doing something else is prudent with the current configuration since you can move the image to the left and top portion of the GraphicBox such that there is empty space to the right or below. This leaves previously drawn graphics, so we have three options. - Leave the #w.gbx "CLS" where it is at in the move routine
- Remove the "CLS" command and add a "Redraw" command after the "Flush currentImage" command
- Fill the GraphicBox with White prior to pushing the panned image and move the "Flush currentImage" command to the endmove routine since we really only need to flush it when the mouse button comes up.
I vote for Option 3 at this time... '------------------------------------------------- ' Wpaning.bas "cadres.bmp" = Stitch Drawing '------------------------------------------------- 'cursor$ = "harrow.cur" 'cursor$ = "hand.cur" cursor$ = DefaultDir$ + "\hand.cur" 'This one I made by my self '................................................ nomainwin WindowWidth = 345 WindowHeight = 570 UpperLeftX = 100 UpperLeftY = 100 graphicbox #w.gbx, 20, 20, 300, 500 '................................................ open "Moving BMP (Paning)" for Window_nf as #w #w, "trapclose [quit]" '.....................................Load cursor. h = hwnd(#w.gbx) 'window handle 'Hand.cur only in gbx area ! calldll #user32, "LoadImageA",_ 0 as long,_ 'instance - use 0 for image from file cursor$ as ptr,_ 'path and filename of image _IMAGE_CURSOR as long,_ 'type of image 0 as long,_ 'desired width 0 as long,_ 'desired height _LR_LOADFROMFILE as long,_ 'load flag = load-from-file hCursor as ulong 'handle of cursor '.....................................Set cursor. calldll #user32,"SetClassLongA",_ h as ulong,_ 'window handle _GCL_HCURSOR as long,_ 'flag to change cursor hCursor as ulong,_ 'handle of cursor r as long '................................................ #w.gbx, "down" filedialog "Open image file", "*.bmp", fileName$ loadbmp "image", fileName$ #w.gbx, "cls; drawbmp image 0 0;flush currentImage" '................................................ x2 = x1 : y2 = y1 '................................................ #w.gbx "when leftButtonDown [startmove]" #w.gbx "when leftButtonUp [endmove]" wait '------------------------------------------------- [startmove]
imagex = x1 - MouseX : imagey = y1 - MouseY #w.gbx "when leftButtonMove [move]" wait '------------------------------------------------- [move] x1 = MouseX + imagex : y1 = MouseY + imagey '................................................ if x1 < -180 then x1 = -180 '\ if y1 < -308 then y1 = -308 ': Prevent to move the bmp if x1 > 0 then x1 = 0 ': out of the graphicbox! if y1 > 0 then y1 = 0 '/ '................................................ '#w.gbx "cls" #w.gbx "DelSegment currentImage" #w.gbx "Fill White; drawbmp image ";x1;" ";y1 wait '------------------------------------------------- [endmove] #w.gbx "Flush currentImage" #w.gbx "when leftButtonMove" cursor normal x2 = x1 : y2 = y1 wait '------------------------------------------------- [quit] unloadbmp "image" cursor normal CallDLL #user32, "DestroyCursor",_ hCursor As ulong,_ DestroyCursor As long close #w end '--------
Another update you could do is retrieve the height and width information from the BMP file prior to loading it in as a BMP that way you can then prevent the image's right and bottom edges from being pulled away from the GraphicBox right and bottom edges. {:0) Brandon Parker
|
|
|
Post by Rod on Feb 1, 2022 5:03:50 GMT -5
Brandon you are making me think (which is good). Segments are a pain, its probably important we get it right, I didn't first time round so here is my second go at dealing with the "tails" you are rightly concerned about.
A couple of things about the latest code posted above. Initially the screen is cleared, the background drawn and the image drawn and all is flushed to currentImage correctly. Then we wait for the user to move the image.
Keep in mind that [moveit] is being called hundreds of times as the mouse moves. First off we keep deleting the currentImage segment even though we never flush to it, it does not exist after the first loop so the command is doing nothing. Secondly we repeatedly fill white and draw the image, these drawing actions build up in a new segment. This uses lots of memory (no big deal) and reintroduces the flickering as occasionally we are shown the whole white screen. The fill white is probably more noticeable than cls. On a large image the flicker is very obvious.
So what happens next at [endmove]? Well we flush all of those fill white draw actions into a new segment. Probably not what we wanted to do. If we were to redraw that segment Liberty would repeat all of the redrawing that was created with the mouse moves. Put a redraw command at the end of [endmove] and you will see Liberty redraw all of the mouse moves, it happens quickly but it will store and repeat all of the mouse move drawing actions.
A clean simple fix with some flicker is cls draw and flush in the [moveit] code as you suggest.
So how to fix the "tails" and minimise flicker and avoid memory build up? Memory build up was the reason I had delsegment and flush segment in the [moveit] code. In that format there is only ever one segment. However to deal with the "tails" I adopt a different strategy. I simply don't worry about flushing while the mouse moves. At [endmove] I cls, dispensing with the multiple drawing, capture the end position and draw it on a fresh background thus keeping one segment with one drawing action. The "tails" are visible during panning but are removed in [endmove].
Demystifying segments is a lifetime's occupation.
'------------------------------------------------- ' Wpaning.bas "cadres.bmp" = Stitch Drawing '------------------------------------------------- 'cursor$ = "harrow.cur" 'cursor$ = "hand.cur" cursor$ = DefaultDir$ + "\hand.cur" 'This one I made by my self '................................................ nomainwin WindowWidth = 345 WindowHeight = 570 UpperLeftX = 100 UpperLeftY = 100 graphicbox #w.gbx, 20, 20, 300, 500 '................................................ open "Moving BMP (Paning)" for Window_nf as #w #w, "trapclose [quit]" '.....................................Load cursor. h = hwnd(#w.gbx) 'window handle 'Hand.cur only in gbx area ! calldll #user32, "LoadImageA",_ 0 as long,_ 'instance - use 0 for image from file cursor$ as ptr,_ 'path and filename of image _IMAGE_CURSOR as long,_ 'type of image 0 as long,_ 'desired width 0 as long,_ 'desired height _LR_LOADFROMFILE as long,_ 'load flag = load-from-file hCursor as ulong 'handle of cursor '.....................................Set cursor. calldll #user32,"SetClassLongA",_ h as ulong,_ 'window handle _GCL_HCURSOR as long,_ 'flag to change cursor hCursor as ulong,_ 'handle of cursor r as long '................................................ #w.gbx, "down" filedialog "Open image file", "*.bmp", fileName$ loadbmp "image", fileName$ #w.gbx, "cls; fill white ; drawbmp image 0 0 ; flush currentImage" '................................................ x2 = x1 : y2 = y1 '................................................ #w.gbx "when leftButtonDown [startmove]" #w.gbx "when leftButtonUp [endmove]" wait '------------------------------------------------- [startmove]
imagex = x1 - MouseX : imagey = y1 - MouseY #w.gbx "when leftButtonMove [move]" wait '------------------------------------------------- [move] x1 = MouseX + imagex : y1 = MouseY + imagey '................................................ if x1 < -180 then x1 = -180 '\ if y1 < -308 then y1 = -308 ': Prevent to move the bmp if x1 > 0 then x1 = 0 ': out of the graphicbox! if y1 > 0 then y1 = 0 '/ '................................................ #w.gbx "drawbmp image ";x1;" ";y1 wait '------------------------------------------------- [endmove] #w.gbx "cls ; fill white ; drawbmp image ";x1;" ";y1;" ; flush currentImage" #w.gbx "when leftButtonMove" cursor normal x2 = x1 : y2 = y1 wait '------------------------------------------------- [quit] unloadbmp "image" cursor normal CallDLL #user32, "DestroyCursor",_ hCursor As ulong,_ DestroyCursor As long close #w end '--------
|
|
|
Post by Brandon Parker on Feb 1, 2022 16:56:00 GMT -5
Rod, you are 100% correct regarding your statements especially the one about making us think. I would only argue that issuing a "DelSegment" command does not harm anything when the named segment does not exist since LB checks to see if it exists (or otherwise handles it when the segment does not exist).
Unfortunately, there is just a little bit lacking in LB's graphic segments commands that would make the drawing better.
I personally would live with a little flickering over the tails...
Here is what I would use. I also added in some extra stuff just in case we somehow get two "leftButtonDown" or "leftButtonUp" events that fire. We all know how events get duplicated at times in LB's message handling (not saying that I have seen it in the "leftButtonDown" or "leftButtonUp" scenarios, but...just in case)
'------------------------------------------------- ' Wpaning.bas "cadres.bmp" = Stitch Drawing '------------------------------------------------- 'cursor$ = "harrow.cur" 'cursor$ = "hand.cur" cursor$ = DefaultDir$ + "\hand.cur" 'This one I made by my self '................................................ nomainwin WindowWidth = 345 WindowHeight = 570 UpperLeftX = 100 UpperLeftY = 100 graphicbox #w.gbx, 20, 20, 300, 500 '................................................ open "Moving BMP (Paning)" for Window_nf as #w #w, "trapclose [quit]" '.....................................Load cursor. h = hwnd(#w.gbx) 'window handle 'Hand.cur only in gbx area ! calldll #user32, "LoadImageA",_ 0 as long,_ 'instance - use 0 for image from file cursor$ as ptr,_ 'path and filename of image _IMAGE_CURSOR as long,_ 'type of image 0 as long,_ 'desired width 0 as long,_ 'desired height _LR_LOADFROMFILE as long,_ 'load flag = load-from-file hCursor as ulong 'handle of cursor '.....................................Set cursor. calldll #user32,"SetClassLongA",_ h as ulong,_ 'window handle _GCL_HCURSOR as long,_ 'flag to change cursor hCursor as ulong,_ 'handle of cursor r as long '................................................ #w.gbx, "down" filedialog "Open image file", "*.bmp", fileName$ loadbmp "image", fileName$ #w.gbx, "cls; fill white ; drawbmp image 0 0 ; flush currentImage" '................................................ x2 = x1 : y2 = y1 '................................................ #w.gbx "when leftButtonDown [startmove]" wait '------------------------------------------------- [startmove] #w.gbx "when leftButtonDown" imagex = x1 - MouseX : imagey = y1 - MouseY #w.gbx "when leftButtonMove [move]" #w.gbx "when leftButtonUp [endmove]" wait '------------------------------------------------- [move] x1 = MouseX + imagex : y1 = MouseY + imagey '................................................ if x1 < -180 then x1 = -180 '\ if y1 < -308 then y1 = -308 ': Prevent to move the bmp if x1 > 0 then x1 = 0 ': out of the graphicbox! if y1 > 0 then y1 = 0 '/ '................................................
#w.gbx "DelSegment currentImage" #w.gbx "Fill White; drawbmp image ";x1;" ";y1 #w.gbx "flush currentImage" wait '------------------------------------------------- [endmove] #w.gbx "when leftButtonUp" #w.gbx "when leftButtonMove" #w.gbx "when leftButtonDown [startmove]" cursor normal x2 = x1 : y2 = y1 wait '------------------------------------------------- [quit] unloadbmp "image" cursor normal CallDLL #user32, "DestroyCursor",_ hCursor As ulong,_ DestroyCursor As long close #w end '--------
{:0)
Brandon Parker
|
|
|
Post by Brandon Parker on Feb 1, 2022 19:42:59 GMT -5
Ok, now that I have dedicated some time to this, I have something that I think will fit the bill for panning an image in a GraphicBox using Liberty BASIC. This example limits the panning to force the image to remain within the GraphicBox as I was eluding to in an earlier post.
The problem with the code that you posted is that the user may just keep panning for some time without lifting the left mouse button. This will cause LB to run out of memory in literally about 5 seconds if the user shakes the mouse back and for several times. Trust me, it was something I was looking at earlier when I was developing the code below, and I even tested it on your example. It took me only several seconds to cause a crash with a decently sized bitmap.
I think this example is a little more polished. I did leave the cursor code in there if the OP tries it on his system...
NoMainWin
Global False : False = 0 Global True : True = 1
cursor$ = DefaultDir$ + "\hand.cur" 'This one I made by my self
WindowWidth = 700 WindowHeight = 750 UpperLeftX = Int((DisplayWidth/ 2) - (WindowWidth/ 2)) UpperLeftY = Int((DisplayHeight/ 2) - (WindowHeight/ 2)) Global GraphicBoxWidth : GraphicBoxWidth = (WindowWidth - 45) Global GraphicBoxHeight : GraphicBoxHeight = (WindowHeight - 70)
Struct myData, hCursor As ulong, _ imageX As long, _ imageY As long, _ xLoc As long, _ yLoc As long, _ oldXLoc As long, _ oldYLoc As long
Struct tagBITMAP, bmType As long, _ bmWidth As long, _ bmHeight As long, _ bmWidthBytes As long, _ bmPlanes As word, _ bmBitsPixel As word, _ bmBits As ulong
Menu #Main, "&File", "&Load Bitmap", getNewBitmap GraphicBox #Main.gBox, 20, 10, GraphicBoxWidth, GraphicBoxHeight Open "Moving BMP (Panning)" For Window_NF As #Main #Main "TrapClose quit"
myData.hCursor.struct = LoadCursor(_NULL, cursor$, _NULL, _NULL, _LR_LOADFROMFILE) result = SetClassLong(Hwnd(#Main.gBox), _GCL_HCURSOR, myData.hCursor.struct)
Call getNewBitmap Wait
'_________________________________________________________________________________________________________________________________________________________ '_________________________________________________________________________________________________________________________________________________________
Sub getNewBitmap FileDialog "Open image file", "*.bmp", fileName$ If (fileName$ <> "") Then hBitmap = LoadBitmap(_NULL, fileName$, _NULL, _NULL, _LR_LOADFROMFILE Or _LR_DEFAULTSIZE) result = GetObject(hBitmap) result = DeleteObject(hBitmap) LoadBMP "image", fileName$ #Main.gBox "Down; Fill White; DrawBMP image 0 0; Flush currentImage" #Main.gBox "When leftButtonDown startmove" End If End Sub
'_________________________________________________________________________________________________________________________________________________________ '_________________________________________________________________________________________________________________________________________________________
Sub startmove handle$, MouseX, MouseY #handle$ "DelSegment currentImage" #handle$ "When leftButtonDown" myData.imageX.struct = myData.xLoc.struct - MouseX myData.imageY.struct = myData.yLoc.struct - MouseY #handle$ "When leftButtonMove move" #handle$ "When leftButtonUp endmove" End Sub
'_________________________________________________________________________________________________________________________________________________________ '_________________________________________________________________________________________________________________________________________________________
Sub move handle$, MouseX, MouseY myData.xLoc.struct = MouseX + myData.imageX.struct myData.yLoc.struct = MouseY + myData.imageY.struct
If myData.xLoc.struct < ((-1 * tagBITMAP.bmWidth.struct) + GraphicBoxWidth) Then myData.xLoc.struct = (-1 * (tagBITMAP.bmWidth.struct - GraphicBoxWidth)) End If If myData.yLoc.struct < ((-1 * tagBITMAP.bmHeight.struct) + GraphicBoxHeight) Then myData.yLoc.struct = (-1 * (tagBITMAP.bmHeight.struct - GraphicBoxHeight)) End If If myData.xLoc.struct > 0 Then myData.xLoc.struct = 0 If myData.yLoc.struct > 0 Then myData.yLoc.struct = 0 If (myData.oldXLoc.struct <> myData.xLoc.struct) Or (myData.oldYLoc.struct <> myData.yLoc.struct) Then #handle$ "DelSegment currentImage" #handle$ "DrawBMP image ";myData.xLoc.struct;" ";myData.yLoc.struct #handle$ "Flush currentImage" myData.oldXLoc.struct = myData.xLoc.struct myData.oldYLoc.struct = myData.yLoc.struct End If End Sub
'_________________________________________________________________________________________________________________________________________________________ '_________________________________________________________________________________________________________________________________________________________
Sub endmove handle$, MouseX, MouseY '#handle$ "CLS" '#handle$ "DrawBMP image ";myData.xLoc.struct;" ";myData.yLoc.struct '#handle$ "Flush currentImage" #handle$ "When leftButtonUp" #handle$ "When leftButtonMove" #handle$ "When leftButtonDown startmove" Cursor Normal End Sub
'_________________________________________________________________________________________________________________________________________________________ '_________________________________________________________________________________________________________________________________________________________
Sub quit handle$ If isBitMap("image") Then UnloadBMP "image" Cursor normal result = DestroyCursor(myData.hCursor.struct) Close #handle$ End End Sub
'_________________________________________________________________________________________________________________________________________________________ '_________________________________________________________________________________________________________________________________________________________
Function isBitMap(BMPName$) On Error GoTo [Error] isBitMap = Hbmp(BMPName$) [Error] End Function
'_________________________________________________________________________________________________________________________________________________________ '_________________________________________________________________________________________________________________________________________________________
Function LoadBitmap(hInst, file$, sizeX, sizeY, fuLoad) file$ = file$ + chr$(0) CallDLL #user32, "LoadImageA", hInst As ulong, _ file$ As ptr, _ _IMAGE_BITMAP As ulong, _ sizeX As long, _ sizeY As long, _ fuLoad As ulong, _ LoadBitmap As ulong End Function
'_________________________________________________________________________________________________________________________________________________________ '_________________________________________________________________________________________________________________________________________________________
Function GetObject(handle) size = Len(tagBITMAP.struct) CallDLL #gdi32, "GetObjectA", handle As ulong, _ size As long, _ tagBITMAP As struct, _ GetObject As long End Function
'_________________________________________________________________________________________________________________________________________________________ '_________________________________________________________________________________________________________________________________________________________
Function DeleteObject(hObj) CallDLL #gdi32, "DeleteObject", hObj As ulong, _ DeleteObject As long End Function
'_________________________________________________________________________________________________________________________________________________________ '_________________________________________________________________________________________________________________________________________________________
Function LoadCursor(hInst, file$, sizeX, sizeY, fuLoad) CallDLL #user32, "LoadImageA", hInst As ulong, _ file$ As ptr, _ _IMAGE_CURSOR As ulong, _ sizeX As long, _ sizeY As long, _ fuLoad As ulong, _ LoadCursor As ulong End Function
'_________________________________________________________________________________________________________________________________________________________ '_________________________________________________________________________________________________________________________________________________________
Function SetClassLong(hWnd, nIndex, dwNewLong) CallDLL #user32, "SetClassLongA", hWnd As ulong,_ 'window handle nIndex As long,_ 'flag to change cursor dwNewLong As ulong,_ 'handle of cursor SetClassLong As ulong End Function
'_________________________________________________________________________________________________________________________________________________________ '_________________________________________________________________________________________________________________________________________________________
Function GetCursor() CallDLL #user32, "GetCursor", GetCursor As ulong End Function
'_________________________________________________________________________________________________________________________________________________________ '_________________________________________________________________________________________________________________________________________________________
Function SetCursor(hCursor) CallDLL #user32, "SetCursor", hCursor As ulong, _ SetCursor As ulong End Function
'_________________________________________________________________________________________________________________________________________________________ '_________________________________________________________________________________________________________________________________________________________
Function DestroyCursor(hCursor) CallDLL #user32, "DestroyCursor", hCursor As ulong, _ DestroyCursor As long End Function
{:0)
Brandon Parker
|
|
emy
New Member
Hello
Posts: 45
|
Post by emy on Feb 2, 2022 14:34:55 GMT -5
Hello, These last days I could read about moving bmp and loading cursor. Very Interesting. It will be useful, helpful. Thanks for your help, also thanks to Walt Decker. Regards. Emy
|
|