我正在开发一个基于C++的程序,并且还使用SiliconSoftware接口.正如您从附加的活塞中看到的那样,我正在使用c ++ win32代码运行主窗口,但显示窗口是使用帧抓取器接口创建的,其中包含以下代码:
int Bits=8; int nId =::CreateDisplay(Bits,GrabberOptions::getWidth(),GrabberOptions::getHeight());SetBufferWidth(nId,GrabberOptions::getWidth(),GrabberOptions::getHeight());::DrawBuffer(nId,Fg_getImagePtrEx(fg,lastPicNr,0,_memoryAllc),lastPicNr,"");
Run Code Online (Sandbox Code Playgroud)
但我想要这个Diplay窗口,在主窗口内打开.我该怎么做 ?任何的想法?

让我们说你有
HWND a = ...
HWND b = ...
Run Code Online (Sandbox Code Playgroud)
无论如何,他们都是兄弟窗口的原生句柄.为了让孩子成为一个孩子,你必须这样做
Setparent(b,a); //a will be the new parent b
DWORD style = GetWindowLong(b,GWL_STYLE); //get the b style
style &= ~(WS_POPUP|WS_CAPTION); //reset the "caption" and "popup" bits
style |= WS_CHILD; //set the "child" bit
SetWindowLong(b,GWL_STYLE,style); //set the new style of b
RECT rc; //temporary rectangle
GetClientRect(a,&rc); //the "inside border" rectangle for a
MoveWindow(b,rc.left,rc.top,rc.right-rc.left,rc.bottom-rc.top); //place b at (x,y,w,h) in a
UpdateWindow(a);
Run Code Online (Sandbox Code Playgroud)
现在你必须从a处理WM_SIZE并相应地移动b,以便它与其(新)父级一起调整大小.
| 归档时间: |
|
| 查看次数: |
7638 次 |
| 最近记录: |