Win32api baru yang lama
Halaman ini menyediakan daftar tautan ke subset posting blog terkenal Raymond Chen The Old New Thing . Subset terbatas terutama untuk Win32api dan beberapa hal terkait COM.
Alasan mengapa saya mempertahankan halaman ini adalah bahwa ia sering memberikan informasi yang hilang pada MSDN atau yang dijelaskan di sana dengan cara yang samar, dan juga karena blog tidak mudah dicari.
Tautan di sini dikategorikan berdasarkan topik mereka alih -alih urutan kronologis. Terkadang, bila perlu, satu pos dapat dimasukkan ke dalam beberapa kategori.
Dalam beberapa kasus (cukup jarang), tautan ke sumber lain termasuk jika ditemukan berguna.
Penafian: Saya tidak mengklaim kepengarangan dari konten terkait apa pun. Ini hanya tentang organisasi yang diharapkan dari artikel hebat yang ditulis Raymond selama bertahun -tahun.
Daftar isi
- Proses dan utas
- Proses
- Utas
- Kumpulan benang
- Afinitas benang objek
- Tumpukan Thread
- Serat
- Sinkronisasi
-
WaitOnAddress()
-
WaitForMultipleObjects()
dan kerabat - Pola bebas kunci
- DLLS
- Sumber daya
- Sumber daya bitmap dan ikon
- Templat dialog
- Templat menu dan sumber daya akselerator
- Sumber daya string
- Template Versi
- Data dan Sumber Daya Kustom
- Aplikasi (secara keseluruhan)
-
HWND
(sudut pandang umum)- Hirarki Windows
- Gaya jendela
- Kelas jendela
- Jendela tingkat atas
- Bingkai jendela dan keterangan
- Dwm
- Dialog
- Dialog bersarang dan tertanam
- Dialog umum
- Kontrol navigasi
- Manajer Dialog
- Pengandaian
- Lembar properti
- Kontrol
- Kontrol Animasi
- Tombol
- Kotak kombo
- Edit kontrol
- Daftar tampilan
- Kontrol Teks Kaya
- Gulir
- Kontrol statis
- Toolbars
- Tooltips
- Trackbars
- Tampilan Daftar Pohon
- Pemrosesan pesan
- Pesan tertentu
- Pemberitahuan
- Konstruksi dan Penghancuran Jendela
- Pesan Geometri Jendela
- Pesan Lukisan Jendela
- Pesan Fokus Jendela
- Pesan keyboard
- Pesan tikus
- Pesan dialog
- Pesan jendela lainnya
- Pesan sistem
- GDI
- Kursor
- Kuas
- Pena
- Bitmaps
- Dib
-
LockWindowUpdate()
- Melukis elemen standar
-
UXTHEME.DLL
- Beberapa monitor
- Aksesibilitas
- Com
- Mendeklarasikan antarmuka COM
- Apartemen com
- COM Inisialisasi
- COM statis store
- Com Marshaling
- Com penanganan kesalahan
- Com antarmuka asinkron
- Panduan
- Com string
- Varian com
-
IUnknown
-
IMoniker
-
ICallback
-
IContextMenu
-
IFileDialog
-
IMultiLanguage
-
INamespaceWalk
-
IStream
-
IVirtualDesktopManager
- CLIPBOARD
- Seret dan lepas
- Enumerasi
- Kerang
- Hal -hal com tanpa kategori
- Ingatan
- Input dan output
- Input dan output asinkron
- File dan direktori
- ACL
- Izin keamanan, atribut dan pengidentifikasi
- Registri
- String dan lokal
- Layanan NT
- Tidak dikategorikan
Proses dan utas
Proses
-
CreateProcess
tidak menunggu proses dimulai - Mengapa fungsi
CreateProcess
memodifikasi baris perintah inputnya? - Mengapa orang mengambil kunci di sekitar panggilan
CreateProcess
? - Menonaktifkan Dialog Kecelakaan Program
- Bagaimana cara saya meneruskan banyak data ke suatu proses saat dimulai?
- Apa tujuan parameter
hPrevInstance
ke WinMain
? - Apakah
RunAsInvoker
rahasia, bahkan pengaturan UAC yang lebih tinggi? - Bagaimana cara mencegah proses anak menampilkan dialog pelaporan kesalahan Windows?
- Bagaimana mungkin
WriteProcessMemory
berhasil tertulis untuk memori read-only? - Apakah ide yang bagus untuk membiarkan
WriteProcessMemory
mengelola perlindungan halaman untuk saya? - Bagaimana Saya Dapat Meluncurkan Proses Yang Tidak Dipertebarkan Dari Proses Tinggi Saya, Redux
- Bagaimana cara memeriksa tingkat integritas proses saya?
- Benarkah menaikkan pengecualian terstruktur dari penangan pengecualian terstruktur mengakhiri proses?
- Cara yang lebih langsung dan bebas kesalahan untuk membuat proses dalam objek pekerjaan
Utas
- Benang dan ID Proses tidak valid
- Mengapa pegangan utas saya tiba -tiba menjadi buruk? Yang saya lakukan hanyalah menunggu!
- Apa yang terjadi jika Anda hanya kembali dari callback utas yang diteruskan ke
_beginthread
dan _beginthreadex
? - Mengapa Anda tidak boleh menangguhkan utas
- Bahaya tidur di utas UI
- Dalam mengejar antrian pesan
- Menghitung utas dalam suatu proses
- Pekerjaan antarmuka pengguna Win32 secara inheren dilapisi satu
- Seberapa buruk menunda menutup pegangan utas untuk waktu yang lama setelah utas keluar?
- Jika saya menelepon
GetExitCodeThread
untuk utas yang saya tahu pasti telah keluar, mengapa masih mengatakan STILL_ACTIVE
? - Apakah ada masalah dengan
CreateRemoteThread
pada sistem 64-bit? - Apakah fungsi
TerminateThread
sinkron? - Menghapus
TerminateThread
dari kode yang menunggu objek pekerjaan mengosongkan - Apa gunanya
FreeLibraryAndExitThread
? - Apa yang terjadi jika saya memberikan nilai -nilai kontradiktif untuk komit stack dan stack cadangan?
Kumpulan benang
- Apa sebenarnya arti parameter
msWindowLength
untuk SetThreadpoolTimer
? - Apa perbedaan antara
CreateTimerQueueTimer
dan SetThreadpoolTimer
? - Cara menghindari mengakses memori yang dibebaskan saat membatalkan panggilan balik kumpulan utas
- Menghindari kebuntuan saat membatalkan panggilan balik kumpulan utas, Bagian 1: Data Panggilan Balik Eksternal
- Menghindari kebuntuan saat membatalkan panggilan balik kumpulan utas, Bagian 2: Mengacu kembali ke objek yang berisi
- Gotcha: timer berkala threadpool tidak akan menunggu kutu sebelumnya selesai
- Mengapa saya mendapatkan pengecualian dari kumpulan utas selama shutdown proses?
- Apa yang terjadi dengan nilai yang dikembalikan dari fungsi yang diteruskan ke
QueueUserWorkItem
? - Model mental untuk
StartThreadpoolIo
- Bagaimana cara mendeteksi bahwa item pekerjaan kumpulan utas memakan waktu terlalu lama?
- Bagaimana saya bisa menutup kumpulan utas dan membatalkan semua pekerjaan yang telah diantri?
Afinitas benang objek
- Afinitas utas objek antarmuka pengguna, bagian 1: pegangan jendela
- Afinitas Thread Objek Antarmuka Pengguna, Bagian 2: Konteks Perangkat
- Afinitas utas objek antarmuka pengguna, bagian 3: menu, ikon, kursor, dan tabel akselerator
- Thread Affinity Objek Antarmuka Pengguna, Bagian 4: Objek GDI dan Catatan Lainnya Tentang Afinitas
- Afinitas Thread Objek Antarmuka Pengguna, Bagian 5: Pembersihan Objek
- Afinitas Thread Objek Antarmuka Pengguna: Addendum
Tumpukan Thread
- Bagaimana cara memperluas tumpukan utas saya saat runtime?
- Menggunakan serat untuk memperluas tumpukan utas saat runtime, Bagian 1
- Menggunakan serat untuk memperluas tumpukan utas saat runtime, Bagian 2
- Menggunakan serat untuk memperluas tumpukan utas saat runtime, Bagian 3
- Menggunakan serat untuk memperluas tumpukan utas saat runtime, Bagian 4
- Menggunakan serat untuk memperluas tumpukan utas saat runtime, Bagian 5
- Menggunakan serat untuk memperluas tumpukan utas saat runtime, Bagian 6
- Membandingkan serat dengan utas dengan tujuan memperluas tumpukan utas saat runtime
- Menentukan kira -kira berapa banyak ruang tumpukan yang tersedia, Bagian 1
- Menentukan kira -kira berapa banyak ruang tumpukan yang tersedia, Bagian 2
Serat
- Apa yang terjadi pada serat yang berlari di utas saat utas keluar?
- Tidak apa -apa menggunakan serat, tetapi semua orang harus ikut serta dengan rencana tersebut
- Serat tidak bermanfaat lagi; hanya ada satu sudut yang tetap berguna karena alasan yang tidak terkait dengan serat
Sinkronisasi
- Memahami konsekuensi dari
WAIT_ABANDONED
- Peristiwa Kunci Windows, Bagian Kritis, dan Fitur Sinkronisasi Vista Baru
- Menggabungkan antrian kerja dari acara yang berbeda, pesanan tidak penting, dengan acara reset otomatis
- Seberapa adil kunci SRW, terutama ketika ada pembaca dan penulis?
- Anda dapat menggunakan file sebagai objek sinkronisasi juga
- Bisakah saya menunggu acara kernel untuk menjadi tidak bertanda ?
- Jika kunci pembaca/penulis ramping (
SRWLOCK
) tidak ingat siapa pemilik kunci bersama, apakah itu berarti tidak apa -apa untuk mendapatkannya secara rekursif?
WaitOnAddress()
-
WaitOnAddress
memungkinkan Anda membuat objek sinkronisasi dari variabel data apa pun, bahkan byte - Menerapkan penghalang sinkronisasi dalam hal
WaitOnAddress
- Menerapkan bagian kritis dalam hal
WaitOnAddress
- Memperluas bagian kritis kami berdasarkan
WaitOnAddress
untuk mendukung timeout - Membandingkan
WaitOnAddress
dengan futex (futexi? Futexen?) - Membuat semaphore dari
WaitOnAddress
- Membuat semaphore dengan jumlah maksimum dari
WaitOnAddress
- Membuat acara reset manual dari
WaitOnAddress
- Membuat acara reset otomatis dari
WaitOnAddress
WaitForMultipleObjects()
dan kerabat
-
MsgWaitForMultipleObjects
dan status antrian - Anda dapat menghubungi
MsgWaitForMultipleObjects
dengan nol pegangan - Memompa pesan sambil menunggu periode waktu
- Menunggu semua pegangan dengan
MsgWaitForMultipleObjects
adalah bug yang menunggu untuk terjadi - Mengapa
WaitForMultipleObjects
return ERROR_INVALID_PARAMETER
Ketika semua parameter terlihat valid untuk saya? - Jika lebih dari satu objek menyebabkan
WaitForMultipleObjects
kembali, bagaimana cara mengetahui tentang yang lain? - Apa gunanya melewati peristiwa yang tidak pernah sinyal ke
MsgWaitForMultipleObjects
?
Pola bebas kunci
- Kunci GRATIS banyak pola produser/konsumen tunggal: antrian kerja dengan tugas menyatu
- Kunci Gratis banyak pola produser/konsumen tunggal: antrian kerja di mana yang terakhir menang
- Kunci GRATIS Pola banyak produser/konsumen tunggal: antrian kerja dari peristiwa yang tidak koaling identik
- Kunci GRATIS banyak pola produser/konsumen tunggal: antrian kerja dari peristiwa yang berbeda, pesanan tidak penting
- Kunci GRATIS banyak pola produser/konsumen tunggal: antrian kerja dari peristiwa yang berbeda, FIFO
- Kunci GRATIS banyak pola produser/konsumen tunggal: antrian kerja dari peristiwa yang berbeda, pesanan tidak penting, pertanyaan tindak lanjut
DLLS
- Jangan percaya alamat pengembalian
- Mengapa saya tidak bisa
GetProcAddress
fungsi yang saya lakukan? - Apa perbedaan antara
HINSTANCE
dan HMODULE
? - Mengakses
HINSTANCE
Modul Saat Ini Dari Perpustakaan Statis -
LoadLibraryEx(DONT_RESOLVE_DLL_REFERENCES)
pada dasarnya cacat - Mengapa DLL diturunkan dalam urutan "salah"?
- Bagaimana fungsi DLL diekspor di jendela 32-bit?
- Fungsi yang diekspor yang benar -benar penyerang
- Memikirkan Kembali Cara Ekspor DLL Diselesaikan untuk Windows 32-Bit
- Nama di perpustakaan impor didekorasi karena suatu alasan
- Apa yang terjadi saat Anda salah?
- Masalah yang terkait dengan memaksa rintisan yang akan dibuat untuk fungsi impor
- Mengalokasikan dan membebaskan memori melintasi batas modul
- Penerusan DLL tidak sama dengan penundaan pemuatan
- Apa itu DLL Import mengisyaratkan?
- Apa Impor Impor DLL?
- Apa gunanya
FreeLibraryAndExitThread
? - Perpustakaan yang dimuat melalui
LOAD_LIBRARY_AS_DATAFILE
(atau bendera serupa) tidak bisa bermain di game modul rusa apa pun - Mungkinkah ada masalah dengan menelepon
GetModuleFileNameEx
pada proses Anda sendiri? - Bagaimana saya dapat menentukan bahwa DLL saya harus menyelesaikan ketergantungan DLL dari direktori yang sama dengan DLL?
- Setelah saya membuat DLL keterlambatan-saya memuat DLL lain, DLL saya sudah mulai menabrak kode lepas prosesnya
- Berbagai jenis penanaman DLL
- Mengapa
GetModuleInfo
gagal menghasilkan titik masuk untuk executable? - Apa arti
SizeOfImage
dalam struktur MODULEINFO
? - Bagaimana cara menekan kotak kesalahan yang muncul ketika
LoadLibrary
gagal?
DllMain()
- Beberapa alasan untuk tidak melakukan sesuatu yang menakutkan di
DllMain
Anda - Alasan lain untuk tidak melakukan sesuatu yang menakutkan di
DllMain
Anda: kebuntuan yang tidak disengaja - Beberapa alasan untuk tidak melakukan sesuatu yang menakutkan di
DllMain
Anda, Bagian 3 - Utas yang mendapatkan pemberitahuan
DLL_PROCESS_DETACH
belum tentu yang mendapatkan DLL_PROCESS_ATTACH notification
- Bagaimana Anda mungkin memuat DLL selama
DLL_PROCESS_DETACH
tanpa bahkan menyadarinya - Saat
DLL_PROCESS_DETACH
memberi tahu Anda bahwa prosesnya keluar, taruhan terbaik Anda hanya untuk kembali tanpa melakukan apa pun
Sumber daya
- Kompiler sumber daya default ke
CP_ACP
, bahkan di hadapan petunjuk halus bahwa file tersebut adalah UTF-8 - Hubungan antara sumber daya modul dan objek yang diturunkan sumber daya di jendela 32-bit
- Apa perbedaan antara
FreeResource
dan, katakanlah, DestroyAcceleratorTable
- Sumber daya PE harus disejajarkan 4-byte, tetapi itu tidak menghentikan orang untuk mencoba keberpihakan lainnya
- Bagaimana saya bisa mengatakan bahwa seseorang menggunakan makro
MAKEINTRESOURCE
untuk menyelundupkan bilangan bulat di dalam pointer? - Gotcha Nasty yang mengerikan:
FindResource
dan FindResourceEx
Sumber daya bitmap dan ikon
- Mengapa bitmap yang tidak tergantung perangkat terbalik?
- Format sumber daya bitmap
- Format Sumber Daya Ikon
- Format sumber daya ikon, ditinjau kembali
- Evolusi Format File ICO, Bagian 1: Awal Monokrom
- Evolusi format file ICO, Bagian 2: Sekarang berwarna!
- Evolusi Format File ICO, Bagian 3: Gambar Berpadu Alfa
- Evolusi Format File ICO, Bagian 4: Gambar PNG
- Bagaimana cara mengatur saluran alfa bitmap GDI menjadi 255?
Sumber Daya String Pesan
- Mengapa
FormatMessage
mengatakan bahwa %0
mengakhiri pesan tanpa trailing newline? Apakah secara diam -diam menambahkan Newline?
Templat dialog
- Tentang kesulitan mendapatkan tata letak piksel-sempurna di Templat Dialog Win32
- Evolusi Template Dialog - Template Klasik 32 -Bit
- Evolusi Template Dialog - Template Diperpanjang 32 -Bit
- Evolusi Template Dialog - Ringkasan
- Kompiler Sumber Daya akan membantu menambahkan gaya jendela untuk Anda, tetapi jika Anda membuat templat dialog sendiri, Anda tidak mendapatkan bantuan itu
Templat menu dan sumber daya akselerator
- Evolusi Template Menu: Pendahuluan
- Evolusi Template Menu: Menu Klasik 32-Bit
- Evolusi Template Menu: Menu Diperpanjang 32-Bit
- Format sumber daya tabel akselerator
Sumber daya string
- Format sumber daya string
-
LoadString
dapat memuat string dengan nol tertanam, tetapi fungsi pembungkus Anda mungkin tidak
Template Versi
- Evolusi Sumber Daya Versi - Sumber Daya Versi 32 -Bit
- Evolusi Sumber Daya Versi - Sumber Daya Versi 32 -Bit yang rusak
Data dan Sumber Daya Kustom
- Format data dan sumber daya khusus
Aplikasi (secara keseluruhan)
- Windows mana yang muncul di daftar
Alt+Tab
? - Windows Vista Mengubah Sedikit Pesanan
Alt+Tab
- Pekerjaan antarmuka pengguna Win32 secara inheren dilapisi satu
- Kapan
STARTF_USESHOWWINDOW
mengganti parameter yang diteruskan ke ShowWindow
? -
WaitForInputIdle
harus benar -benar disebut WaitForProcessStartupComplete
-
WaitForInputIdle
menunggu utas apa pun, yang mungkin bukan utas yang Anda pedulikan - Apa konvensi untuk mengelola pegangan standar?
- Pegangan standar benar-benar dimaksudkan untuk program tunggal
- Jika saja DLL bisa mendapatkan pemberitahuan
DllMain
, bagaimana EXE dapat menerima pemberitahuan ketika utas dibuat (misalnya)?
Baris perintah
- Kata pertama pada baris perintah adalah nama program hanya dengan konvensi
- Bagaimana fungsi
CommandLineToArgvW
dimaksudkan untuk digunakan? - Ada apa dengan perlakuan aneh tanda kutip dan backslash oleh
CommandLineToArgvW
Taskbar
- Bagaimana cara mencegah pengguna menyematkan program saya ke bilah tugas?
- Alih -alih membuat sesuatu dan kemudian mencoba menyembunyikannya, jangan membuatnya di tempat pertama (ikon baki)
- Bagaimana jika aplikasi saya benar -benar dua aplikasi yang dibundel ke dalam satu file, dan saya ingin mereka dikumpulkan menjadi dua grup di bilah tugas di Windows 7?
- Bagaimana cara menyesuaikan bagaimana jendela aplikasi saya dikelompokkan di bilah tugas?
- Tampilkan overlay pada tombol bilah tugas
- Tampilkan Tombol Kontrol di Jendela Pratinjau Taskbar Anda
- Tampilkan thumbnail khusus untuk aplikasi Anda (dan saat Anda melakukannya, pratinjau langsung khusus)
- Bagaimana cara menanyakan lokasi bilah tugas pada monitor sekunder?
- Bagaimana program itu berhasil menjepit dirinya ke bilah tugas saya ketika saya menginstalnya?
- Bagaimana jika saya memiliki dua program yang secara logis satu aplikasi, dan saya ingin mereka diperlakukan sebagai kelompok tunggal di bilah tugas?
- Mengapa ikon bilah tugas untuk Windows yang dikelompokkan berubah menjadi sesuatu yang aneh?
HWND
(sudut pandang umum)
- Apa artinya agar sebuah jendela menjadi Unicode?
- Bagaimana saya bisa mendapatkan alamat prosedur jendela yang sebenarnya dan bukan yang besar?
- Apa nilai -nilai aneh yang dikembalikan dari
GWLP_WNDPROC
? - Byte jendela bonus di
GWLP_USERDATA
- Apa perbedaan antara
WM_DESTROY
dan WM_NCDESTROY
? - Mengirim jendela pesan
WM_DESTROY
seperti lelucon yang memanggil seseorang yang berpura -pura menjadi polisi - The Secret Life of
GetWindowText
- Mengapa aturan untuk
GetWindowText
sangat aneh? - Lukisan hanya saat jendela Anda terlihat di layar
- Menentukan apakah jendela Anda tertutup
- Memperoleh ukuran dan posisi jendela saat diminimalkan
- Mengapa memanggil
SetForegroundWindow
segera diikuti oleh GetForegroundWindow
tidak mengembalikan jendela yang sama? - Bagaimana Windows memutuskan apakah jendela yang baru dibuat harus menggunakan tata letak LTR atau RTL?
Hirarki Windows
- Apa yang istimewa dari jendela desktop?
- Berapa batas sarang jendela?
- Apa perbedaan antara
HWND_TOP
dan HWND_TOPMOST
? - Jendela dapat memiliki orang tua atau pemilik tetapi tidak keduanya
- Mengapa kontrol saya mengirimkan pemberitahuannya ke jendela yang salah setelah saya mewakili itu?
-
WindowFromPoint
, ChildWindowFromPoint
, RealChildWindowFromPoint
, kapan semuanya akan berakhir? -
GetParent
, sama membingungkannya dengan EnumClaw
, tetapi ini adalah fungsi yang sebenarnya! ( GetAncestor()
, GetWindow()
) - Memiliki jendela pemilik dari proses lain itu rumit, tapi terkadang hal yang benar untuk dilakukan
- Apa dokumentasi untuk
SetParent
yang mencoba memberi tahu saya tentang menyinkronkan keadaan UI? - Mendemonstrasikan apa yang terjadi ketika jendela orang tua dan anak memiliki keadaan UI yang berbeda
- Mendapatkan Jendela Orang Tua dan Anak untuk memiliki negara bagian UI yang sama
Gaya jendela
- Bit gaya jendela mana yang menjadi milik siapa?
- Bagaimana cara saya menunjukkan bahwa saya ingin jendela saya mengikuti aturan tata letak kanan-ke-kiri?
- Mengapa kontrol statis transparan saya transparan? (
WS_EX_TRANSPARENT
) - Seperti kue,
WS_EX_TRANSPARENT
adalah kebohongan, atau setidaknya bukan seluruh kebenaran - Saya menggunakan
WS_EX_COMPOSITED
untuk menyingkirkan flicker saya yang menggambar ulang, tetapi itu menghasilkan respons yang lamban - Bagaimana saya bisa menggunakan
WS_CLIPCHILDREN
dan masih dapat menarik kontrol dengan latar belakang transparan?
Kelas jendela
- Untuk apa
HINSTANCE
yang diteruskan ke CreateWindow
dan RegisterClass
yang digunakan? - Menggunakan
HINSTANCE
yang Salah di RegisterClass
seperti pencurian identitas - Jika fungsi
RegisterClass
mengambil kepemilikan sikat latar belakang khusus, mengapa bocor? - Mengubah kelas jendela mempengaruhi semua jendela yang termasuk dalam kelas itu
- Apa yang dilakukan
CS_SAVEBITS
? - Apa yang dilakukan gaya kelas
CS_OWNDC
? - Apa yang dilakukan gaya kelas
CS_CLASSDC
? - Memodifikasi gaya
CS_NOCLOSE
memang mempengaruhi semua jendela kelas, hanya tidak harus dengan cara yang segera terlihat - Mengapa
PrintWindow
membenci CS_PARENTDC
? Karena semua orang membenci CS_PARENTDC
! - Mengapa
PrintWindow
membenci CS_PARENTDC
? redux - Subklassing yang lebih aman
- Kelas pribadi, superclassing, dan subklassing global
- Apa yang membuat
RealGetWindowClass
jauh lebih nyata daripada GetClassName
? - Mengapa
CreateWindowEx
mengambil parameter gaya yang diperluas sebagai parameter pertamanya alih -alih yang terakhir? - Kapan saya harus menggunakan
CS_GLOBALCLASS
? - Seberapa unik parameter UIDSubClass saat saya menelepon
SetWindowSubclass
?
Jendela tingkat atas
Bingkai jendela dan keterangan
- Mendapatkan menu klik kanan khusus untuk ikon Caption
- Menggambar keterangan yang tampak aktif bahkan saat tidak aktif
- Bagaimana cara menekan drag/mengubah ukuran jendela penuh hanya untuk satu jendela?
- Bagaimana cara mengganti jendela antara layar normal dan penuh?
- Bagaimana cara mengaktifkan dan menonaktifkan tombol meminimalkan, memaksimalkan, dan menutup di bilah keterangan saya?
- Mendapatkan lokasi tombol tutup di bilah judul
- Mendapatkan lokasi tombol tutup di bilah judul, dari Windows 2000 atau Windows XP
- Mengapa dimensi jendela yang dimaksimalkan lebih besar dari monitor?
- Membuat jendela yang dapat diubah ukurannya hanya dalam satu arah
- Mengapa Anda tidak meneruskan
WM_GETMINMAXINFO
dan menjepit hasilnya?
Dwm
- Mengapa program saya tidak menerima pesan
WM_DWMSENDICONICTHUMBNAIL
ketika saya meminta representasi ikonik? - Parameter
MARGINS
ke fungsi DwmExtendFrameIntoClientArea
mengontrol seberapa jauh bingkai meluas ke area klien - Bagaimana cara saya menekan animasi default yang terjadi ketika saya menyembunyikan atau menampilkan jendela?
- Tampilkan thumbnail khusus untuk aplikasi Anda (dan saat Anda melakukannya, pratinjau langsung khusus)
- Bagaimana cara mendeteksi bahwa jendela saya telah ditekan dari layar oleh shell? ("Cloaking Window")
Dialog
- Mengapa saya tidak dapat membuat kotak dialog saya? Kesalahan pemula #1
- Mengapa saya tidak dapat membuat kotak dialog saya? Kesalahan pemula #2
- Mengembalikan nilai dari prosedur dialog
- Jenis prosedur dialog yang berbeda
- Jenis lain yang berbeda dari prosedur dialog
- Jawaban default untuk setiap kotak dialog adalah "Batal"
- Memutar Z-order
- Menggunakan tombol
TAB
untuk menavigasi dalam non-dialog - Menggunakan tombol
TAB
untuk menavigasi non-dialog, redux - Mencegah edit teks kontrol agar tidak dipilih secara otomatis dalam kotak dialog
- Mereka yang tidak memahami manajer dialog ditakdirkan untuk menerapkannya kembali
- Trik lain dengan
WM_GETDLGCODE
-
GetDialogBaseUnits
adalah tempat tidur - Mengapa persegi panjang dialog pemetaan
MapDialogRect
? - Mengapa kotak dialog awalnya dibuat tersembunyi?
- Apa masalahnya dengan bendera
DS_SHELLFONT
? - Mengapa
DS_SHELLFONT = DS_FIXEDSYS | DS_SETFONT
? - Cara mengatur fokus di kotak dialog
- Jangan pernah meninggalkan fokus pada kontrol yang dinonaktifkan
- Sebuah kehalusan dalam memulihkan posisi jendela sebelumnya
- Hal -hal yang sudah Anda ketahui: Bagaimana cara menunggu sampai kotak dialog saya ditampilkan sebelum melakukan sesuatu?
- Apa yang
TranslateAccelerator
lakukan? - Jika saya memiliki kotak dialog tanpa mod dengan akselerator khusus, yang harus saya hubungi terlebih dahulu:
IsDialogMessage
atau TranslateAccelerator
- Pengingat Lembut: Pada kotak dialog, jangan berikan OK dan batalkan akselerator
- Mengapa akselerator untuk kontrol tersembunyi masih aktif?
- Bagaimana cara membuat akselerator saya berlaku hanya saat digunakan di jendela utama dan tidak saat pengguna menggunakan dialog tanpa modern?
- Mengapa Tab
TAB
tidak berfungsi pada kontrol yang telah saya tandai sebagai WS_TABSTOP
? - Anda tidak dapat menggunakan pesan
WM_USER
di kotak dialog - Bagaimana cara membuat kotak dialog kanan-ke-kiri saat runtime?
- Bagaimana manajer dialog menghitung lebar rata -rata karakter?
Dialog bersarang dan tertanam
- Untuk apa gaya
DS_CONTROL
? - Lebih banyak catatan tentang penggunaan gaya
DS_CONTROL
- Bukan ide yang baik untuk memberikan beberapa kontrol pada kotak dialog ID yang sama
- Saat menyematkan dialog di dalam yang lain, pastikan Anda tidak secara tidak sengaja membuat ID kontrol duplikat
- Saat pushbutton default dipanggil, Invoke masuk ke dialog tingkat atas
Dialog umum
- Mengapa
MessageBox
saya tidak membungkus di lokasi yang tepat? - Bagaimana cara menyesuaikan bagian tautan favorit dari dialog terbuka file?
- Mengapa Dialog File Umum Mengubah Direktori Saat Ini?
- Anda dapat memfilter dialog file umum dengan wildcard
- Bagaimana cara menampilkan dialog Find Printers secara terprogram?
- Mengapa Daftar File Terbuka Tidak di Snap-In Folder Bersama Menampilkan Semua File Terbuka Saya?
- Kontrol umum untuk mengaitkan ekstensi yang sudah terlambat
- Memfilter folder yang muncul di dialog browse untuk folder
- Membuka Dialog Browser Folder Klasik dengan folder tertentu yang dipilih sebelumnya
- Mengapa Dialog Simpan File Umum Membuat File Sementara dan kemudian menghapusnya?
- Menyesuaikan Dialog PICK Color
- Bagaimana cara mengatur direktori awal dialog terbuka file ke direktori virtual?
- Ketika saya memilih beberapa file dalam dialog terbuka file, mengapa item terakhir didahulukan?
- Saya mengatur opsi
OFN_NONETWORKBUTTON
dalam struktur OPENFILENAME
, tetapi tidak berpengaruh pada item jaringan di panel navigasi - Bagaimana cara menambahkan kontrol khusus ke dialog file terbuka atau file simpan?
- Bagaimana cara membuat
FileSavePicker
yang saya buka di folder yang sama yang dipilih oleh FileOpenPicker
atau FolderPicker
? (Win32/com setara yang disebutkan di akhir posting)
Kontrol navigasi
- Menggunakan tombol
TAB
untuk menavigasi dalam non-dialog - Menggunakan tombol
TAB
untuk menavigasi non-dialog, redux - Mengelola keadaan akselerator UI dan fokus persegi panjang
- Navigasi khusus dalam kotak dialog, redux
- Kotak dialog mengembalikan fokus ke kontrol yang memiliki fokus ketika Anda terakhir beralih; Bagaimana cara ikut serta dalam tindakan itu untuk jendela saya sendiri?
- Bagaimana cara membuat pesanan tab non-sirkular, atau beberapa jenis pemesanan khusus lainnya dalam dialog Win32 saya?
Manajer Dialog
- Manajer Dialog, Bagian 1: Pemanasan
- Manajer Dialog, Bagian 2: Membuat Jendela Bingkai
- Manajer Dialog, Bagian 3: Membuat Kontrol
- Manajer Dialog, Bagian 4: Loop Dialog
- Manajer Dialog, Bagian 5: Mengonversi kotak dialog non-modal menjadi modal
- Manajer Dialog, Bagian 6: Kehalusan di Loop Pesan
- Manajer Dialog, Bagian 7: Lebih Banyak Kehalusan di Loop Pesan
- Manajer Dialog, Bagian 8: Navigasi Kustom di Kotak Dialog
- Manajer Dialog, Bagian 9: Akselerator Kustom dalam Kotak Dialog
Pengandaian
- Pesanan yang benar untuk menonaktifkan dan mengaktifkan Windows
- Modalitas, Bagian 1: UI-Modalitas vs Kode-Modalitas
- Modalitas, Bagian 2: Kode-Modalitas vs UI-Modalitas
- Modalitas, Bagian 3: Pesan
WM_QUIT
- Modalitas, Bagian 4: Pentingnya Mengatur Pemilik yang Benar untuk Modal UI
- Modalitas, Bagian 5: Mengatur pemilik yang benar untuk UI modal
- Modalitas, Bagian 6: Berinteraksi dengan program yang telah menjadi modal
- Modalitas, bagian 7:
MessageBox
waktunya, versi murah - Modalitas, bagian 8:
MessageBox
waktu, versi yang lebih baik - Modalitas, Bagian 9: Mengatur pemilik yang benar untuk UI modal, ujian praktis
- Pesan utas dimakan oleh loop modal
- Menyelamatkan pesan utas dari loop modal melalui filter pesan
Lembar properti
- Apa efek lain yang dimiliki
DS_SHELLFONT
pada halaman lembar properti? -
PSM_ISDIALOGMESSAGE
adalah untuk lembar properti tanpa modis seperti IsDialogMessage
untuk kotak dialog tanpa modis - Anda dapat memperpanjang struktur
PROPSHEETPAGE
dengan data bonus Anda sendiri - Pemberitahuan
PSN_SETACTIVE
dikirim setiap kali halaman wizard Anda diaktifkan - Menambahkan muatan tambahan ke struktur
PROPSHEETPAGE
- Bagaimana cara melewati serangkaian struktur
PROPSHEETPAGE
berukuran variabel ke lembar properti?
Kontrol
- Hanya karena Anda adalah kontrol bukan berarti Anda harus berada di dalam kotak dialog
Kontrol Animasi
- Keterbatasan Kontrol Animasi Shell
- Mengapa kontrol animasi versi 6 tidak menggunakan utas latar belakang?
Tombol
- Untuk apa gaya tombol
BS_PUSHLIKE
? (Jangan gunakan, ini benar -benar usang saat ini. Gunakan kotak centang atau tombol radio sebagai gantinya.)
Kotak kombo
- Mempercepat Menambahkan Item ke ComboBox atau ListBox (
WM_SETREDRAW
)
Edit kontrol
- Apa masalahnya dengan pesan
EM_SETHILITE
? - Mencegah edit teks kontrol agar tidak dipilih secara otomatis dalam kotak dialog
- Bagaimana cara menekan peringatan
CapsLock
pada kontrol edit kata sandi? - Sejarah awal gaya kontrol
ES_NUMBER
Edit - Bagaimana cara mengizinkan angka negatif dengan gaya kontrol
ES_NUMBER
Edit? - Bagaimana cara saya mengizinkan tanda minus untuk dimasukkan ke dalam kontrol edit saya, tetapi hanya jika itu adalah karakter pertama?
Daftar tampilan
- Tampilan ListView yang diposisikan vs.
- Menampilkan Infotips untuk Item ListView yang dilipat dan tidak dilipat
- Komputasi ListView InfoTIPS di latar belakang
- Apa perbedaan antara
LVM_HITTEST
dan LVM_INSERTMARKHITTEST
? - Mengapa ada pemberitahuan
LVN_ODSTATECHANGED
ketika sudah ada pemberitahuan LVN_ITEMCHANGED
yang sangat bagus? - Membuat ListView dengan kotak centang pada beberapa item tetapi tidak yang lain
- Bagaimana cara saya mengubah ukuran kolom ListView secara terprogram agar sesuai dengan isinya?
- Bagaimana cara membuat kotak centang yang dinonaktifkan untuk item ListView?
- Mempercepat Menambahkan Item ke ComboBox atau ListBox (
WM_SETREDRAW
)
Kontrol Teks Kaya
Sejarah Kontrol Richedit dari Murray Sargent (Posting hanya tautan (rusak) ke https://blogs.msdn.microsoft.com/murrays/2006/10/19/some-richedit-history/)- Bagaimana cara memuat seluruh file ke kontrol teks yang kaya?
- Bagaimana cara menempatkan lebih dari 32.000 karakter ke kontrol teks yang kaya?
- Bagaimana cara mencetak isi kontrol teks yang kaya?
Gulir
- Program awal
- Scrollbars, Bagian 2
- Scrollbars, Bagian 3: Mengoptimalkan Siklus Cat
- Scrollbars, Bagian 4: Menambahkan Gulir Proporsional
- Kemungkinan bagian 5: aksesibilitas keyboard untuk scrollbars
- Tambahan ke Bagian 5: Kehalusan dalam kode keyboard
- Scrollbars Bagian 6 - Roda
- Scrollbars Bagian 7 - Integralitas
- SCROLLBARS PART 8 - UKURAN INTERAKTIF INTEGRAL
- SCROLLBARS Bagian 9 - Mempertahankan Metafora
- SCROLLBARS Bagian 10 - Menuju Pemahaman yang Lebih Dalam tentang Pesan
WM_NCCALCSIZE
- SCROLLBARS BAGIAN 11: Menuju pemahaman yang lebih dalam tentang pesan
WM_NCCALCSIZE
- Jawaban untuk berolahraga dari scrollbars Bagian 11
- SCROLLBARS Bagian 12: Menerapkan
WM_NCCALCSIZE
ke sampel scrollbar kami - Redux Scrollbars: Bagian 12
- Ada dua jenis scrollbars
- Mengapa
WHEEL_DELTA
dipilih menjadi 120 bukan nilai yang jauh lebih nyaman seperti 100 atau bahkan 10? - Mengapa mengatur rentang batang gulir horizontal untuk pertama kalinya juga mengatur rentang vertikal, dan sebaliknya?
- Autoscrolling on Drag, Bagian 1: Implementasi Dasar
- Autoscrolling on Drag, Bagian 2: Mengapa menggulir lebih cepat jika saya menggoyangkan mouse?
- Autoscrolling on Drag, Bagian 3: Autoscroll Dinamis Berdasarkan Posisi Mouse
- Autoscrolling on Drag, Bagian 4: Autoscroll Dinamis Berdasarkan Kecepatan Escape
- Autoscrolling on Drag, Bagian 5: Menambahkan goyangan-ke-gulir untuk menghindari kecepatan
Kontrol statis
- Kapan kontrol statis akan secara otomatis menghapus gambar yang dimuat ke dalamnya, dan kapan itu tanggung jawab aplikasi?
Kontrol tab
- Bagaimana cara membuat kontrol di kotak dialog saya yang memiliki kontrol tab?
- Bagaimana saya bisa membuat anak -anak dari kontrol tab Win32?
Toolbars
- Mengapa ada baik
TBSTYLE_EX_VERTICAL
dan CCS_VERT
? - Bagaimana cara membuat bilah alat yang berada di bilah tugas?
- Bagaimana cara membuat tombol bilah alat yang selaras dengan benar?
- Membuat Tugas Kustom di Daftar Lompat
Tooltips
- Coding In-Place Tooltips
- Menggunakan Custom-Draw di Tooltips untuk Menyesuaikan Font
- Multiplexing beberapa alat menjadi satu di tooltip
- Menghasilkan teks tooltip secara dinamis
- Mengapa saya tidak dapat menampilkan tooltip untuk jendela yang dinonaktifkan?
-
TTM_RELAYEVENT
OVER-DOCUMENING DAN MENGAPA menghasilkan timer periodik satu detik yang berjalan selama tooltip terlihat
Trackbars
- Menambahkan akselerator panah
Ctrl
+untuk memindahkan trackbar hanya dengan satu unit, Bagian 1: Plunge Awal - Menambahkan akselerator panah
Ctrl
+untuk memindahkan trackbar hanya dengan satu unit, bagian 2: percobaan kedua - Bagaimana cara mencegah pengguna menggunakan mouse untuk menyeret jempol trackbar ke posisi yang bukan kelipatan lima? Bagian 1: Bingkai ulang masalahnya
- Bagaimana cara mencegah pengguna menggunakan mouse untuk menyeret jempol trackbar ke posisi yang bukan kelipatan lima? Bagian 2: Menggenggam posisi ibu jari
Pemandangan daftar pohon
- Gaya
TVS_CHECKBOXES
unik, yang merupakan cara sopan untuk mengatakan bahwa itu gila - Waspadalah terhadap daftar gambar yang bocor saat menggunakan gaya
TVS_CHECKBOXES
- Membuat Kotak Centang Tampilan Pohon Secara Manual: Daftar Gambar Negara Sederhana
- Membuat Kotak Centang Tampilan Pohon Secara Manual: Menanggapi Klik
- Membuat kotak centang tampilan pohon secara manual: kotak centang bertema
- Kotak centang Tree View: A Sordid History
- Kotak centang tampilan pohon: Kotak centang yang diperluas menyatakan
Pemrosesan pesan
- Nomor pesan mana yang menjadi milik siapa?
- Berbagai cara mengirim pesan
- Penyiaran pesan yang ditentukan pengguna
- Kapan utas dapat menerima pesan jendela?
- Apa perbedaan antara
GetKeyState
dan GetAsyncKeyState
? - Pesan utas dimakan oleh loop modal
- Menyelamatkan pesan utas dari loop modal melalui filter pesan
- Bahaya memfilter pesan jendela
- Anda tidak dapat mensimulasikan input keyboard dengan
PostMessage
- Memompa pesan sambil menunggu periode waktu
- Dalam mengejar antrian pesan
- Tidak, sungguh, Anda harus menyampaikan semua pesan yang tidak ditangani ke
DefWindowProc
- Bahkan jika Anda memiliki kode untuk menangani pesan, Anda diizinkan menelepon
DefWindowProc
, karena Anda tetap melakukannya - Untuk apa
Get/SetMessageExtraInfo
yang pernah digunakan? - Mengapa
GetWindowLongPtr
Mengembalikan nilai sampah pada jendela 64-bit? -
TrackMouseEvent
melacak acara mouse di jendela Anda, tetapi hanya jika peristiwa itu milik jendela Anda - Jangan lupa untuk memasukkan antrian pesan dalam hierarki kunci Anda
- Apa yang terjadi dengan pesan yang dikirim ketika
SendMessageTimeout
mencapai batas waktu? - Mengapa saya tidak bisa
PostMessage
pesan WM_COPYDATA
, tetapi saya dapat SendMessageTimeout
dengan waktu tunggu yang kecil? - Meskipun mouse-move, pesan cat, dan timer dihasilkan sesuai permintaan, masih mungkin bagi seseorang untuk berakhir di antrian Anda
- Pesan yang diposting diproses sebelum pesan input, bahkan jika mereka diposting nanti
- Jenis pesan apa yang dapat diterima jendela khusus pesan?
- Jika prototipe dari
DispatchMessageA
dan DispatchMessageW
identik, mengapa keduanya? - Mereka yang tidak memahami manajer dialog ditakdirkan untuk menerapkannya kembali
- Bagaimana cara memicu penghitungan ulang dari kursor mouse setelah saya mengubah beberapa status aplikasi internal saya?
- Bagaimana cara memicu penghitungan ulang dari kursor mouse setelah saya mengubah beberapa status aplikasi internal saya?, Tindak lanjut
-
GetQueueStatus
dan status antrian
Hooking
- What is the
HINSTANCE
passed to SetWindowsHookEx
used for? - How can I get notified when the cursor changes?
- What does the thread parameter to
SetWindowsHookEx
actually mean? - Why does
SetFocus
fail without telling me why?
Specific Messages
Pemberitahuan
- What's the difference between the
wParam
of the WM_NOTIFY
message and the idFrom
in the NMHDR
structure. - Restating the obvious about the
WM_COMMAND
message - Restating the obvious about the
WM_NOTIFY
message
Window Construction and Destruction
- What is the difference between
WM_DESTROY
and WM_NCDESTROY
? - How can I determine the reason why my window is closing? (
WM_CLOSE
)
Window Geometry Messages
- Use
WM_WINDOWPOSCHANGED
to react to window state changes - Use
WM_WINDOWPOSCHANGING
to intercept window state changes
Window Painting Messages
- Paint messages will come in as fast as you let them (
WM_PAINT
) - What happens if I don't paint when I get a
WM_PAINT
message? - What is the implementation of
WM_PRINTCLIENT
? - There's a default implementation for
WM_SETREDRAW
, but you might be able to do better - Speeding up adding items to a combobox or listbox (
WM_SETREDRAW
) - Using
WM_SETREDRAW
to speed up adding a lot of elements to a control
Window Focus Messages
-
WM_KILLFOCUS
is the wrong time to do field validation - The dangers of playing focus games when handling a
WM_KILLFOCUS
message - Why doesn't the
MoveWindow
function generate the WM_GETMINMAXINFO
message?
Keyboard Messages
- How do I respond to the
WM_MENUCHAR
message?
Mouse Messages
- Why is there no
WM_MOUSEENTER
message? - Why do I get spurious
WM_MOUSEMOVE
messages? - Sure, I can get spurious
WM_MOUSEMOVE
messages, but why do they keep streaming in? - How do I get mouse messages faster than
WM_MOUSEMOVE
? - Logical consequences of the way Windows converts single-clicks into double-clicks
- Implementing higher-order clicks
- How slow do you have to slow-double-click for it to be a rename?
- How can I prevent the mouse from moving in response to touch input?
Dialog Messages
- Those who do not understand the dialog manager are doomed to reimplement it, badly
- Managing the UI state of accelerators and focus rectangles (
WM_CHANGEUISTATE
, WM_QUERYUISTATE
and WM_UPDATEUISTATE
) - Untangling the confusingly-named
WM_UPDATEUISTATE
and WM_CHANGEUISTATE
messages - Who sends the initial
WM_UPDATEUISTATE
message? - How can I prevent the keyboard focus rectangle from appearing on a control I created?
- Other tricks with
WM_GETDLGCODE
- How do I prevent multi-line edit controls from eating the Enter key?
- Why do
DLGC_WANTALLKEYS
and DLGC_WANTMESSAGE
have the same value?
Other Window Messages
- The dangers of messing with activation when handling a
WM_ACTIVATE
message - Why does my window get a
WM_ACTIVATE
message when it isn't active? - A timed context menu (
WM_CANCELMODE
) - Pitfalls in handling the
WM_CONTEXTMENU
message ( WM_CONTEXTMENU
) -
WM_NCHITTEST
is for hit-testing, and hit-testing can happen for reasons other than the mouse being over your window - How likely is it that a window will receive a
WM_NULL
message out of the blue? ( WM_NULL
) - Why is there a special
PostQuitMessage
function? ( WM_QUIT
) - How does
PostQuitMessage
know which thread to post the quit message to? ( WM_QUIT
) - Who is responsible for destroying the font passed in the
WM_SETFONT
message? ( WM_SETFONT
) - When I send a
WM_GETFONT
message to a window, why don't I get a font? ( WM_GETFONT
) - If my
WM_TIMER
handler takes longer than the timer period, will my queue fill up with WM_TIMER
messages? - Killing a window timer prevents the
WM_TIMER
message from being generated for that timer, but it doesn't retroactively remove ones that were already generated
System Messages
- If one program blocks shutdown, then all programs block shutdown (
WM_QUERYENDSESSION
, WM_ENDSESSION
) - Why do I have to return this goofy value for
WM_DEVICECHANGE
? ( WM_DEVICECHANGE
) - Windows doesn't close windows when a user logs off; that's your call (
WM_ENDSESSION
) - Once you return from the
WM_ENDSESSION
message, your process can be terminated at any time ( WM_ENDSESSION
)
GDI
- Why are
RECT
s endpoint-exclusive? - Can you create an information context for the display?
- What does the
CS_OWNDC
class style do? - What does the
CS_CLASSDC
class style do? - How do you detect "Large Fonts"? (DPI)
- Drawing a monochrome bitmap with transparency
- Let GDI do your RLE compression for you
- The mysterious stock bitmap: There's no way to summon it, but it shows up in various places
- Why is my icon being drawn at the wrong size when I call
DrawIcon
? - You must flush GDI operations when switching between direct access and GDI access, and direct access includes other parts of GDI
- How do I get the dimensions of a cursor or icon?
- What are the dire consequences of not selecting objects out of my DC?
- Of what use is the
RDW_INTERNALPAINT
flag? - Functions that return GDI regions rarely actually return regions
- Color-aware ClearType requires access to fixed background pixels, which is a problem if you don't know what the background pixels are, or if they aren't fixed
- What is the correct way of using
SaveDC
and RestoreDC
? - How are
BitBlt
raster opcodes calculated? - Notes on
DrawText
and tab stops - Why doesn't
GetTextExtentPoint
return the correct extent for strings containing tabs? - Why are there trivial functions like
CopyRect
and EqualRect
? - More on trivial functions like
CopyRect
and EqualRect
- What are the consequences of increasing the per-process GDI handle limit?
- The focus rectangle says, “I'm not orange. I'm just drawn that way.”
Cursors
- The effect of
SetCursor
lasts only until the next SetCursor
- What can or should I do with the cursor handle returned by
SetCursor
? - What is the deal with the
SM_CXCURSOR
system metric? - How do I find out the size of the mouse cursor?
Brushes
- The hollow brush
- Other uses for bitmap brushes
- What is the DC brush good for?
- I know I can change the color of the DC pen, but what about the other attributes?
- How can I extract the color from a solid color GDI brush?
Pens
- Is there a difference between creating a null pen with
CreatePen
and just using the stock null pen?
Bitmaps
- How do I set the alpha channel of a GDI bitmap to 255?
DIB
- A survey of the various ways of creating GDI bitmaps with predefined data
- Blitting between color and monochrome DCs
- Manipulating the DIB color table for fun and profit
- Using DIB sections to perform bulk color mapping
- The fun and profit of manipulating the DIB color table can be done without having to modify it
- Separating the metadata from the DIB pixels: Precalculating the
BITMAPINFO
- Separating the metadata from the DIB pixels: Changing the raster operation
- The disembodiment of DIBs from the DIB section
- What is the
hSection
parameter to CreateDIBSection
for?
LockWindowUpdate()
- What does
LockWindowUpdate
do? - How is
LockWindowUpdate
meant to be used? - With what operations is
LockWindowUpdate
meant to be used? - With what operations is
LockWindowUpdate
not meant to be used? - Final remarks on
LockWindowUpdate
Painting Standard Elements
- Rendering standard Windows elements
- Rendering menu glyphs is slightly trickier
- What states are possible in a
DRAWITEMSTRUCT
structure?
UXTHEME.DLL
-
BeginBufferedPaint
: It's not just for buffered painting any more - How do
IsThemeActive
, IsAppThemed
, and IsCompositionActive
differ? - How do I get the tabbed dialog effect on my own custom tabbed dialog?
- How do I revert a control back to its default theme?
Multiple Monitors
- For better performance, set all your monitors to the same color format
- How do I get a handle to the primary monitor?
- Why does the primary monitor have
(0,0)
as its upper left coordinate? - How do I get the color depth of the screen?
- How does the window manager adjust
ptMaxSize
and ptMaxPosition
for multiple monitors?
Accessibility
- Accessibility is not just for people with disabilities
- How to retrieve text under the cursor (mouse pointer)
- How do I set an accessible name on an unlabeled control?
- How can I get notified when some other window is destroyed?
- Using accessibility to monitor windows as they come and go
- How can I write a program that monitors another window for a title change?
- How can I write a program that monitors another window for a change in size or position?
COM
Declaring COM Interfaces
- The macros for declaring COM interfaces, revisited: C version
- The macros for declaring COM interfaces, revisited: C++ version
- The macros for declaring COM interfaces, revisited: C++ implementation
- The oracle always tells the truth, even when it is wrong: COM method calls with a user-defined type as a return value (on problems of COM interfaces called from C code)
- The COM interface contract rules exist for a reason
- Giving a single object multiple COM identities, part 1
- Giving a single object multiple COM identities, part 2
- Giving a single object multiple COM identities, part 3
- Giving a single object multiple COM identities, part 4
- How do I consume raw COM interfaces from a Windows Runtime metadata file?
COM Apartments
- The dreaded "main" threading model
- A slightly less brief introduction to COM apartments (but it's still brief)
- Yo dawg, I hear you like COM apartments, so I put a COM apartment in your COM apartment so you can COM apartment while you COM apartment
- What kind of apartment is the private apartment I created via
CLSID_ContextSwitcher
? - Setting up private COM contexts to allow yourself to unload cleanly
- How do you get into a context via
IContextCallback::ContextCallback
? - Using contexts to return to a COM apartment later
- What do the output values from
CoGetApartmentType
mean? - User interface code + multi-threaded apartment = death
- Other problems traced to violating COM single-threaded apartment rules in the shell
- What's the point of
APTTYPE_CURRENT
? I mean, of course I'm current. - How do I get a foothold in the neutral apartment?
- What is so special about the Application STA?
- What does it mean when a call fails with
0x8000001F = RO_E_BLOCKED_CROSS_ASTA_CALL
?
COM Initialization
- What does the
COINIT_SPEED_OVER_MEMORY
flag to CoInitializeEx
do? - Crashing in COM after I call
CoUninitialize
, how can COM be running after it is uninitalized?
COM Static Store
- The COM static store, part 1: Introduction
- The COM static store, part 2: Race conditions in setting a singleton
- The COM static store, part 3: Avoiding creation of an expensive temporary when setting a singleton
- The COM static store, part 4: Aggregating into a single object
- The COM static store, part 5: Using COM weak references
- The COM static store, part 6: Using C++ weak references
COM Marshaling
- What is COM marshaling and how do I use it?
- On proper handling of buffers in COM and RPC methods
- What are the rules for
CoMarshalInterThreadInterfaceInStream
and CoGetInterfaceAndReleaseStream
? - What are the rules for
CoMarshalInterface
and CoUnmarshalInterface
? -
CoGetInterfaceAndReleaseStream
does not mix with smart pointers - The COM marshaller uses the COM task allocator to allocate and free memory
- Why do I get a
QueryInterface(IID_IMarshal)
and then nothing? - We batched up our COM requests and return a single stream of results, but the performance is still slow
- What are the various usage patterns for manually-marshaled interfaces?
- An initial look at the mechanics of how COM marshaling is performed
- https://devblogs.microsoft.com/oldnewthing/20220616-00/?p=106757
- Writing a marshal-by-value marshaler, part 1
- Writing a marshal-by-value marshaler, part 2
- Writing a compound marshaler
- Understanding the marshaling flags: The free-threaded marshaler
COM Error Handling
- What happens to my COM server-side object when clients die unexpectedly?
- Why does COM require output pointers to be initialized even on failure?
- How do I convert an
HRESULT
to a Win32 error code? - How can I tell the WIL
RETURN_IF_FAILED
macro that some errors are ignorable? - Do not overload the
E_NOINTERFACE
error - What does it mean when a call fails with
0x8000001F = RO_E_BLOCKED_CROSS_ASTA_CALL
? - What does it mean when my cross-thread COM call fails with
RPC_E_SYS_CALL_FAILED
? - Understanding a mysterious
RPC_E_WRONGTHREAD
exception when we're on the right thread
COM Asynchronous Interfaces
- COM asynchronous interfaces, part 1: The basic pattern
- COM asynchronous interfaces, part 2: Abandoning the operation
- COM asynchronous interfaces, part 3: Abandoning the operation after a timeout
- COM asynchronous interfaces, part 4: Doing work while waiting for the asynchronous operation
- COM asynchronous interfaces, part 5: The unreliable server
- COM asynchronous interfaces, part 6: Learning about completion without polling
- COM asynchronous interfaces, part 7: Being called directly when the operation completes
- COM asynchronous interfaces, part 8: Asynchronous release, the problems
- COM asynchronous interfaces, part 9: Asynchronous release, assembling a solution
GUIDs
- What's the difference between
UuidFromString
, IIDFromString
, CLSIDFromString
, GUIDFromString
... - What is the difference between
UuidToString
, StringFromCLSID
, StringFromIID
, and StringFromGUID2
? - Why are there four functions for parsing strings into GUIDs, and why are they in three different DLLs?
- Why does COM express GUIDs in a mix of big-endian and little-endian? Why can't it just pick a side and stick with it?
COM Strings
- Why is there a
BSTR
cache anyway? - Raymond's complete guide to
HSTRING
semantics - What is the correct way of using the string buffer returned by the
WindowsPreallocateStringBuffer
function?
COM Variants
- What's the difference between
VARIANT
and VARIANTARG
? - Nasty gotcha:
VarCmp
vs VariantCompare
- Why can't
VarDateFromStr
parse back a Hungarian date that was generated by VarBstrFromDate
?
IUnknown
- The layout of a COM object
- Under what conditions will the
IUnknown::AddRef
method return 0? - The ways people mess up
IUnknown::QueryInterface
- The ways people mess up
IUnknown::QueryInterface
, episode 2 - The ways people mess up
IUnknown::QueryInterface
, episode 3 - The ways people mess up
IUnknown::QueryInterface
, episode 4 - COM object destructors are very sensitive functions
- Avoiding double-destruction when an object is released
- I'd like an
IUnknown
, I know you have many, I'll take any of them - A very brief introduction to patterns for implementing a COM object that hands out references to itself
- Giving a single object multiple COM identities, part 1
- Giving a single object multiple COM identities, part 2
- Giving a single object multiple COM identities, part 3
- Giving a single object multiple COM identities, part 4
- Reducing chattiness by querying for multiple interfaces at once, part 1
- Reducing chattiness by querying for multiple interfaces at once, part 2
IMoniker
- Pidls and monikers do roughly the same thing, just backwards
ICallback
- A very brief introduction to patterns for implementing a COM object that hands out references to itself
IContextMenu
- Why an object cannot be its own enumerator
- How to host an
IContextMenu
, part 1 - Initial foray - How to host an
IContextMenu
, part 2 - Displaying the context menu - How to host an
IContextMenu
, part 3 - Invocation location - How to host an
IContextMenu
, part 4 - Key context - How to host an
IContextMenu
, part 5 - Handling menu messages - How to host an
IContextMenu
, part 6 - Displaying menu help - How to host an
IContextMenu
, part 7 - Invoking the default verb - How to host an
IContextMenu
, part 8 - Optimizing for the default command - How to host an
IContextMenu
, part 9 - Adding custom commands - How to host an
IContextMenu
, part 10 - Composite extensions - groundwork - How to host an
IContextMenu
, part 11 - Composite extensions - composition - Simplifying context menu extensions with
IExecuteCommand
- How do I launch a file as if it were a text file, even though its extension is not
.txt
? - Do not access the disk in your
IContextMenu
handler, no really, don't do it - Sure, we do that: Context menu edition
- Psychic debugging: Why your
IContextMenu::InvokeCommand
doesn't get called even though you returned success from IContextMenu::QueryContextMenu
- Don't forget to implement canonical names for verbs in your shell context menu extension
IFileDialog
- The
SetClientGuid
method of the common file and folder dialogs lets you give names to those dialogs, too (multiple contexts for open/save dialogs) - How can I get my
FileSavePicker
to open in the same folder that was picked by the FileOpenPicker
or FolderPicker
? (win32/COM equivalent mentioned at the end of the post) - Why does IFileDialog still show non-filesystem folders when I pass
FOS_FORCEFILESYSTEM
?
IMultiLanguage
- Converting between
LCID
s and RFC 1766 language codes - Feel free to stop using
IMultiLanguage2::DetectInputCodepage
INamespaceWalk
- How can I control which parts of the shell namespace the
INamespaceWalk::Walk
operation will walk into? - How can I cancel the
INamespaceWalk::Walk
operation? - Cancelling the
INamespaceWalk::Walk
operation a little faster
IStream
- The subtleties of
CreateStreamOnHGlobal
, part 1: Introduction and basic usage - The subtleties of
CreateStreamOnHGlobal
, part 2: Suppressing the deletion of an unknown HGLOBAL
- The subtleties of
CreateStreamOnHGlobal
, part 3: Suppressing the deletion of a shared HGLOBAL
- The subtleties of
CreateStreamOnHGlobal
, part 4: Non-movable memory - A practical use for
GetHGlobalFromStream
when sharing was never your intention
IVirtualDesktopManager
- Virtual desktops are an end-user window management feature, not a programmatic one
Clipboard
- How ownership of the Windows clipboard is tracked in Win32
- What happens when applications try to copy text by sending
Ctrl+C
- How do I make it so that users can copy static text on a dialog box to the clipboard easily?
- What is the proper handling of
WM_RENDERFORMAT
and WM_RENDERALLFORMATS
? - Copying a file to the clipboard so you can paste it into Explorer or an email message or whatever
- Printing the contents of the clipboard as text to
stdout
- Improving the performance of
CF_HDROP
by providing file attribute information - What's up with the
CF_SYLK
and CF_DIF
clipboard formats? - How can I wait more than 30 seconds for a delay-rendered clipboard format to become rendered?
Drag and Drop
- What a drag: Dragging text
- What a drag: Dragging a Uniform Resource Locator (URL)
- What a drag: Dragging a Uniform Resource Locator (URL) and text
- What a drag: Dragging a virtual file (
HGLOBAL
edition) - What a drag: Dragging a virtual file (
IStream
edition) - What a drag: Dragging a virtual file (
IStorage
edition) - You can drag multiple virtual objects, you know
- Reading a contract from the other side: Simulating a drop
- Simulating a drop, part two
- What happens if I drag the mouse by exactly the amount specified by
SM_CXDRAG
? - How do I accept files to be opened via
IDropTarget
instead of on the command line? - How do I accept files to be opened via
IDropTarget
instead of on the command line? - bonus content - Using Explorer's fancy drag/drop effects in your own programs
- Drag/drop effects: The little drop information box
- Why isn't my shell namespace extension getting every single
DragOver
mouse message? - Why doesn't my program get fancy drag/drop effects in high contrast mode with
CLSID_DragDropHelper
?
Enumeration
- Using fibers to simplify enumerators, part 1: When life is easier for the enumerator
- Using fibers to simplify enumerators, part 2: When life is easier for the caller
- Using fibers to simplify enumerators, part 3: Having it both ways
- Using fibers to simplify enumerators, part 4: Filtering
- Using fibers to simplify enumerators, part 5: Composition
Kerang
- When does
SHLoadInProc
unload a DLL? - What does
SHGFI_USEFILEATTRIBUTES
mean? - What's the difference between
SHGetMalloc
, SHAlloc
, CoGetMalloc
, and CoTaskMemAlloc
- Querying information from an Explorer window
- Execute a file as if it were a program, even though its extension is not
EXE
- How do I launch a file as if it were a text file, even though its extension is not
.txt
? - What does the
SEE_MASK_UNICODE
flag in ShellExecuteEx
actually do? - Simple things you can do with the
ShellExecuteEx
function - What were
ShellExecute
hooks designed for? - Why does
ShellExecute
return SE_ERR_ACCESSDENIED
for nearly everything? - How do I
ShellExecute
a file, but with a specific program instead of the default program? - What is the difference between
CSIDL_DESKTOP
and CSIDL_DESKTOPDIRECTORY
? -
SHCIDS_CANONICALONLY
is the moral equivalent in the shell namespace of the Unicode ordinal comparison - Don't forget to double-null-terminate those strings you pass to
SHFileOperation
- Why does
SHFileOperation
have internal error codes for DVD? - Why do non-folders in my shell namespace extension show up in the folder tree view?
-
SHAutoComplete
giveth, and SHAutoComplete
taketh away - What is the
lpClass
member of SHELLEXECUTEINFO
used for? - Some known folders cannot be moved, but others can, and you'll just have to accept that
- One possible reason why
ShellExecute
returns SE_ERR_ACCESSDENIED
and ShellExecuteEx
returns ERROR_ACCESS_DENIED
- Why does
SHGetSpecialFolderPath
take such a long time before returning a network error? - How do you obtain the icon for a shortcut without the shortcut overlay? (
SHGetFileInfo()
) - How can I get information about the items in the Recycle Bin?
- Modernizing our simple program that retrieves information about the items in the Recycle Bin
- Invoking commands on items in the Recycle Bin
- How do I perform shell file operations while avoiding shell copy hooks?
- Command line tool to manage Windows 7 Libraries, with source code (
IShellLibrary
) -
IShellFolder::BindToObject
is a high-traffic method; don't do any heavy lifting - Obtaining the parsing name (and pidl) for a random shell object
- Creating a simple pidl: For the times you care enough to send the very fake
- Creating a simple shell item, just as fake as a simple pidl
- Displaying a property sheet for multiple files
- How do I get a high resolution icon for a file?
- How do I extract an icon at a nonstandard size if
IExtractIcon::Extract
tells me to go jump in a lake? - How do I read the "Double-click to open an item (single-click to select)" setting in Folder Options?
- The wonderful world of shell bind context strings
- Helper functions to make shell bind contexts slightly more manageable
- Customizing item enumeration with
IShellItem
- Customizing item enumeration with
IShellItem
, the old-fashioned way - How do I create an
IShellItemArray
from a bunch of file paths? - How do I invoke a verb on an
IShellItemArray
? - How does a shell namespace extension provide icons for virtual items that track the standard icons set by the user's file associations?
- How do I get the user-customed name of My Computer or Recycle Bin?
- How do I get the user-customized name of a mapped network drive?
- Enumerating all the programs that can open a particular file extension
- Enumerating all the programs that can launch a particular protocol
- How do I register a command on the desktop background context menu? (And how do I remove one I don't like?)
- How can I get the canonical name for a known folder?
- Peeking inside an
IShellItem
to see what it's made of - Why does
SHGetKnownFolderPath
return E_FAIL
for a known folder? - Why does
SHGetKnownFolderPath
fail when impersonating? - Why can't I use
SHSetKnownFolderPath
to change the location of FOLDERID_LocalAppData
? - How do I programmatically add a folder to my Documents library?
- Why doesn't
SHGetFileInfo
give me customized folder icons? - How can I detect that a shell item refers to a virtual folder, or to a file system inside a file?
- Why is there a limit of 15 shell icon overlays?
- The case of the
SHGetFolderPath(CSIDL_COMMON_DOCUMENTS)
that returned ERROR_PATH_NOT_FOUND
- Why is the
HSHELL_WINDOWDESTROYED
notification raised when a window is hidden, even if it hasn't been destroyed? - Why am I receiving
HCNE_UPDATEDIR
notifications that my code never generates? - Why am I receiving
SHCNE_UPDATEDIR
notifications that my code never generates? - How can I get the original target of a shortcut without applying any 32-bit adjustments?
- How does Explorer calculate the “Date” of a file?
Uncategorized COM Stuff
- The macros for declaring and implementing COM interfaces
- An introduction to COM connection points
- Dispatch interfaces as connection point interfaces
- Adjustor thunks
- What is the underlying object behind a COM interface pointer?
- How to turn off the exception handler that COM "helpfully" wraps around your server
- Shortcuts are serializable objects, which means that they can be stored in places other than just a file
- Why does
IFileOperation
skip junctions even though I passed FOFX_NOSKIPJUNCTIONS
? - Nasty gotcha:
STGM_READ | STGM_WRITE
does not grant read/write access - How can I get the list of programs the same way that Programs and Features gets it?
- How do I obtain the computer manufacturer's name via C++? (
IWbemClassObject
) - The stream pointer position in
IDataObject::GetData
and IDataObject::GetDataHere
is significant - The sad implementation history of COM component categories and why it means you have to click twice to see your newly-installed taskbar toolbar
- How do I request that my out-of-process COM server run unelevated?
- How can a desktop app use a Windows Runtime object that infers UI context from its thread? The
IInitializeWithWindow
pattern ( IInitializeWithWindow
) - How do I protect myself against a COM call that can hang? I'm already running the server out-of-process.
- What can I do about timer build-up when waiting for COM outbound calls to complete?
- Manipulating the positions of desktop icons
- A reminder about the correct way of accessing and manipulating the position of icons on the desktop
- The oracle always tells the truth, even when it is wrong: COM method calls with a user-defined type as a return value (on problems of COM interfaces called from C code)
- Notes on COM aggregation: Obtaining a pointer to your aggregated partner without introducing a reference cycle
- Notes on COM aggregation: How do you implement tear-offs in an aggregated object?
- The theory behind the
IHttpFilter
interface
Ingatan
- Stupid memory-mapping tricks
- Creating a shared memory block that can grow in size
- Why do I have to pass a valid page protection value to
VirtualAlloc
even if it ignores it? - How can I include/exclude specific memory blocks in user-mode crash dumps?
-
IsBadXxxPtr
should really be called CrashProgramRandomly ( IsBadWritePtr()
et al.) - A closer look at the stack guard page
- The case of the stack overflow exception when the stack is nowhere near overflowing
- How to allocate address space with a custom alignment or in a custom address region
Input and Output
- Mount points, volumes, and physical drives, oh my!
- What's the difference between an asynchronous
PIPE_WAIT
pipe and a PIPE_NOWAIT
pipe? - Be careful when redirecting both a process's
stdin
and stdout
to pipes, for you can easily deadlock - Looking at the problem at the wrong level: Closing a process's
stdin
-
ReadDirectoryChangesW
reads directory changes, but what if the directory doesn't change? - How do
FILE_FLAG_SEQUENTIAL_SCAN
and FILE_FLAG_RANDOM_ACCESS
affect how the operating system treats my file? - I used
FILE_FLAG_SEQUENTIAL_SCAN
but it didn't seem to speed up my sequential scanning - You can use an
OVERLAPPED
structure with synchronous I/O, too - We're currently using
FILE_FLAG_NO_BUFFERING
and FILE_FLAG_WRITE_THROUGH
, but we would like our WriteFile
to go even faster - On using
ILE_FLAG_WRITE_THROUGH
and FILE_FLAG_NO_BUFFERING
for memory-mapped files - On the interaction between the
FILE_FLAG_NO_BUFFERING
and FILE_FLAG_WRITE_THROUGH
flags - Why does my synchronous overlapped
ReadFile
return FALSE
when the end of the file is reached? - Why does
SetFileValidData
fail even though I enabled the SE_MANAGE_VOLUME_NAME
privilege? - Is
GENERIC_ALL
equivalent to GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE
? -
CancelIoEx
can cancel I/O on console input, which is kind of nice -
CancelIoEx
can cancel synchronous I/O, which is kind of nice - Why does
IsPathRelative
return FALSE
for paths that are drive-relative? - The security check happens at the acquisition of the handle
- Taking a shortcut: You can query properties from a volume, and it will forward to the physical drive
- https://devblogs.microsoft.com/oldnewthing/20201023-00/?p=104395
- How do I disassociate a thread from an I/O completion port?
- Is it okay to call
MapViewOfFile
on the same mapping handle simultaneously from different threads? - What are these dire multithreading consequences that the
GetFullPathName
documentation is trying to warn me about? - How can I force a
WriteFile
or ReadFile
to complete synchronously or hang, in order to test something? - How can I perform a
CopyFile
, but also flush the file buffers before the destination handle is closed?
Asynchronous Input and Output
- Developing the method for taking advantage of the fact that the
OVERLAPPED
associated with asynchronous I/O is passed by address - Ready... cancel... wait for it! (part 1)
- Ready... cancel... wait for it! (part 2)
- Ready... cancel... wait for it! (part 3)
- If you're waiting for I/O to complete, it helps if you actually have an I/O to begin with
- Why does my asynchronous I/O complete synchronously?
- If an asynchronous I/O completes synchronously, is the
hEvent
in the OVERLAPPED
structure signaled anyway? - You can use an
OVERLAPPED
structure with synchronous I/O, too - Why does my synchronous overlapped
ReadFile
return FALSE
when the end of the file is reached? - If I issue a second overlapped I/O operation without waiting for the first one to complete, are they still guaranteed to complete in order?
- Why are my file write operations synchronous, even though I opened the file as
FILE_FLAG_OVERLAPPED
? - File-extending writes are not always synchronous, which is entirely within the contract
- Why you might need additional control over the secret event hiding inside the file object
- Why doesn't my asynchronous read operation complete when I close the handle?
- The mental model for
StartThreadpoolIo
- How can I force a
WriteFile
or ReadFile
to complete synchronously or hang, in order to test something? - If I issue multiple overlapped I/O requests against the same region of a file, will they execute in the order I issued them?
- What are the potentially-erroneous results if you don't pass
NULL
as the lpNumberOfBytesRead
when issuing overlapped I/O?
Files and Directories
- The Definitive Guide on Win32 to NT Path Conversion
- How can I tell that a directory is really a recycle bin?
- How can I tell that a directory is weird and should be excluded from the user interface?
- How do I get information about the target of a symbolic link?
- How do I access a file without updating its last-access time?
- How do I show the contents of a directory while respecting the user's preferences for hidden and super-hidden files as well as the user's language preferences?
- You can use a file as a synchronization object, too
- How can I append to a file and know where it got written, even if the file is being updated by multiple processes?
- The
FILE_FLAG_DELETE_ON_CLOSE
flag applies to the handle, also known as the file object, which is not the same as the file - How long do I have to keep the
SECURITY_ATTRIBUTES
and SECURITY_DESCRIPTOR
structures valid after using them to create a file? - How do I create a directory where people can create subdirectories but cannot mess with those created by other users?
- How can I tell whether a file is on a removable drive, a fixed drive, or a remote drive?
- How can I tell whether a file is on an SSD?
- Why does a non-recursive
ReadDirectoryChangesW
still report files created inside subdirectories? - The early history of Windows file attributes, and why there is a gap between System and Directory
- Even if you open a file with GUID, you can still get its name, or at least one of its names (
GetFinalPathNameByHandle()
) - How do I get from a file path to the volume that holds it?
- How do I get from a volume to the physical disk that holds it?
- Renaming a file is a multi-step process, only one of which is changing the name of the file
- How can I recognize file systems that don't support 64-bit unique file identifiers?
- How can I recognize whether two handles refer to the same underlying file?
ACL
- The
MoveSecurityAttributes
policy affects only how Explorer recalculates ACLs when a file is moved; everybody else is on their own - How to create a folder that inherits its parent's ACL, and then overrides part of it
Security Permissions, Attributes and Identifiers
- The security check happens at the acquisition of the handle
- What is the default security descriptor?
- How do I convert a SID between binary and string forms?
- What are these SIDs of the form
S-1-15-2-xxx
? - What are these SIDs of the form
S-1-15-3-xxx
? - An easy way to determine whether you have a particular file permission
- What are the access rights and privileges that control changing ownership of an object?
- How do the names in the file security dialog map to access control masks?
- If you ask for
STANDARD_RIGHTS_REQUIRED
, you may as well ask for the moon - A user's SID can change, so make sure to check the SID history
- Detecting whether a SID is well-known SID
- SIDs are really just another a fancy way of creating unique IDs in a decentralized way
- What's the point of giving my unnamed object proper security attributes since unnamed objects aren't accessible outside the process anyway (or are they?)
- Is a SID with zero subauthorities a valid SID? It depends whom you ask
- What's the difference between duplicating the handle to a token and duplicating a token?
- I called
AdjustTokenPrivileges
, but I was still told that a necessary privilege was not held - I called
AdjustTokenPrivileges
, but I was still told that a necessary privilege was not held, redux - The history of the
EncodePointer
function for obfuscating pointers - Additional helpful pseudo-handles: The process token, the thread token, and the effective token
- How can I tell whether my process is running as SYSTEM?
- A brief summary of the various versions of the Security Descriptor Definition Language (SDDL)
- How do I free the pointers returned by functions like
GetTokenInformation
? - A clarification on the multithreading constraints of the
EncryptMessage
function
Registry
- Beware of non-null-terminated registry strings
- The performance cost of reading a registry key
- So how bad is it that I'm calling
RegOpenKey
instead of RegOpenKeyEx
? - If I simply want to create a registry key but don't intend to do anything else with it, what security access mask should I ask for?
- How can I programmatically inspect and manipulate a registry hive file without mounting it?
- Why doesn't
RegSetKeySecurity
propagate inheritable ACEs, but SetSecurityInfo
does? - Why does
RegNotifyChangeKeyValue
stop notifying once the key is deleted? - How can I emulate the
REG_NOTIFY_THREAD_AGNOSTIC
flag on systems that don't support it? part 1 - How can I emulate the
REG_NOTIFY_THREAD_AGNOSTIC
flag on systems that don't support it? part 2 - How can I emulate the
REG_NOTIFY_THREAD_AGNOSTIC
flag on systems that don't support it? part 3 - How can I emulate the
REG_NOTIFY_THREAD_AGNOSTIC
flag on systems that don't support it? part 4 - How can I emulate the
REG_NOTIFY_THREAD_AGNOSTIC
flag on systems that don't support it? part 5 - The history of passing a null pointer as the key name to
RegOpenKeyEx
- On the failed unrealized promise of
RegOverridePredefKey
(ie don't use it.)
Strings and Locales
-
TEXT
vs. _TEXT
vs. _T
, and UNICODE
vs. _UNICODE
- The sad history of Unicode
printf
-style format specifiers in Visual C++ - Nasty gotcha:
SetThreadUILanguage
cannot be used to restore the thread UI language - How can
CharUpper
and CharLower
guarantee that the uppercase version of a string is the same length as the lowercase version? (use LCMapStringEx()
in any new code) - Is there a code page that matches ASCII and can round trip arbitrary bytes through Unicode?
- A consequence of being the first to adopt a standard is that you may end up being the only one to adopt it: The sad story of Korean jamo
- The
activeCodePage
manifest element can be used for more than just setting UTF-8 as the active code page - Feel free to stop using
IMultiLanguage2::DetectInputCodepage
- On the proper care and feeding of the enigmatic
GetDistanceOfClosestLanguageInList
function - How can I get
WideCharToMultiByte
to convert strings encoded in UTF-16BE?
NT Services
- Calling
ShutdownBlockReasonCreate
from my service doesn't stop the user from shutting down - What does it mean when my attempt to stop a Windows NT service fails with
ERROR_BROKEN_PIPE
? - How can I configure my Windows NT service to autostart when the system gains Internet access?
- On the confusing names for the Windows service SID types
Uncategorized
- How do I determine the processor's cache line size? (
GetLogicalProcessorInformation()
) - Why are structure sizes checked strictly?
- What's the difference between
CreateMenu
and CreatePopupMenu
? - Why are
HANDLE
return values so inconsistent? - How to retrieve text under the cursor (mouse pointer)
- How to detect programmatically whether you are running on 64-bit Windows
- A timed context menu
- The importance of passing the
WT_EXECUTELONGFUNCTION
flag to QueueUserWorkItem
- If your callback fails, it's your responsibility to set the error code
- The double-click time tells the window manager how good your reflexes are
- The cursor isn't associated with a window or a window class; it's associated with a thread group
- Menu item states are not reliable until they are shown because they aren't needed until then
- How can I display a live screenshot of a piece of another application?
- Converting from a UTC-based
SYSTEMTIME
directly to a local-time-based SYSTEMTIME
- Programmatically uploading a file to an FTP site
- How can you use both versions 5 and 6 of the common controls within the same module?
- How can I tell if Windows Update is waiting for the system to reboot?
- How do I call
SetTimer
with a timer ID that is guaranteed not to conflict with any other timer ID? - A window can't have two timers with the same ID, so how do I assign an ID that nobody else is using?
- What does it mean when a display change is temporary?
- How do I obtain the comment for a share?
- How accurate are the various Windows time-querying functions?
- How can I detect whether the user is logging off?
- Why are timer IDs and dialog control IDs 64-bit values on 64-bit Windows? Did you really expect people to create more than 4 billion timers or dialog controls?
- If you suppress GDI+ background thread, then you are expected to pump messages yourself
- If one program blocks shutdown, then all programs block shutdown (
WM_QUERYENDSESSION
, WM_ENDSESSION
) - When I ask the
GetIpAddrTable
function to sort the results, how are they sorted? - How can I detect that the system is no longer showing a UAC prompt? (
EVENT_SYSTEM_DESKTOPSWITCH
) - How can I get the number of processors in the system, when there are more than 64?
- Why are some system functions exported as stubs instead as forwarders?
- How can I check whether the user has disconnected from the session?
- Why does
PF_VIRT_FIRMWARE_ENABLED
return false even when virtualization is enabled in the firmware? - How can I convert between IANA time zones and Windows registry-based time zones?
- The focus rectangle says, “I'm not orange. I'm just drawn that way.”
- Why does the precise point at which I get a stack overflow exception change from run to run? (structured exception handling aka SEH)
- How do I programmatically reposition monitors in a multiple-monitor system? (
ChangeDisplaySettingsEx()
) - How do I upgrade a 32-bit tick count to a 64-bit one?
- The error code you get might not be the one you want
- How can I find out which processor architectures are supported via emulation by the current system?
- How can I detect whether the system has a keyboard attached? On the
GetRawInputDeviceList
function - Filtering out fake keyboards from the
GetRawInputDeviceList
function - How expensive is
PssCaptureSnapshot
? How fast is it? How much memory does it consume? - What is the
CreateExplorerShellUnelevatedTask
scheduled task? - Under what conditions can I modify the memory that I received in the form a
STGMEDIUM
? - Is it true that raising a structured exception from a structured exception handler terminates the process?
- Why are many Windows user interface elements positioned at multiples of 4 or 8 pixels? (DPI,
DEVICE_SCALE_FACTOR
) - A history of the
fd_set
, FD_SETSIZE
, and how it relates to WinSock - How can I detect programmatically whether Windows is an N or KN version?
- How should I interpret the various values of
NLM_CONNECTIVITY
? - How can I find out the last time a user logged on from C++?
- How can I specify icons for my app to use on the Start menu in high contrast mode?
- How can I add an environment variable to a process launched via
ShellExecuteEx
or IContextMenu
? - Functions that return the size of a required buffer generally return upper bounds, not tight bounds