justin = { main feed , music , code , askjf , pubkey };
Ask Justin Frankel
No reasonable question unanswered since 2009!

Suggested topics: programming, music, sleep, coffee, etc.

Note: please do not ask questions about REAPER features, bugs or scheduling, use the forums instead.


Name: Ask: Human (enter yes):
[back to index] | [unreplied] | [replied] | [recent comments] | [all]

Question: Justin, I think we'd all appreciate even the rough state form of your win32 api programming tips. Will you post it somewhere?
Asked by Will (24.234.128.x) on August 19 2009, 11:38am
Reply on August 19 2009, 8:26pm:
    I'd like to, but it's really in outline form, so not terribly useful... But I'll list a few high level tips here:
    • It's often the easiest to build your application out of plain dialog (DialogBoxParam() or CreateDialogParam())
    • Use Get/SetWindowLong(hwnd,GWL_USERDATA) (or GWLP_USERDATA for x64) for "this" pointers, if an object owns the dialog. Set it in WM_INITDIALOG, and get it for other messages.
    • On the same token, when the owner object has a dialog, it's good to do the following:
      • The object's constructor sets m_hwnd to 0.
      • The object's destructor does if (m_hwnd) DestroyWindow(m_hwnd);
      • WM_INITDIALOG sets this->m_hwnd to hwndDlg
      • WM_DESTROY clears this->m_hwnd to 0

Comment:
    Your Name:   -- Site Owner's Name:  (for human-verification)

    Comment:    

    
  
[back to index] | [unreplied] | [replied] | [recent comments] | [all]
Copyright 2025 Justin Frankel. | RSS