sdk出现了,但却不在对话框中
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
什么意思,看不懂了,再说明白点好吗?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
什么意思,看不懂了,再说明白点好吗?
解决方案 »
- VC6 在安装了Bounds Checker后,为什么用run to cursor 调试就不生效啦,总是从头开始执行,救命啊
- 初学,请各位大哥们帮忙,看看。。。在线等。
- 如何获得USB手写板的压感参数?
- 如何将声音文件录制成mp3或者wma格式,急
- 高分求解一个数字!高手请进!
- 内存泄漏???????顶也有分:)
- 98下SPI不支持分层安装??????
- 如何获得一个随机数?(在线等)
- 菜鸟发文,Debug Assertion Failed!
- __declspec(selectany) ATL::_ATL_OBJMAP_ENTRY ... 什么意思?
- 求教一个关于连接点的问题,十万火急!!!
- 那有UML的书,最好电子版
HWND CreateNMWindow(HWND hWndParent, int x, int y, LPCTSTR szMode)
{
USES_CONVERSION;
TCHAR szFormatModeString[MAX_PATH];
wsprintf(szFormatModeString, _T("MODE=%s"), szMode); NmInitStruct nmis;
nmis.wSize = sizeof(nmis.str);
wcscpy(nmis.str, T2OLE(szFormatModeString)); LPOLESTR strGUIDNetMeetingActiveXControl = NULL;
StringFromCLSID(CLSID_NetMeeting, &strGUIDNetMeetingActiveXControl); HWND hWndCtl =
::CreateWindow(NULL,
// Use ATL's string conversion routine to convert to a LPTSTR from an LPOLESTR
OLE2T(strGUIDNetMeetingActiveXControl),
WS_CHILD|WS_VISIBLE,
x,
y,
352,
436,
hWndParent,
NULL,
::GetModuleHandle(NULL),
&nmis
); // Remember to free memory given to you by StringFromCLSID
CoTaskMemFree(strGUIDNetMeetingActiveXControl ); if(hWndCtl)
{
// get the IUnknown for the video window (we want to get it's size)
IUnknown* pUnk = NULL;
HRESULT hr = AtlAxGetControl(hWndCtl, &pUnk);
if(SUCCEEDED(hr))
{
// Now get the IOleObject interface for the netmeeting control
IOleObject* pOleObjVideoWindow = NULL;
hr = pUnk->QueryInterface(&pOleObjVideoWindow);
if(SUCCEEDED(hr))
{
// get the Extent
SIZEL sizel = {0, 0};
hr = pOleObjVideoWindow->GetExtent(DVASPECT_CONTENT, &sizel);
if(SUCCEEDED(hr))
{
// Convert the Extent from HIMETRIC to pixels.
SIZEL sizeInPixels = {0, 0};
AtlHiMetricToPixel(&sizel, &sizeInPixels);
SetWindowPos(hWndCtl, NULL, 0, 0, sizeInPixels.cx, sizeInPixels.cy, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
} // Don't forget to release interfaces!
pOleObjVideoWindow->Release();
} // Don't forget to release interfaces!
pUnk->Release();
}
} return hWndCtl;
}
可能是这一句,你现在传递的第一个参数要是当前窗口的父窗口,应该是this指针,(在对话框中),而this->m_hWnd指的是对话框的父窗口,所以在对话框显示不出来。
改为pConf->m_hWndLocal = CreateNMWindow(this, 43, 76, _T("Telephone"));
在nm.h中有HWND hMain,在nm父窗口中初始化他
在CreateWindow前用IsWindow检查一下
还有,好像CreateWindow得倒数第二个参数是HINSTANCE,不是HMODULE,可以用_Module.GetModuleInstance()
{
USES_CONVERSION;
TCHAR szFormatModeString[MAX_PATH];
wsprintf(szFormatModeString, _T("MODE=%s"), szMode); NmInitStruct nmis;
nmis.wSize = sizeof(nmis.str);
wcscpy(nmis.str, T2OLE(szFormatModeString)); LPOLESTR strGUIDNetMeetingActiveXControl = NULL;
StringFromCLSID(CLSID_NetMeeting, &strGUIDNetMeetingActiveXControl); HWND hWndCtl =
::CreateWindow("AtlAxWin",
// Use ATL's string conversion routine to convert to a LPTSTR from an LPOLESTR
OLE2T(strGUIDNetMeetingActiveXControl),
WS_CHILD |WS_VISIBLE|WS_GROUP ,
x,
y,
width,
height,
hWndParent,
NULL,
//::GetModuleHandle(NULL),
AfxGetApp( )->m_hInstance,
&nmis
);
if(!hWndCtl)
DWORD dwError=GetLastError( );
// Remember to free memory given to you by StringFromCLSID
CoTaskMemFree(strGUIDNetMeetingActiveXControl ); if(hWndCtl)
{
// get the IUnknown for the video window (we want to get it's size)
IUnknown* pUnk = NULL;
HRESULT hr = AtlAxGetControl(hWndCtl, &pUnk);
if(SUCCEEDED(hr))
{
// Now get the IOleObject interface for the netmeeting control
IOleObject* pOleObjVideoWindow = NULL;
hr = pUnk->QueryInterface(&pOleObjVideoWindow);
if(SUCCEEDED(hr))
{
// get the Extent
SIZEL sizel = {0, 0};
hr = pOleObjVideoWindow->GetExtent(DVASPECT_CONTENT, &sizel);
if(SUCCEEDED(hr))
{
// Convert the Extent from HIMETRIC to pixels.
SIZEL sizeInPixels = {0, 0};
AtlHiMetricToPixel(&sizel, &sizeInPixels);
int i=SetWindowPos(hWndCtl, NULL, 0, 0,sizeInPixels.cx, sizeInPixels.cy, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
} // Don't forget to release interfaces!
pOleObjVideoWindow->Release();
} // Don't forget to release interfaces!
pUnk->Release();
}
}
g_hVideoWnd=hWndCtl;
return hWndCtl;
}
if (!m_pConf)
{
if(m_PicBtn)
if(m_PicBtn->GetSafeHwnd())
m_pConf=new Conf(m_PicBtn->m_hWnd);
if (FAILED(m_pConf->Initialize()))
{
return FALSE;
}
// Create the video window at the archor spot. POINT pt ;
int x,y,h,w;
x=GetPrivateProfileInt("avwnd","x",0,m_lpszFaceFileName);
y=GetPrivateProfileInt("avwnd","y",0,m_lpszFaceFileName);
h=GetPrivateProfileInt("avwnd","height",0,m_lpszFaceFileName);
w=GetPrivateProfileInt("avwnd","width",0,m_lpszFaceFileName);
pt.x=x;
pt.y=y;
if(m_PicBtn)
if(m_PicBtn->GetSafeHwnd()){
if(m_bIsSrvPort){ // 本地 视频
m_pConf->m_hWndLocal = CreateNetMeetingWindow(m_PicBtn->m_hWnd, pt.x, pt.y,w,h, _T("PreviewNoPause"));
}
else{// 远端 视频
m_pConf->m_hWndRemote = CreateNetMeetingWindow(m_PicBtn->m_hWnd, pt.x, pt.y,w,h, _T("RemoteNoPause"));
}
}
}
return TRUE;
}
m_netmeeting.Create(IDD_NETMEETING_DIALOG,this);
m_netmeeting.MoveWindow(44,77,352,436,FALSE);
m_netmeeting.hMain=this->m_hWnd;//NetMeeting
m_netmeeting.hMain=this->m_hWnd;//NetMeeting 这一句是指定NetMeeting对象的主窗口句柄,而你指定当前对话框的窗口句柄,这就会出现这种错误。我的理解是这样。
所以应该是
CWnd*pWnd=GetDesktopWindow();
m_netmeeting.hMain=pWnd->m_hWnd;
看问题应该有个初步的判断,多调试,这样才能更早解决。
希望能解决你的问题。
这句话可能也要改:
CWnd*pWnd=GetDesktopWindow();
m_netmeeting.Create(IDD_NETMEETING_DIALOG,pWnd);