1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#include <windows.h>
#include <commctrl.h>
#include <uxtheme.h>
#include "resource.h"
#include "defs.h"
extern HFONT g_GUIFont;
WNDPROC Lv_PrevProc;
static LRESULT CALLBACK LvProc(HWND, UINT, WPARAM, LPARAM);
HWND
LvCreate(HWND hWnd, HMENU hMenu)
{
HMODULE hModule;
HWND hLv;
hLv = CreateWindowEx(
WS_EX_CLIENTEDGE,
WC_LISTVIEW,
TEXT(""),
WS_CHILD|WS_VISIBLE|WS_VSCROLL|LVS_REPORT|LVS_NOSORTHEADER,
0, 0, 0, 0,
hWnd,
hMenu,
GetModuleHandle(NULL),
NULL
);
Lv_PrevProc = (WNDPROC)SetWindowLongPtr(hLv,
GWLP_WNDPROC, (LONG_PTR)LvProc);
ListView_SetExtendedListViewStyle(hLv,
LVS_EX_DOUBLEBUFFER);
SendMessage(hLv, WM_SETFONT,
(WPARAM)g_GUIFont, MAKELPARAM(FALSE, 0));
hModule = LoadLibrary(TEXT("uxtheme.dll"));
if (hModule && GetProcAddress(hModule, "SetWindowTheme")) {
ListView_SetExtendedListViewStyle(hLv,
LVS_EX_FULLROWSELECT|LVS_EX_DOUBLEBUFFER);
SendMessage(hLv, WM_CHANGEUISTATE,
MAKEWPARAM(UIS_SET, UISF_HIDEFOCUS), 0);
SetWindowTheme(hLv, TEXT("Explorer"), NULL);
}
return hLv;
}
LRESULT CALLBACK
LvProc(HWND hLv, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg) {
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) {
case HDN_ENDTRACK:
UpdateLayout(GetParent(hLv));
return TRUE;
}
break;
}
return CallWindowProc(Lv_PrevProc, hLv, uMsg, wParam, lParam);
}
|