天天看點

SetWindowLong 和SetClassLong差別

首先看一下msdn是怎樣定義它們的吧,可不要搞錯啊:

The SetWindowLong function changes an attribute of the specified window. The function also sets the 32-bit (long) value at the specified offset into the extra window memory.

Note  This function has been superseded by the SetWindowLongPtr function. To write code that is compatible with both 32-bit and 64-bit versions of Microsoft Windows, use the SetWindowLongPtr function.

Syntax

LONG SetWindowLong(          HWND hWnd,

    int nIndex,

    LONG dwNewLong

);上面是對SetWindowLong的說明(定義),注意紅色字型。

下面是SetClassLong的說明:The SetClassLong function replaces the specified 32-bit (long) value at the specified offset into the extra class memory or the WNDCLASSEX structure for the class to which the specified window belongs. Note  This function has been superseded by the SetClassLongPtr function. To write code that is compatible with both 32-bit and 64-bit versions of Microsoft Windows, use SetClassLongPtr. SyntaxDWORD SetClassLong(          HWND hWnd,

);注意紅色字型表示。 這裡要注意the specified window,這裡說的是具體的某個視窗,而 the class to which the specified window belongs指的是具體某個視窗歸屬的類。也就是說SetWindowLong是對具體的視窗的行為或樣式等(such as window proc and window style)進行修改。而SetClassLong是對視窗歸屬的類的行為或樣式等進行修改設定。同時注意它們的傳回情況,這也很重要,這裡就不多說了。

上一篇: 難受。。。
下一篇: 我也說說

繼續閱讀