--- Revision None +++ Revision 323032386666 @@ -0,0 +1,67 @@ +#include "main.h" +#include +#include + +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); + + + + } +}