DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: palmcivetcn1
今日帖子: 17
在线用户: 13
导航: 论坛 -> DELPHI技术 斑竹:liumazi,sephil  
作者:
男 acism (caism) ★☆☆☆☆ -
普通会员
2004/2/24 21:54:47
标题:
有没人知道SetClasslong的用法? 浏览:2069
加入我的收藏
楼主: 我试着更改一个窗口类的窗口过程,可是不知如何用,我做过如下尝试:
SetClassLong(hPassEdit,GCL_WNDPROC,@EditProc);

可是最后一个参数不对,说是要Integer类型的,不能用指针,可我的目的是要更变窗口处理过程的地址,用Integer如何做?
----------------------------------------------
-
作者:
男 bios (阿贡) ★☆☆☆☆ -
盒子中级会员
2004/2/24 22:01:30
1楼: 认真看帮助!
此帖子包含附件:
JPEG 图像
大小:149.2K
----------------------------------------------
按此在新窗口浏览图片
按此在新窗口浏览图片
作者:
男 bios (阿贡) ★☆☆☆☆ -
盒子中级会员
2004/2/24 22:02:10
2楼: @ 多余 去掉他!
----------------------------------------------
按此在新窗口浏览图片
按此在新窗口浏览图片
作者:
男 acism (caism) ★☆☆☆☆ -
普通会员
2004/2/24 22:04:29
3楼: 我没有这个帮助文件,能不能把内空copy出来 一下下,谢谢。
----------------------------------------------
-
作者:
男 acism (caism) ★☆☆☆☆ -
普通会员
2004/2/24 22:06:09
4楼: @去了后,出现:
Not enough actual parameters
----------------------------------------------
-
作者:
男 bios (阿贡) ★☆☆☆☆ -
盒子中级会员
2004/2/24 22:07:51
5楼: 开DELPHI太慢 明天再说!


The SetClassLong function replaces the specified 32-bit (long) value at the specified offset into the extra class memory or the WNDCLASS structure for the class to which the specified window belongs. 

DWORD SetClassLong(

    HWND hWnd,  // handle of window
    int nIndex,  // index of value to change
    LONG dwNewLong   // new value
   );  
 

Parameters

hWnd

Identifies the window and, indirectly, the class to which the window belongs. 

nIndex

Specifies the 32-bit value to replace. To set a 32-bit value in the extra class memory, specify the positive, zero-based byte offset of the value to be set. Valid values are in the range zero through the number of bytes of extra class memory, minus four; for example, if you specified 12 or more bytes of extra class memory, a value of 8 would be an index to the third 32-bit integer. To set any other value from the WNDCLASS structure, specify one of the following values: 

Value  Action
GCL_CBCLSEXTRA  Sets the size, in bytes, of the extra memory associated with the class. Setting this value does not change the number of extra bytes already allocated.
GCL_CBWNDEXTRA  Sets the size, in bytes, of the extra window memory associated with each window in the class. Setting this value does not change the number of extra bytes already allocated. For information on how to access this memory, see SetWindowLong and SetWindowWord.
GCL_HBRBACKGROUND  Replaces the handle of the background brush associated with the class.
GCL_HCURSOR  Replaces the handle of the cursor associated with the class.
GCL_HICON  Replaces the handle of the icon associated with the class.
GCL_HMODULE  Replaces the handle of the module that registered the class.
GCL_MENUNAME  Replaces the address of the menu name string. The string identifies the menu resource associated with the class.
GCL_STYLE  Replaces the window-class style bits.
GCL_WNDPROC  Replaces the address of the window procedure associated with the class.
 

dwNewLong

Specifies the replacement value. 

 

Return Values

If the function succeeds, the return value is the previous value of the specified 32-bit integer.
If the function fails, the return value is zero. To get extended error information, call GetLastError. 

Remarks

If you use the SetClassLong function and the GCL_WNDPROC index to replace the window procedure, the window procedure must conform to the guidelines specified in the description of the WindowProc callback function. 
Calling SetClassLong with the GCL_WNDPROC index creates a subclass of the window class that affects all windows subsequently created with the class. An application should not subclass a window created by another process. 
Reserve extra class memory by specifying a nonzero value in the cbClsExtra member of the WNDCLASS structure used with the RegisterClass function. 

Use the SetClassLong function with care. For example, it is possible to change the background color for a class by using SetClassLong, but this change does not immediately repaint all windows belonging to the class. 

See Also

GetClassLong, GetClassWord, RegisterClass, SetClassWord, SetWindowLong, SetWindowWord, WindowProc, WNDCLASS 
此帖子包含附件:
JPEG 图像
大小:86.6K
----------------------------------------------
按此在新窗口浏览图片
按此在新窗口浏览图片
作者:
男 bios (阿贡) ★☆☆☆☆ -
盒子中级会员
2004/2/24 22:11:52
6楼: 这不是很正常!
看来你们功底还真的 很差哦!
此帖子包含附件:
JPEG 图像
大小:62.1K
----------------------------------------------
按此在新窗口浏览图片
按此在新窗口浏览图片
作者:
男 acism (caism) ★☆☆☆☆ -
普通会员
2004/2/24 22:17:48
7楼: 我的EditProc是一个函数呀,不是0
如下:
Function EditProc(Hwnd,Msg,Wparam,lParam:longint):longint;stdcall;
begin
  Result:=DefWindowProc(Hwnd,Msg,Wparam,lParam);
  Case Msg of
    WM_KEYUP:MessageBox(0,'aa','dd',mb_ok);
  end;
end;
其实我只是想要改变Edit控件的消息处理函数(问题我的上一贴)
----------------------------------------------
-
作者:
男 bios (阿贡) ★☆☆☆☆ -
盒子中级会员
2004/2/24 22:22:35
8楼: 晕 根据帮助上说 那是个普通变量参数 不接受 回调函数的地址,明白吗?
这样写错误的,编译器不允许你这样!
----------------------------------------------
按此在新窗口浏览图片
按此在新窗口浏览图片
作者:
男 bios (阿贡) ★☆☆☆☆ -
盒子中级会员
2004/2/24 22:25:24
9楼: 你可以这样
此帖子包含附件:
JPEG 图像
大小:101.0K
----------------------------------------------
按此在新窗口浏览图片
按此在新窗口浏览图片
作者:
男 acism (caism) ★☆☆☆☆ -
普通会员
2004/2/24 22:27:13
10楼: 我试试
----------------------------------------------
-
作者:
男 bios (阿贡) ★☆☆☆☆ -
盒子中级会员
2004/2/24 22:30:49
11楼: 如果还有问题 明天再说吧 偶要下了!
----------------------------------------------
按此在新窗口浏览图片
按此在新窗口浏览图片
作者:
男 acism (caism) ★☆☆☆☆ -
普通会员
2004/2/24 23:00:28
12楼: 不对,EditProc返回的并不是这个函数本身的地址呀
----------------------------------------------
-
作者:
男 sephil (NAILY Soft) ★☆☆☆☆ -
盒子中级会员
2004/2/24 23:55:43
13楼: SetClassLong(hPassEdit,GCL_WNDPROC, Longint(@EditProc));
----------------------------------------------
Copyright 2008 ? NAILY Soft

Click here to redirect to my home
Click here to redirect to my blog
作者:
男 bios (阿贡) ★☆☆☆☆ -
盒子中级会员
2004/2/25 11:11:24
14楼: 晕,你这么这样啊,这个函数的最后一个参数又没说要 传入 函数地址!

 你怎么这样不看帮助呢?看来你的脾气比偶还大啊!
----------------------------------------------
按此在新窗口浏览图片
按此在新窗口浏览图片
作者:
男 bios (阿贡) ★☆☆☆☆ -
盒子中级会员
2004/2/25 11:22:18
15楼: 函数返回值 当然不是 函数的地址喽,你啊 你 你要学会 单步调试啊!

----------------------------------------------
按此在新窗口浏览图片
按此在新窗口浏览图片
作者:
男 acism (caism) ★☆☆☆☆ -
普通会员
2004/2/25 11:35:32
16楼: 1、我在dll中,没法单步调试
2、当我要更改Wndproc时,最后一个参数就是新函数的地址
3、sephil帮我做出了正确的答案:)
SetClassLong(hPassEdit,GCL_WNDPROC, Longint(@EditProc)); 
4、谢谢两位大侠!
----------------------------------------------
-
作者:
男 bios (阿贡) ★☆☆☆☆ -
盒子中级会员
2004/2/25 14:56:55
17楼: 恩 是的 但DLL中是可以调试,看来你的DELPHI 还不熟悉
你能不能给出原代码!不然似乎你很高傲!
----------------------------------------------
按此在新窗口浏览图片
按此在新窗口浏览图片
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行125毫秒 RSS