问自编浏览器进入一个网页后,点一个链接后系统自动调用用ie打开网页而不是用自身浏览器打开网页.如何让窗口用我自己的浏览器打开?答http://www.csdn.net/develop/read_article.asp?id=21702控制新的窗口默认情况下,浏览器收到创建新窗口请求时,会在ie中打开新的窗口.你可以处理newwindow2事件来在自己指定的窗口中打开请求的页面.
ienummoniker *pem=0; hr = pcreatedevenum->createclassenumerator(clsid_videoinputdevicecategory, &pem, 0); if(hr != noerror) { errmsg(text("sorry, you have no video capture hardware.\r\n\r\n") text("video capture will not function properly.")); goto enumaudio; } 【程序编程相关:我看OOP(四)】
问:如何枚举系统中视频捕获设备(摄像头)的设备名称答:以下代码来自directx9 sdk中的amcap示例// put all installed video and audio devices in the menus//void adddevicestomenu(){…… // enumerate all video capture devices icreatedevenum *pcreatedevenum=0; hr = cocreateinstance(clsid_systemdeviceenum, null, clsctx_inproc_server, iid_icreatedevenum, (void**)&pcreatedevenum); if(hr != noerror) { errmsg(text("error creating device enumerator")); return; } 【推荐阅读:【头文件】c++实现链表】
while(hr = pem->next(1, &pm, &cfetched), hr==s_ok) { ipropertybag *pbag=0; 【扩展信息:ASP.NET中使用Server.Tra】
pem->reset(); ulong cfetched; imoniker *pm;
hr = pm->bindtostorage(0, 0, iid_ipropertybag, (void **)&pbag); if(succeeded(hr)) { variant var; var.vt = vt_bstr; hr = pbag->read(l"friendlyname", &var, null); if(hr == noerror) { appendmenu(hmenusub, mf_string, menu_vdevice0 + uindex, w2t(var.bstrval));
if(gcap.pmvideo != 0 && (s_ok == gcap.pmvideo->isequal(pm))) bcheck = true;
checkmenuitem(hmenusub, menu_vdevice0 + uindex, (bcheck ? mf_checked : mf_unchecked)); enablemenuitem(hmenusub, menu_vdevice0 + uindex, (gcap.fcapturing ? mf_disabled : mf_enabled)); bcheck = false;
sysfreestring(var.bstrval);
assert(gcap.rgpmvideomenu[uindex] == 0); gcap.rgpmvideomenu[uindex] = pm; pm->addref(); } pbag->release(); }
pm->release(); uindex++; } pem->release();问:我目前使用 bcg 中的 cbcgpproplist 来实现某一个东西的属性,可是有一项数据特别大,大约500个字符,我希望能把这一项的高度调整可是不知道如何处理,不知道能单独调整其中一项吗
答:从cbcgpprop派生一个函数,重载onedit并在其中创建一个需要的大小的编辑框.最后add自定义的prop类对象.具体实现可以参照cbcgpcolorprop与cbcgpfontprop类的实现
问:我想实现一个功能,就是检测一个目录或文件,看它是否存在,如果不存在就创建这个目录或文件.答:可以用win32文件查找来查找文件或者文件夹是否存在,也可以用pathfileexists来判断.getfileattributes与pathisdirectory可以用于判断文件是否是目录.创建文件可以用createdirectory或者makesuredirectorypathexists.
bool fileexists(cstring filename){win32_find_data findfiledata; handle hfind;bool findflag=false;
hfind = findfirstfile(filename , &findfiledata);
if (hfind == invalid_handle_value) { findflag= false; } else { findflag=true; } findclose(hfind); return findflag;}
dword dwflag = getfileattributes(pathname); if ( 0xffffffff == dwflag ) 不存在; if ( file_attribute_directory & dwflag ) 是文件夹 else 是文件
问:请教一下,html中如果已知activex的classid,有什么办法可以直接找到它? 通过id来查找比较慢,所以问一下可否通过这种方式?取得ioleobject之后,我需要如何做才可以调用activex控件中的函数呢?答:由于控件所在容器是htmldocument对象,你可以用iolecontainer::enumobjects枚举里面的ole对象,包括控件与框架
iolecontainer* pcontainer;
// get the container hresult hr = phtmldoc2->queryinterface(iid_iolecontainer, (void**)&pcontainer); lpdisp->release();
... 下一页