Created
March 2, 2014 00:09
-
-
Save kumatti1/9299696 to your computer and use it in GitHub Desktop.
VBAでサブクラス化
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include <Commctrl.h> | |
LRESULT CALLBACK SUBCLASSPROC( | |
HWND hWnd, | |
UINT uMsg, | |
WPARAM wParam, | |
LPARAM lParam, | |
UINT_PTR uIdSubclass, | |
DWORD_PTR dwRefData | |
){ | |
#ifdef _M_AMD64 | |
auto pDefSubclassProc = reinterpret_cast<decltype (DefSubclassProc)*>(0x1111111111111111); | |
auto VBA_PROC = reinterpret_cast<decltype (DefSubclassProc)*>(0x1111111111111111); | |
#else | |
auto pDefSubclassProc = reinterpret_cast<decltype (DefSubclassProc)*>(0x11111111); | |
auto VBA_PROC = reinterpret_cast<decltype (DefSubclassProc)*>(0x11111111); | |
#endif | |
UINT volatile OrgMsg = (UINT)0x11111111; | |
if(uMsg == OrgMsg) | |
{ | |
VBA_PROC(hwnd, uMsg, wParam, lParam); | |
} | |
return pDefSubclassProc(hwnd, uMsg, wParam, lParam); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Function CallFunc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As LongPtr | |
Debug.Print Hex$(hWnd) | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment