关于窗体刷新的问题(100分)

  • 主题发起人 主题发起人 yansea
  • 开始时间 开始时间
Y

yansea

Unregistered / Unconfirmed
GUEST, unregistred user!
让我从头说起,问题是这样的。<br>我从其他程序中导出了一个对话框文件,是二进制格式。然后用CreateDialogIndirectParam<br>将其显示出来。不过这个对话框不是可见的,我又用SetWindowLong给它加上了WS_VISIBLE风格。<br>现在问题来了,对话框是能够显示出来,可是在显示出来的时候不会刷新,样子很难看。<br>并且无论我用SendMessage,ShowWindow,UpdateWindow等都不好使,只有用别的程序将它覆盖<br>掉,或者把程序最小化再还原,它才能够正常起来。<br>另外我传递的窗口函数只是处理了WM_CLOSE,并且无论我处理WM_PAINT与否它都没有什么反应。<br>希望大家给点帮助。
 
refresh试试
 
application.handlemessage
 
我只有那个对话框的HWND
 
向该窗口发送invalidate信息...
 
Invalidate 是发送CM_INVALIDATE消息,那对应的Windows消息是什么?
 
大家帮帮忙啊帮帮忙
 
就是说,我有这个窗体的 HWND,也可以写它的窗口过程,怎么能让它在显示时就刷新。
 
postmessage(窗体的 HWND,WM_PAINT,0,0)
 
无论 PostMessage WM_PAINT 还是 SendMessage WM_PAINT 都不好使。<br>我怀疑是我的窗口过程处理的问题。窗口过程是这样写的。<br><br>var<br>&nbsp; &nbsp; ps : TPaintStruct;<br>&nbsp; &nbsp; DC : HDC;<br>&nbsp; &nbsp; rect : TRect;<br><br>if uMsg = WM_PAINT then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp;// GetUpdateRect(h,rect,true);<br>&nbsp; &nbsp; &nbsp; &nbsp;// ps.rcPaint := rect;<br>&nbsp; &nbsp; &nbsp; // &nbsp;ps.fIncUpdate := true;<br>&nbsp; &nbsp; &nbsp; // &nbsp;ps.hdc := GetDC(h);<br>&nbsp; &nbsp; &nbsp; &nbsp; BeginPaint(h,ps);<br>&nbsp; &nbsp; &nbsp; &nbsp; EndPaint(h,ps);<br>&nbsp; &nbsp; &nbsp; &nbsp; Result := true;<br>&nbsp; &nbsp; end<br>&nbsp; &nbsp; else<br>&nbsp; &nbsp; if uMsg = WM_CLOSE then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; DestroyWindow(h);<br>&nbsp; &nbsp; &nbsp; &nbsp; //PostQuitMessage(0);<br>&nbsp; &nbsp; &nbsp; &nbsp; Result := true;<br>&nbsp; &nbsp; end else<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; DefWindowProc(h,uMsg,wParam,lParam);<br>&nbsp; &nbsp; &nbsp; &nbsp; Result := false;<br>&nbsp; &nbsp; end;
 
多人接受答案了。
 
后退
顶部