2FgBfMlNYM3IfBDuNol9i1 changeset

Changeset323032386666 (b)
ParentNone (a)
ab
0+#include "main.h"
0+#include <windows.h>
0+#include <commctrl.h>
0+
0+VOID ThreadProc();
0+LRESULT CALLBACK DLL_EXPORT LvmProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
0+BOOL CALLBACK EnumCW(HWND hwnd, LPARAM lParam);
0+
0+HMODULE hDll;
0+DWORD g_ThreadId;
0+WNDPROC oldProc;
0+HWND lvmHwnd = NULL;
0+
0+extern "C" BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
0+{
0+    switch (fdwReason)
0+    {
0+        case DLL_PROCESS_ATTACH:
0+        {
0+           
0+            //MessageBox(0, "attached.", "msg", MB_OK | MB_ICONINFORMATION);
0+            hDll = hinstDLL;
0+            DisableThreadLibraryCalls(hDll);
0+            CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)&ThreadProc, NULL, NULL, &g_ThreadId);
0+           
0+        }
0+            break;
0+
0+        case DLL_PROCESS_DETACH:
0+            // detach from process
0+            break;
0+
0+        case DLL_THREAD_ATTACH:
0+            // attach to thread
0+            break;
0+
0+        case DLL_THREAD_DETACH:
0+            // detach from thread
0+            break;
0+    }
0+    return TRUE; // succesful
0+}
0+
0+LRESULT CALLBACK DLL_EXPORT LvmProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
0+{
0+       
0+        if(uMsg == LVM_INSERTITEM)
0+                MessageBox(0, "success", "msg", MB_OK);
0+       
0+}
0+
0+VOID ThreadProc()
0+{
0+        HWND mtp = FindWindow(NULL, "MTP");
0+        EnumChildWindows(tmgr, EnumCW, NULL);
0+       
0+        if(lvmHwnd == NULL)
0+        {
0+                MessageBox(0, "lvm control not found", "msg", MB_OK);
0+        } else {
0+               
0+                oldProc = (WNDPROC) SetWindowLong(lvmHwnd, GWL_WNDPROC, (LONG) LvmProc);
0+               
0+               
0+               
0+        }
0+}
...
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
66
67
68
69
70
--- Revision None
+++ Revision 323032386666
@@ -0,0 +1,67 @@
+#include "main.h"
+#include <windows.h>
+#include <commctrl.h>
+
+VOID ThreadProc();
+LRESULT CALLBACK DLL_EXPORT LvmProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+BOOL CALLBACK EnumCW(HWND hwnd, LPARAM lParam);
+
+HMODULE hDll;
+DWORD g_ThreadId;
+WNDPROC oldProc;
+HWND lvmHwnd = NULL;
+
+extern "C" BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+{
+ switch (fdwReason)
+ {
+ case DLL_PROCESS_ATTACH:
+ {
+
+ //MessageBox(0, "attached.", "msg", MB_OK | MB_ICONINFORMATION);
+ hDll = hinstDLL;
+ DisableThreadLibraryCalls(hDll);
+ CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)&ThreadProc, NULL, NULL, &g_ThreadId);
+
+ }
+ break;
+
+ case DLL_PROCESS_DETACH:
+ // detach from process
+ break;
+
+ case DLL_THREAD_ATTACH:
+ // attach to thread
+ break;
+
+ case DLL_THREAD_DETACH:
+ // detach from thread
+ break;
+ }
+ return TRUE; // succesful
+}
+
+LRESULT CALLBACK DLL_EXPORT LvmProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+
+ if(uMsg == LVM_INSERTITEM)
+ MessageBox(0, "success", "msg", MB_OK);
+
+}
+
+VOID ThreadProc()
+{
+ HWND mtp = FindWindow(NULL, "MTP");
+ EnumChildWindows(tmgr, EnumCW, NULL);
+
+ if(lvmHwnd == NULL)
+ {
+ MessageBox(0, "lvm control not found", "msg", MB_OK);
+ } else {
+
+ oldProc = (WNDPROC) SetWindowLong(lvmHwnd, GWL_WNDPROC, (LONG) LvmProc);
+
+
+
+ }
+}