Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

Windows callbacks as class members

$
0
0
I try to get rid of some Windows callbacks and variables in global scope. The Windows callbacks can be made class member methods (i.e. static), extracting the right instance and invoking the callback of that instance: if (WM_NCCREATE == uMsg) { const LONG_PTR replacement_value = (LONG_PTR)((CREATESTRUCT *)lParam)->lpCreateParams; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, replacement_value); return TRUE; } ((DeviceEnumeration *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA))->SettingsDialogProc(hwndDlg, uMsg, wParam, lParam); This works by passing "this" as the "lpParam" in "CreateWindow". Is a similar approach possible for "DialogBox"?

Viewing all articles
Browse latest Browse all 17825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>