2526
T-Clock / Re: T-Clock 2010 (Maybe...)
« Last post by f0dder on March 03, 2010, 06:35 AM »Hm, just did a silly little test - obviously won't work runtime, but compiles clean with the following two compilers (VS2008 + SP1):
Microsoft (R) C/C++ Optimizing Compiler Version 15.00.30729.01 for x64
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
...should work fine for older compilers as well, although there is a PlatformSDK dependency to have GWLP_* work (dunno when that was introduced, but iirc it works fine on VS2005).
Note that I prefer the C++ style cast operators, but C style (cast) just as well (they're less explicit and harder to grep for, though, and the C++ operators allow you to be more precise wrt. what/why you're casting).
Microsoft (R) C/C++ Optimizing Compiler Version 15.00.30729.01 for x64
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
...should work fine for older compilers as well, although there is a PlatformSDK dependency to have GWLP_* work (dunno when that was introduced, but iirc it works fine on VS2005).
Note that I prefer the C++ style cast operators, but C style (cast) just as well (they're less explicit and harder to grep for, though, and the C++ operators allow you to be more precise wrt. what/why you're casting).
Code: C++ [Select]
- #include <windows.h>
- extern HWND hwndClock;
- extern LRESULT CALLBACK newWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
- int main()
- {
- WNDPROC oldWndProc = reinterpret_cast<WNDPROC>(GetWindowLongPtr(hwndClock, GWLP_WNDPROC));
- SetWindowLongPtr(hwndClock, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(newWindowProc));
- }

Recent Posts


on Ars-Technica and the rest of the people that's helped expose the moron.