News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Drawing the DeskTop and Windows 8

Started by caraveiro, April 04, 2013, 06:52:31 AM

Previous topic - Next topic

caraveiro

I'd use poliline to draw in the windows Desktop.


The next code draws a simple rectangule outline shape on the desktop. BUT does not work in windows 8 (somehow W8 mess the inner area of the rectangle):


    Invoke CreateDC,addr szDisplay,NULL,NULL,NULL ;MultiMonitor
    ;Invoke GetDC,NULL ;Main monitor
    mov   hDC,eax
    ;
        lea ecx,sPoints
        mov eax,dStartX
        mov dword ptr[ecx],eax
        add ecx,4
        mov eax,dStartY
        mov dword ptr[ecx],eax
        ;
        add ecx,4
        mov eax,dStartX
        add eax,dWidth
        mov dword ptr[ecx],eax
        add ecx,4
        mov eax,dStartY
        mov dword ptr[ecx],eax
        ;
        add ecx,4
        mov eax,dStartX
        add eax,dWidth
        mov dword ptr[ecx],eax
        add ecx,4
        mov eax,dStartY
        add eax,dHeigth
        mov dword ptr[ecx],eax
        ;
        add ecx,4
        mov eax,dStartX
        mov dword ptr[ecx],eax
        add ecx,4
        mov eax,dStartY
        add eax,dHeigth
        mov dword ptr[ecx],eax
        ;
        add ecx,4
        mov eax,dStartX
        mov dword ptr[ecx],eax
        add ecx,4
        mov eax,dStartY
        mov dword ptr[ecx],eax
        ;
        mov dPoints,5 ;Number of points
        ;               
    Invoke Polyline,hDC,addr sPoints,dPoints ;Usar mejor PolyPolyline   
    ;
    Invoke ReleaseDC,NULL,hDC 



I think that Windows 8 needs some "setgraphicmode" or something else setting to work properly.

Any clues?

Thnks.
"knowledge is now free at last, everything should be free from now on, enjoy knowledge and life and work for everybody else"
+ORC

qWord

You did not select a brush in the DC before drawing (the desktop-LV's DC has a hollow brush selected). Furthermore, note that your are asynchronously drawing to the desktop list view, which will quickly overdrawn by the control.
You might consider about an overlay window/control or similar.
MREAL macros - when you need floating point arithmetic while assembling!

caraveiro

Quote from: qWord on April 04, 2013, 08:45:29 AM
You did not select a brush in the DC before drawing (the desktop-LV's DC has a hollow brush selected).

I use to draw in the Desktop as a matter of ruler for some application, so the drawing must appear over the top application.

Quote from: qWord on April 04, 2013, 08:45:29 AM
Furthermore, note that your are asynchronously drawing to the desktop list view, which will quickly overdrawn by the control.
You might consider about an overlay window/control or similar.
How can I get done without loosing the focus in the top application?

Thank in advance.
"knowledge is now free at last, everything should be free from now on, enjoy knowledge and life and work for everybody else"
+ORC

qWord

you maybe give us more details on your problem?

There several, more or less complicated ways to overdraw windows of other processes:
- the target program has a public API/Interface/etc..
- window hooks (requires code/DLL injection, should be avoided)
- layered window on top of the target window in combination with active accessibility events
- DirectX/Draw overlays (AFAIK support depends on installed graphic card)
- ...?

qWord
MREAL macros - when you need floating point arithmetic while assembling!