Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
carino, molto simile ma non è proprio quello che avevo fatto.
in pratica il tuo esempio è come un layer su cui vai ad eseguire il paint.
invece intendevo proprio il paint diretto sul desktop.
precisamente sotto le icone, mentre in questo esempio il testo va sopra alle icone e sopra alle applicazioni.
E precisamente quello che volevo fare, disegnare allo stesso livello del desktop.
Il mio è stato un test, non è certo la soluzione migliore, anzi penso sia la peggiore.
E decisamente troppo lento.
Penso che ogni Timeout anche se impostato a 20 o 30 arrivi a scattare circa a 200 se non 300 ms
un bel distacco e decisamente poco fluido. però con background nero sul desktop e testo che scende, e un bell'effetto.
peccato che sia lento.
Puoi provare a ricavare l'HWND del desktop, ricavare poi l'HDC di quell'HWND e disegnare direttamente su quello con le classiche API di GDI.
=============================
The GetDesktopWindow function returns the handle of the Windows desktop window. The desktop window covers the entire screen. The desktop window is the area on top of which all icons and other windows are painted.
HWND GetDesktopWindow(VOID);
Parameters This function has no parameters.
Return Values The return value is the handle of the desktop window.
=============================
The GetDC function retrieves a handle of a display device context (DC) for the client area of the specified window. The display device context can be used in subsequent GDI functions to draw in the client area of the window.
This function retrieves a common, class, or private device context depending on the class style specified for the specified window. For common device contexts, GetDC assigns default attributes to the device context each time it is retrieved. For class and private device contexts, GetDC leaves the previously assigned attributes unchanged.
HDC GetDC(HWND hWnd);
Parameters hWnd: Identifies the window whose device context is to be retrieved.
Return Values If the function succeeds, the return value identifies the device context for the given window's client area.
If the function fails, the return value is NULL.
Remarks After painting with a common device context, the ReleaseDC function must be called to release the device context. Class and private device contexts do not have to be released. The number of device contexts is limited only by available memory.
=============================
The ReleaseDC function releases a device context (DC), freeing it for use by other applications. The effect of the ReleaseDC function depends on the type of device context. It frees only common and window device contexts. It has no effect on class or private device contexts.
int ReleaseDC(HWND hWnd, HDC hDC);
Parameters hWnd: Identifies the window whose device context is to be released.
hDC: Identifies the device context to be released.
Return Values The return value specifies whether the device context is released. If the device context is released, the return value is 1. If the device context is not released, the return value is zero.
Remarks The application must call the ReleaseDC function for each call to the GetWindowDC function and for each call to the GetDC function that retrieves a common device context.
An application cannot use the ReleaseDC function to release a device context that was created by calling the CreateDC function; instead, it must use the DeleteDC function.
=============================
Ultima modifica effettuata da AldoBaldo il 06/05/2024 alle 21:49
ATTENZIONE! Sono un hobbista e l'affidabilità delle mie conoscenze informatiche è molto limitata. Non prendere come esempio il codice che scrivo, perché non ho alcuna formazione accademica e rischieresti di apprendere pratiche controproducenti.
Sì, Carlo, le icone e il resto fanno comunque parte dell'immagine mostrata nell'HDC. Quando disegni in un HDC sovrapponi i nuovi segni a quelli già esistenti. Se ora ho ben capito, tu vorresti invece modificare lo sfondo del desktop e ritracciarlo prima che il sistema ci sovrapponga le icone e il resto. Non so neppure se è o non è possibile!
ATTENZIONE! Sono un hobbista e l'affidabilità delle mie conoscenze informatiche è molto limitata. Non prendere come esempio il codice che scrivo, perché non ho alcuna formazione accademica e rischieresti di apprendere pratiche controproducenti.
Sì, Carlo, le icone e il resto fanno comunque parte dell'immagine mostrata nell'HDC. Quando disegni in un HDC sovrapponi i nuovi segni a quelli già esistenti. Se ora ho ben capito, tu vorresti invece modificare lo sfondo del desktop e ritracciarlo prima che il sistema ci sovrapponga le icone e il resto. Non so neppure se è o non è possibile!
Non ho trovato api.
Il metodo di Thejuster, anche se non l'ho provato funziona sicuramente: prende lo sfondo, lo copia in una bitmap, crea una nuova bitmap ci disegna lo sfondo e poi ci disegna sopra i caratteri, salva la nuova bitmap e la ricarica come sfondo del desktop. Ripete il ciclo usando sempre come partenza la bitmap con lo sfondo originale.
Potresti controllare in C se esiste un mezzo per sostituire in modo efficiente lo sfondo del desktop... Thejuster per farlo è passato per un file...
Quello che ho scoperto, e che il processo che disegna sul desktop è chiamato Progman
che fa riferimento all'istanza Worker contenuta in Program Manager aka Progman.
Penso che sia proprio a quello che dobbiamo puntare per poter disegnarci sopra.