Click here to Skip to main content
15,913,854 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to setup additional rights on directory at runtime ? Pin
Sasa Kajic26-Apr-02 4:59
Sasa Kajic26-Apr-02 4:59 
GeneralWindow Class Encapsulation and WNDPROC Pin
qmuffs26-Apr-02 4:56
qmuffs26-Apr-02 4:56 
GeneralRe: Window Class Encapsulation and WNDPROC Pin
Joaquín M López Muñoz26-Apr-02 5:00
Joaquín M López Muñoz26-Apr-02 5:00 
GeneralRe: Window Class Encapsulation and WNDPROC Pin
qmuffs26-Apr-02 6:31
qmuffs26-Apr-02 6:31 
GeneralRe: Window Class Encapsulation and WNDPROC Pin
alex.barylski26-Apr-02 8:14
alex.barylski26-Apr-02 8:14 
GeneralRe: Window Class Encapsulation and WNDPROC Pin
qmuffs26-Apr-02 8:40
qmuffs26-Apr-02 8:40 
GeneralRe: Window Class Encapsulation and WNDPROC Pin
qmuffs26-Apr-02 9:21
qmuffs26-Apr-02 9:21 
GeneralRe: Window Class Encapsulation and WNDPROC Pin
Joaquín M López Muñoz26-Apr-02 9:15
Joaquín M López Muñoz26-Apr-02 9:15 
As you pointed out, the problem lies in the hidden this parameter. One usual workaround to this goes as follows. Store the this parameter into the internal data kept by HWNDs with SetWindowLong(hwnd,GWL_USERDATA,reinterpret_cast<LONG>(this)) and set as your window proc a static function that merely recovers the this parameter and forwards the call to the real, per-object window proc:
class cwindow
{
  cwindow(HWND hwnd) // constructor
  {
    SetWindowLong(hwnd,GWL_USERDATA,reinterpret_cast<LONG>(this));
  }
 
  static LRESULT CALLBACK stub_WindowProc(
    HWND hwnd,
    UINT uMsg,
    WPARAM wParam,
    LPARAM lParam)
  {
    cwindow object=reinterpret_cast<object*>(GetWindowLong(hwnd,GWL_USERDATA));
    return object->WindowProc(hwnd,uMsg,wParam,lParam);
  }
 
  LRESULT CALLBACK stub_WindowProc(
    HWND hwnd,
    UINT uMsg,
    WPARAM wParam,
    LPARAM lParam) // the "real" window proc
  {
    ...
  }
};
Get the idea?

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
GeneralRe: Window Class Encapsulation and WNDPROC Pin
qmuffs26-Apr-02 9:22
qmuffs26-Apr-02 9:22 
GeneralUndocumented wParam values for WM_SYSCOMMAND Pin
26-Apr-02 2:49
suss26-Apr-02 2:49 
GeneralRe: Undocumented wParam values for WM_SYSCOMMAND Pin
Paul M Watt26-Apr-02 4:02
mentorPaul M Watt26-Apr-02 4:02 
GeneralI should filter these bits by wParam & 0xfff0, I think Pin
28-Apr-02 22:56
suss28-Apr-02 22:56 
GeneralFormat text in text file Pin
Xtorpia26-Apr-02 2:35
Xtorpia26-Apr-02 2:35 
GeneralRe: Format text in text file Pin
lucy26-Apr-02 2:55
lucy26-Apr-02 2:55 
GeneralRe: Format text in text file Pin
markkuk26-Apr-02 3:02
markkuk26-Apr-02 3:02 
GeneralRe: Format text in text file Pin
Xtorpia26-Apr-02 3:09
Xtorpia26-Apr-02 3:09 
GeneralRe: Format text in text file Pin
Tim Smith26-Apr-02 5:08
Tim Smith26-Apr-02 5:08 
GeneralRe: Format text in text file Pin
Joaquín M López Muñoz26-Apr-02 4:31
Joaquín M López Muñoz26-Apr-02 4:31 
GeneralRe: Format text in text file Pin
Xtorpia26-Apr-02 5:06
Xtorpia26-Apr-02 5:06 
GeneralDistributed compiling Pin
Braulio Dez26-Apr-02 1:31
Braulio Dez26-Apr-02 1:31 
GeneralRe: Distributed compiling Pin
26-Apr-02 1:44
suss26-Apr-02 1:44 
GeneralRe: Distributed compiling Pin
James R. Twine26-Apr-02 10:15
James R. Twine26-Apr-02 10:15 
GeneralRe: Distributed compiling Pin
Braulio Dez28-Apr-02 20:58
Braulio Dez28-Apr-02 20:58 
GeneralSYSTEMTIME - Difference Pin
Sameer Maggon25-Apr-02 23:36
Sameer Maggon25-Apr-02 23:36 
GeneralRe: SYSTEMTIME - Difference Pin
Niklas L26-Apr-02 0:22
Niklas L26-Apr-02 0:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.