各位一定要帮我啊,小妹只有2000多点,解决以后,全部奉上 sdk出现了,但却不在对话框中^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^什么意思,看不懂了,再说明白点好吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 请问可以这样吗,先有了上面这段,在需要sdk的时候,使这个窗口显示 创建窗口时指定 parent ? CreateNMWindow 里面的CreateWindow 是不是用了WS_OVERLAPPED或WS_OVERLAPPEDWINDOW或WS_POPUP或WS_POPUPWINDOW? 如果你想让他在里面做子窗口应该用WS_CHILD,不要用前述 那些风格. 我CreatNMWindow的原型如下,风格没错啊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;} pConf->m_hWndLocal = CreateNMWindow(this->m_hWnd, 43, 76, _T("Telephone"));可能是这一句,你现在传递的第一个参数要是当前窗口的父窗口,应该是this指针,(在对话框中),而this->m_hWnd指的是对话框的父窗口,所以在对话框显示不出来。改为pConf->m_hWndLocal = CreateNMWindow(this, 43, 76, _T("Telephone")); 改为this不对,我现在用的是nm对话框的hwnd如下在nm.h中有HWND hMain,在nm父窗口中初始化他 如果程序不是太大的话,我愿意帮你调试一下,[email protected] 如果把对话框做父窗口的话,hWndParent的参数没错,直接用m_hWnd就行了在CreateWindow前用IsWindow检查一下还有,好像CreateWindow得倒数第二个参数是HINSTANCE,不是HMODULE,可以用_Module.GetModuleInstance() kingzai()我给你发一份代码,只是里面要安装一个控件 你用是的NETMEETING SDK吗??这个很简单啊。。HWND CreateNetMeetingWindow(HWND hWndParent, int x, int y,int width,int height, 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("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;} szweb(),我是用的NetMeeting,我的也是那样写的呀,就是结果不对,你帮帮我吧 kingzai()谢谢你,你先做你的吧,我下班很晚的 当然也不是就这么几句话。。好好看懂这个。。关键你的接口CLASS写好了吗?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;} 接口的class应该没问题吧,因为sdk的程序运行可以得到正确的结果,我把那些直接拿过来的 szweb(),你可以给我讲讲吗,分我肯定会给的 szweb() 分给你了,可是你还没帮我解决问题呢 你给我的程序我运行不了,(要改动的话太麻烦了),我只大概看了一下源程序。说我个人的直觉把。别的地方应该没有问题,函数接口这些东西也是对的。问题可能出在这块。 m_netmeeting.Create(IDD_NETMEETING_DIALOG,this); m_netmeeting.MoveWindow(44,77,352,436,FALSE); m_netmeeting.hMain=this->m_hWnd;//NetMeetingm_netmeeting.hMain=this->m_hWnd;//NetMeeting 这一句是指定NetMeeting对象的主窗口句柄,而你指定当前对话框的窗口句柄,这就会出现这种错误。我的理解是这样。所以应该是CWnd*pWnd=GetDesktopWindow();m_netmeeting.hMain=pWnd->m_hWnd;看问题应该有个初步的判断,多调试,这样才能更早解决。希望能解决你的问题。 m_netmeeting.Create(IDD_NETMEETING_DIALOG,this);这句话可能也要改:CWnd*pWnd=GetDesktopWindow();m_netmeeting.Create(IDD_NETMEETING_DIALOG,pWnd); kingzai() 谢谢你,我在调试吧 MFC 界面美化问题 请大家看下,我写日记的类。哪里有问题 如何竖排文本???? 如何上鼠标移动一个控件上(如Button),光标边即有一提示条显示该控件功能? 请问VC++中的关于象素显示的函数是什么? 绝对高手请进!(winsock问题) HOOK CreateFile的问题 VS 2012 VC++ 如何创建一个 COM 如何查询最新数据 求救!!!yamaha 719e-s声卡驱动程序!!! 求教一个关于连接点的问题,十万火急!!! 那有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);