English
Source / code snippets

Trackmenu in others Fenstern; Images summon / puffern

 

p.specht

O-Text Jonathan:

These code-shred can certainly someone use:
 $H windows.ph
'POINT-structure
Struct lpPoint = X&, Y&

Proc TrackMenuExt

    Parameters hWnd&, X&, Y&
    Declare Pnt#
    Dim Pnt#, lpPoint
    Pnt#.X& = X&
    Pnt#.Y& = Y&
    ~ClientToScreen(hWnd&, Addr(Pnt#))
    ~ScreenToClient(%hwnd, Addr(Pnt#))
    TrackMenu Pnt#.X&, Pnt#.Y&
    Dispose Pnt#

ENDPROC


is ne simple routine, with the one on one . Develop as the Mainwindow one TrackMenu create can. MenuItem() functions so How had.

If one in a Program many Images draw and these not over ands over again from the Festplatte loaded go should, one but too no pleasure has, each Image at the beginning particularly To loading, can these routines take:
'to that Puffern of Images
Declare BufferedImageFiles$'list the already gepufferten Images, separated through "|"
Declare hBufferedImages&[]'Handles the gepufferten Images

SubProc Create.hPicBuffered

    Parameters Typ&, s$
    Declare NewImg&

    If @Len(BufferedImageFiles$) = 0

        BufferedImageFiles$ = "|"

    EndIf

    If Typ& = -1

        Ifnot @InStr("|" + @Upper $(s$) + "|", @Upper $(BufferedImageFiles$))

            BufferedImageFiles$ = BufferedImageFiles$ + s$ + "|"
            hBufferedImages&[@InStr('|' + @Upper$(s$) + '|', @Upper$(BufferedImageFiles$))] = @Create("HPIC", -1, s$)

        EndIf

        NewImg& = @Create("hPicCopy", hBufferedImages&[@InStr('|' + @Upper$(s$) + '|', @Upper$(BufferedImageFiles$))])

    Else

        NewImg& = @Create("HPIC", Typ&, s$)

    EndIf

    Return NewImg&

ENDPROC

SubProc Create.hSizedPicBuffered

    Parameters Typ&, s$, X&, Y&, N&
    Declare NewImg&, XN&, YN&, factor1!, factor2!

    If @Len(BufferedImageFiles$) = 0

        BufferedImageFiles$ = "|"

    EndIf

    If Typ& = -1

        Ifnot @InStr("|" + @Upper $(s$) + "|", @Upper $(BufferedImageFiles$))

            BufferedImageFiles$ = BufferedImageFiles$ + s$ + "|"
            hBufferedImages&[@InStr('|' + @Upper$(s$) + '|', @Upper$(BufferedImageFiles$))] = @Create("HPIC", -1, s$)

        EndIf

        If N& = 1

            factor1! = X& / @Width(hBufferedImages&[@InStr('|' + @Upper$(s$) + '|', @Upper$(BufferedImageFiles$))])
            factor2! = Y& / @Height(hBufferedImages&[@InStr('|' + @Upper$(s$) + '|', @Upper$(BufferedImageFiles$))])

            If factor1! < factor2!

                XN& = X&
                YN& = @Height(hBufferedImages&[@InStr('|' + @Upper$(s$) + '|', @Upper$(BufferedImageFiles$))]) * factor1!

            Else

                XN& = @Width(hBufferedImages&[@InStr('|' + @Upper$(s$) + '|', @Upper$(BufferedImageFiles$))]) * factor2!
                YN& = Y&

            EndIf

        Else

            XN& = X&
            YN& = Y&

        EndIf

        NewImg& = @Create("hNewPic", XN&, YN&, 0)
        StartPaint NewImg&
        DrawSizedPic hBufferedImages&[@InStr('|' + @Upper$(s$) + '|', @Upper$(BufferedImageFiles$))], 0, 0 - XN&, YN&; 0
        EndPaint

    Else

        NewImg& = @Create("hSizedPic", Typ&, s$, X&, Y&, N&)

    EndIf

    Return NewImg&

ENDPROC

Proc DrawSizedPicBuffered

    Parameters s$, X&, Y&, DX&, DY&, N&

    If @Len(BufferedImageFiles$) = 0

        BufferedImageFiles$ = "|"

    EndIf

    Ifnot @InStr("|" + @Upper $(s$) + "|", @Upper $(BufferedImageFiles$))

        BufferedImageFiles$ = BufferedImageFiles$ + s$ + "|"
        hBufferedImages&[@InStr('|' + @Upper$(s$) + '|', @Upper$(BufferedImageFiles$))] = @Create("HPIC", -1, s$)

    EndIf

    DrawSizedPic hBufferedImages&[@InStr('|' + @Upper$(s$) + '|', @Upper$(BufferedImageFiles$))], X&, Y& - DX&, DY&; N&

ENDPROC

Proc DrawPicBuffered

    Parameters s$, X&, Y&, N&

    If @Len(BufferedImageFiles$) = 0

        BufferedImageFiles$ = "|"

    EndIf

    Ifnot @InStr("|" + @Upper $(s$) + "|", @Upper $(BufferedImageFiles$))

        BufferedImageFiles$ = BufferedImageFiles$ + s$ + "|"
        hBufferedImages&[@InStr('|' + @Upper$(s$) + '|', @Upper$(BufferedImageFiles$))] = @Create("HPIC", -1, s$)

    EndIf

    DrawPic hBufferedImages&[@InStr('|' + @Upper$(s$) + '|', @Upper$(BufferedImageFiles$))], X&, Y&; N&

ENDPROC

Proc DeleteImageBuffer

    WhileLoop 0, @SizeOf(hBufferedImages&[]) - 1

        If hBufferedImages&[&loop]

            DeleteObject hBufferedImages&[&loop]

        EndIf

    EndWhile

ENDPROC


The Procs supplant Create("HPIC"), Create("hSizedPic"), DrawPic and DrawSizedPic in her shape to that loading of Images from the Festplatte. becomes one Image to that first time loaded, loading these routines the image into RAM and keep there a copy of it. becomes the image anew loaded, becomes The copy in the RAM using and not again from the Festplatte loaded. on the end ought to one DeleteImageBuffer not forget, so The whole Handles the copies again released go.

Greeting
Jonathan
 
XProfan 11
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
06/12/21  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.351 Views

Untitledvor 0 min.
Gast.0815 vor 4 Tagen
Member 862464105/12/24
RGH12/26/21
p.specht11/20/21
More...

Themeninformationen

this Topic has 1 subscriber:

p.specht (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie