Visual C++ 2008 Beta2 里面的Class Designer

image

Visual Studio 2008 Beta2中的Class Designer终于支持C++了,上面是一个MFC程序的类图,可以看到已经支持扩展MFC的宏了,可惜只能看不能重构代码。尽管Class Designer这功能相当不错,但是设计师们可能还是更习惯IBM 的Rational Rose Developer for Visual Studio和UML。我用Class Designer的C#支持的时候也就是加加注释而已,重构我更习惯用DevExpress提供的工具Refactor来做,类则用XSD.exe生成,因为Class Designer生成的属性只会扔NotImplementedException异常。

Visual C++项目组在做下一个版本的市场调查,有兴趣的可以去提提要求。

 

 

About Sheng Jiang 蒋晟

Microsoft MVP in Visual C , 2004- Forum moderator of the Visual C and .Net forums on CSDN Forum moderator of Chinese forums on Microsoft's MSDN forums
This entry was posted in Microsoft, Visual C++, Visual Studio and tagged , . Bookmark the permalink.

3 Responses to Visual C++ 2008 Beta2 里面的Class Designer

  1. Han says:

    hi ^^ 我是MICHAEL,看到了你的很多关于WEBBROWSER编程的文章,收获良多。请问能不能把我添加到你的MSN BUDDY LIST,呵呵,我希望能有更多的机会向你请教。我的MSN: winsays@hotmail.com
     
    真诚的
    Michael F. Han

  2. Han says:

    BOOL CElementFinder::FindElement(IWebBrowser2* pApp, CPoint pt) { if(pApp == NULL) return FALSE; CComPtr<IDispatch> cpDispDocument; CComQIPtr<IHTMLDocument2> cpDocument2; pApp->get_Document(&cpDispDocument); cpDocument2 = cpDispDocument; if(cpDocument2 == NULL) return FALSE; CComPtr<IHTMLElement> cpElem; cpDocument2->elementFromPoint(pt.x, pt.y, &cpElem); if(cpElem == NULL) return FALSE; CComBSTR bstrTagName; cpElem->get_tagName(&bstrTagName); CString strTagName(bstrTagName); if(strTagName == _T("FRAME") || strTagName == _T("IFRAME")) { CString strFrameFind; // Offset client point to frame local point CPoint ptLocal = pt; //———————————————————————————– // document.body.scrollTop or scrollLeft doesn’t work in IE7, // so we should replace it with document.documentElement.scrollTop or scrollLeft. // It means that we should use IHTMLDocuemnt3::get_documentElement::scrollTop //———————————————————————————– CComQIPtr<IHTMLDocument3> cpDocument3 = cpDocument2; CComPtr<IHTMLElement> cpDocumentElem; CComQIPtr<IHTMLElement2>cpDocumentElem2; cpDocument3->get_documentElement(&cpDocumentElem); cpDocumentElem2 = cpDocumentElem; long xScr = 0, yScr = 0; cpDocumentElem2->get_scrollLeft(&xScr); cpDocumentElem2->get_scrollTop(&yScr); ptLocal.Offset(xScr, yScr); CComPtr<IHTMLElement> cpChildElem = cpElem; while(1) { long x = 0, y = 0; cpChildElem->get_offsetTop(&y); cpChildElem->get_offsetLeft(&x); ptLocal.x -= x; ptLocal.y -= y; CComPtr<IHTMLElement> cpParentElem; cpChildElem->get_offsetParent(&cpParentElem); if(cpParentElem == NULL) break; cpChildElem = cpParentElem; } //—————————————————- // Find the children-element of the frame recursively. //—————————————————- CString strChildFind; if(!FindElement(CComQIPtr<IWebBrowser2>(cpElem), ptLocal)) return FALSE; } else { m_cpResult = cpElem; } return TRUE; }
     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s