Krzysztof Mossakowski
Windows Programming
2005 - Tasks
DLL, registry, clipboard
Sample task
Demonstration
(archive file with exe i dll files)
depends.exe
DLL:
mouse cursor with the number 20000 in resources
exported function
void StampClipboardBitmap( HWND hWnd )
where:
hWnd
- handle of the main application's window
if there is a bitmap (in CF_BITMAP format) in the clipboard::
show modal dialog box with two pictures of the bitmap: original and modified
modify the bitmap using
the stamp
(transparent color: (0, 255, 255))
Cancel button - close the dialog box without any action
OK button - copy modified bitmap to the clipboard (in CF_BITMAP format) and text (in CF_TEXT format) with information
if there is no bitmap in the clipboard, show message box
Application:
Clipboard / Modify bitmap
call the function from DLL:
StampClipboardBitmap( hWnd )
Registry / Software\Microsoft\Windows\CurrentVersion\Run
get from the registry list of programs run during windows startup (values of the key HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run)
show the list in the main window
Cursor / Standard
change window's cursor
Icon / From DLL
set window's icon using icon taken from DLL
IMPORTANT: DLL must be linked dynamically, show custom message box when there is no DLL.
Hints:
OpenClipboard(), IsClipboardFormatAvailable(), GetClipboardData(), SetClipboardData(), CloseClipboard()
GlobalAlloc(), GlobalLock(), GlobalUnlock()
TransparentBlt()
LoadCursor(), SetCursor(), WM_SETCURSOR
LoadLibrary(), FreeLibrary(), GetProcAddress()
RegOpenKeyEx(), RegEnumValue(), RegCloseKey()
DrawText()