Image多幅图象闪烁问题如何解决?如何获取屏幕更新部分?如何将Image的某一部分更新?(200分)

  • 主题发起人 主题发起人 dsideal
  • 开始时间 开始时间
D

dsideal

Unregistered / Unconfirmed
GUEST, unregistred user!
我现在做远程屏幕监控系统,以前帖子我都看了,没有一个完整的解决答案,现在想征求一下大家的意见。
1、Image多幅图象闪烁问题如何解决?100分
2、如何获取屏幕的更新部分? 50分
3、如何将Image的某一部分更新? 50分

有好的代码可以邮到:xuqiang@dsideal.com 欢迎探讨。。。
 
直接调用VNC的Hook.dll的代码也可以,或者调用netmeeting的dll的代码也可以,谁能提供?
 
1, DoubleBuffered = True;
 
VNC的HOOK代码我已经改成Delphi,但是这个公司的东西,我还无权公开,不过VNC的HOOK代码非常简单,用半天的工作量就能搞定。
 
最近刚好看了一编关于虚拟窗口与物理窗口及其升度小区域更新的书籍,你肯定会使用到
以下API函数(请注意LPPAINTSTRUCT lpPaint结构):
The BeginPaint function prepares the specified window for painting and fills a PAINTSTRUCT
structure with information about the painting.

HDC BeginPaint(

HWND hwnd, // handle to window
LPPAINTSTRUCT lpPaint // pointer to structure for paint information
);


Parameters

hwnd

Identifies the window to be repainted.

lpPaint

Pointer to the PAINTSTRUCT structure that will receive painting information.



Return Values

If the function succeeds, the return value is the handle to a display device context for the specified window.
If the function fails, the return value is NULL, indicating that no display device context is available.

Remarks

The BeginPaint function automatically sets the clipping region of the device context to exclude any area outside the update region. The update region is set by the InvalidateRect or InvalidateRgn function and by the system after sizing, moving, creating, scrolling, or any other operation that affects the client area. If the update region is marked for erasing, BeginPaint sends a WM_ERASEBKGND message to the window.
An application should not call BeginPaint except in response to a WM_PAINT message. Each call to BeginPaint must have a corresponding call to the EndPaint function.

If the caret is in the area to be painted, BeginPaint automatically hides the caret to prevent it from being erased.
If the window's class has a background brush, BeginPaint uses that brush to erase the background of the update region before returning.

See Also

EndPaint, InvalidateRect, InvalidateRgn, PAINTSTRUCT, ValidateRect, ValidateRgn

The PAINTSTRUCT structure contains information for an application. This information can be used to paint the client area of a window owned by that application.

typedef struct tagPAINTSTRUCT { // ps
HDC hdc;
BOOL fErase;
RECT rcPaint;
BOOL fRestore;
BOOL fIncUpdate;
BYTE rgbReserved[32];
} PAINTSTRUCT;


Members

hdc

Identifies the display DC to be used for painting.

fErase

Specifies whether the background must be erased. This value is nonzero if the application should erase the background. The application is responsible for erasing the background if a window class is created without a background brush. For more information, see the description of the hbrBackground member of the WNDCLASS structure.

rcPaint

Specifies a RECT structure that specifies the upper left and lower right corners of the rectangle in which the painting is requested.

fRestore

Reserved; used internally by Windows.

fIncUpdate

Reserved; used internally by Windows.

rgbReserved

Reserved; used internally by Windows.



See Also

BeginPaint, RECT, WNDCLASS
 
VNC的Hook导出了5个函数

BOOL SetHooks(DWORD thread_id, UINT UpdateMsg, UINT CopyMsg, UINT MouseMsg)
BOOL UnSetHooks(DWORD thread_id)
BOOL SetKeyboardFilterHook(BOOL activate)
BOOL SetMouseFilterHook(BOOL activate)
DWORD HooksType()

 
据说用双缓冲可以解决图像闪的问题,大概原理是从两个缓冲区读图像,其中一个要人为开辟
 
用双缓存速度会影响速度。
爱元元的哥哥,你太厉害了,我也想过改VNC的代码,但对我来说太难了啊。你可以将delphi调用VNC中的dll的以下部分mail给我一份么?
1、如何获取屏幕的更新部分?
2、如何将Image的某一部分更新?
包括他的dll 。这样不算难为你吧?我另开帖子再给你100分,君子决无戏言。
 
双缓冲不是楼上的意思,是说把你绘图的工作放在后台去做,绘制完成后整体内存拷贝
 
chnplzh,谢谢你,我正在看。
 
chnplzh 这个函数你用过了么?我测试的太多了。
 
Canvas.CopyMode:=cmSrcCopy;
Canvas.CopyRect(MyOther,Bitmap.Canvas,MyRect);

 
djptony 到时候准备接分。代码可用。获取屏幕更新部分的代码或API函数大家帮忙啊。。。。
 
TO 楼主:
我没使用过,可惜那本书籍不在傍边,但它的原理绝对是对的。
 
看一下这本书
《DELPHI 下WINDOWS核心编程》
 
获取屏幕更新部
GetUpdateRect
 
GetUpdateRect 这个函数不能够获取屏幕更新区域,你试过了么?
 
那有vnc的源码?文档有吗?
 
看看这个API有没有用:ValidateRect
 
先在内存中动态建立一个空的BITMAP,然后先画在该BITMAP上,再执行以下语句:
image1.Picture.Bitmap.Canvas.Draw(Bitmap);

好象是这样的,你试试看
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
后退
顶部