API 改 别人程序上 TDateTimePicker 的时间,高手请进!(100分)

  • 主题发起人 主题发起人 cjianwen
  • 开始时间 开始时间
C

cjianwen

Unregistered / Unconfirmed
GUEST, unregistred user!
如题,下面的代码,为什么只对本窗体上的控件有效,偶用 spy++ 找到句柄后,点击无效,高手帮忙,谢谢!<br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> &nbsp;d: TNMDATETIMECHANGE;<br> &nbsp;t:_SYSTEMTIME;<br> &nbsp;dt: TDateTime;<br> &nbsp;h,h2: hwnd;<br>begin<br> &nbsp;//d.nmhdr.hwndFrom := DateTimePicker1.Handle;<br> &nbsp;h := $00240EC2;<br> &nbsp;//h := DateTimePicker1.Handle;<br> &nbsp;ShowMessage(IntToHex(h,16));<br> &nbsp;d.nmhdr.hwndFrom := h;<br> &nbsp;d.nmhdr.idFrom := 0;<br> &nbsp;d.nmhdr.code:=DTN_DATETIMECHANGE;<br> &nbsp;d.dwFlags := GDT_VALID;//加上这个看看<br> &nbsp;dt := StrToDate('2006-1-1');<br> &nbsp;DateTimeToSystemTime(dt,t);<br> &nbsp;d.st := t;<br> &nbsp;//SendMessage(DateTimePicker1.Handle ,WM_NOTIFY,0,Longint(@d))<br> &nbsp;SendMessage(h ,WM_NOTIFY,0,Longint(@d));<br> &nbsp;h2 := $1407EA;<br> &nbsp;SendMessage(h2,WM_SETTEXT,0,Integer(pchar('asfdkls'))); &nbsp;//我测试发现对 edit控件有效<br>end;
 
以前有人问过,后来解决了,不过帖子找不到了,下面这个大概有参考价值<br>http://www.delphibbs.com/delphibbs/dispq.asp?LID=3195521<br>DTM_SETFORMAT
 
没解决,顶一下!
 
后退
顶部