2 Questions:

1.
How is the windows cursor drawn? ddraw? I don't understand and I can't find any information on it.


2.
When you control alt delete in windows 7 how is that screen drawn?

Thanks

Dani AI

Generated

Short answer for : the pointer you see is an OS-managed resource. Applications create or load a cursor handle (LoadCursor/CreateCursor and set it with SetCursor), but the system/graphics stack is what actually draws it on-screen. On Windows 7 the Desktop Window Manager (DWM) composes the desktop using the GPU; the pointer may be shown as a hardware cursor (a driver “sprite”/overlay for lowest latency) when the driver supports it, or it can be composed by DWM as part of the final desktop image. DirectDraw is not the mechanism an app uses to make the system pointer appear—use the Win32 cursor APIs instead. (learn.microsoft.com)

If you need to capture or redraw the current cursor yourself (for recording, custom overlays, testing), query the global cursor and its screen position and then draw it into an HDC. Minimal example (C++):

CURSORINFO ci = { sizeof(ci) };
if (GetCursorInfo(&ci) && (ci.flags & CURSOR_SHOWING)) {
    DrawIconEx(hdc, ci.ptScreenPos.x, ci.ptScreenPos.y, ci.hCursor, 0, 0, 0, NULL, DI_NORMAL);
}

Use GetCursorInfo and DrawIconEx for this workflow. (learn.microsoft.com)

About Ctrl+Alt+Del: that key combo is the Secure Attention Sequence (SAS). The kernel/Winlogon infrastructure registers and handles it so user apps (and hooks) cannot intercept or spoof it. When SAS is received, Winlogon switches to the secure Winlogon desktop and the trusted logon UI (LogonUI/Winlogon) draws the secure screen — that’s why hooks won’t see the sequence and why was right to call out SAS as special. (learn.microsoft.com)

Notes tied to the thread: ’s nudge toward Win32 cursor APIs is useful—start with the “Using Cursors” docs—but add the DWM/driver layer to the picture for Windows 7-era behavior. For full-screen apps (games) the app often hides the system cursor and renders its own; for low-latency UI, hardware cursor support in the driver matters. (learn.microsoft.com)

Recommended Answers

All 5 Replies

1.
you should be reading a tutorial on win32 api functions. But anyway, here is how cursors are created.

2.
Probably uses windows hooks to capture keyboard events.

2.
Probably uses windows hooks to capture keyboard events.

The CTRL+ALT+DEL key combination is SAS (Secure attention sequence), and will not be delivered to hooks.

Even if it were not SAS, it's the OS that draws the screen when that key combination is pressed, and the OS does not need to install hooks to monitor events (including key strokes).

Hooks are for applications to know what's happening within the OS.

Ok so you might be right about the SAS part. But the os only does low-level drawing. The os knows nothing about what the application program is doing. Some programmer had to write that program which is displayed when Ctrl+Alt+Del is hit on the keyboard. It's nothing more or less than another application program, just as MS-Word and MS-Paint are application programs. The operating system itself can run just fine without the help of any of those programs.

Ok so you might be right about the SAS part.

Oh, thanks for acknowledging that. And the rest of the stuff I said is right as well, but you seem to be confused. I'll try to explain.

2. Probably uses windows hooks to capture keyboard events.

You said that windows probably uses hooks to capture keyboard events, and I gave you two reasons for why that statement is incorrect.

1. Windows need not install a hook. It never does. Ever. Hooks are a mechanism that windows provide for applications to know what's going on (certain events) within windows.

2. Additionally this Ctrl+Alt+Del key combination will NEVER be delivered to a hook, because of the reason I already mentioned (SAS).

That's all I said, and I thought it was easy to understand.

But the os only does low-level drawing. The os knows nothing about what the application program is doing. Some programmer had to write that program which is displayed when Ctrl+Alt+Del is hit on the keyboard. It's nothing more or less than another application program, just as MS-Word and MS-Paint are application programs. The operating system itself can run just fine without the help of any of those programs.

That helped me understand you're probably confused about the topic itself, and my response.

bump... that's just the loading. I mean the literal drawing of it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.