Assembly code snippets

Back to the snippets overview

Details

TitleFlat listview header
Authorsmurf
Submitted by:smurf
Date added:2002-02-18 03:59:23
Date modified:2002-02-18 04:09:54

Comments

This code snipet will make your listview have a flat header. An advantage to using the HDS_BUTTONS style is that your header will behave similar to a button. Many of the messages a normal button will send, your header will send too.

Snippet

.data?
;// the handle of your listview
   hListView   dd ?

.code
;// place this code anywhere after your create your listview
   invoke SendMessage,hListView,LVM_GETHEADER, 0, 0   ;// get handle to header
   mov    hHeader,eax                                 ;// preserve header handle
   invoke GetWindowLong, hHeader, GWL_STYLE           ;// get current window styles
   xor    eax,HDS_BUTTONS
   invoke SetWindowLong,hHeader, GWL_STYLE, eax       ;// set the new header styles