<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx</link><description>Hello everyone, My name is Raman Sharma and I am a PM on the VC++ IDE team. I want to talk about a new feature called Call Hierarchy in Visual Studio 10. As the name suggests, it is used for navigating all functions called from within a particular function</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9728410</link><pubDate>Fri, 12 Jun 2009 03:52:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9728410</guid><dc:creator>rtanabe</dc:creator><description>&lt;p&gt;Please, code snippets for VC++ (like C#, VB)&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9731491</link><pubDate>Fri, 12 Jun 2009 11:07:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9731491</guid><dc:creator>fabio</dc:creator><description>&lt;p&gt;Nice improvements, I would like to copy and paste also from the left pane (the tree). Will it be possible?&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9732101</link><pubDate>Fri, 12 Jun 2009 12:15:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9732101</guid><dc:creator>Sam Martin</dc:creator><description>&lt;p&gt;Thanks. Sounds very nice. &lt;/p&gt;
&lt;p&gt;However, the primary reason I don't use the existing call browser in 2005/8 is because its too slow in practice. &lt;/p&gt;
&lt;p&gt;In comparison I can trigger a &amp;quot;find in files..&amp;quot; search in a few key presses that effectively gives me the same information but much faster, albeit in an unorganised list.&lt;/p&gt;
&lt;p&gt;Incidentally, the same performance issue applies to other features such as a the class browser. &lt;/p&gt;
&lt;p&gt;Is the team addressing the performance issues in VS?&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9734963</link><pubDate>Fri, 12 Jun 2009 17:30:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9734963</guid><dc:creator>Joe</dc:creator><description>&lt;p&gt;May I suggest using different icons for the &amp;quot;Call from&amp;quot; and &amp;quot;Call to&amp;quot; nodes in your tree, just to make them stand out better?&lt;/p&gt;
&lt;p&gt;Although, like Sam, I never use it the existing feature. I mostly need to know who is calling a functions, and for that I just do a quick &amp;quot;Find in files...&amp;quot; on my large C++ project. &lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9735255</link><pubDate>Fri, 12 Jun 2009 18:02:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9735255</guid><dc:creator>CMC</dc:creator><description>&lt;p&gt;Is there any chance that the underlying data can be exposed to enable something like &amp;quot;Give me a list of functions that aren't called from anywhere?&amp;quot;&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9736081</link><pubDate>Fri, 12 Jun 2009 19:59:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9736081</guid><dc:creator>Raman Sharma [msft]</dc:creator><description>&lt;p&gt;Thanks for your comments.&lt;/p&gt;
&lt;p&gt;@fabio: copy/paste of the tree from left pane right now is not possible. &amp;nbsp;Individual nodes however can be copied and pasted. &amp;nbsp;I can see the value in copying the tree and then pasting it in a text-tree format. &amp;nbsp;We can certainly consider it for future.&lt;/p&gt;
&lt;p&gt;@Sam:&lt;/p&gt;
&lt;p&gt;@Joe: &amp;quot;Find in Files&amp;quot; is a grep of the text in files and will give you a lot of extraneous results (i.e. things that are not function calls or things that are not exactly what you specified). &amp;nbsp;Results from Call Hierarchy are effectively verified with the compiler for accuracy. &amp;nbsp;For example, if you do a &amp;quot;Calls To&amp;quot; for Start in MyClass::Start, it will never return result for YourClass::Start. &amp;nbsp;Doing this will off course require extra computation and hence the slowdown. &amp;nbsp;But, rest assured we have done work in this release to improve the performance and you will see the results soon. &amp;nbsp;And yes, we do have plans for different icons for &amp;quot;Calls To&amp;quot; and &amp;quot;Calls From&amp;quot;&lt;/p&gt;
&lt;p&gt;@CMC: Very interesting. &amp;nbsp;If this type of a problem is to be solved in the design-time space (IDE, IntelliSense, Navigation, Browsing etc.), I can see it becoming a huge performance issue. &amp;nbsp;Imagine what you need to do: Identify all functions inside your code, perform a &amp;quot;Calls To&amp;quot; for all the functions, and then list those for which &amp;quot;Calls To&amp;quot; returns zero results. &amp;nbsp;That's why, I guess this kind of information is better found through analysis of the binaries etc.&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9738924</link><pubDate>Fri, 12 Jun 2009 23:43:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9738924</guid><dc:creator>Phil</dc:creator><description>&lt;p&gt;I would like a graphical view that shows each function as a node with calls being edges on a graph. It would be cool to see the whole graph at once to visualize the program's call structure.&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9746278</link><pubDate>Sun, 14 Jun 2009 00:59:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9746278</guid><dc:creator>Olivier Hamel</dc:creator><description>&lt;p&gt;I second that suggestion, a graphical view would indeed be useful.&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9752008</link><pubDate>Mon, 15 Jun 2009 06:54:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9752008</guid><dc:creator>Royal</dc:creator><description>&lt;p&gt;A few things that would be nice would be the ability to regain control of the UI when doing remote debugging, or have it allow you to use the editor when the remote debugger disconnects (like if you are debugging in windbg on the kernel and are reviewing the code in VS while debugging the usermode code as well). Or if a network issue comes up that VS doesnt just lock up, or even lag on a remote network issue, that you can still do something.&lt;/p&gt;
&lt;p&gt;Also, is there a reason it has to chew up &amp;gt; 128Megs just to be a intelligent text editor? or even runaway up to a gig+ after extended usage (&amp;gt;6-8 hours of dev time?). Or perhaps when debugging GDI+ objects that it can really eat up memory?&lt;/p&gt;
&lt;p&gt;How about the ability to move code from VS 2005 to VS 2008 and still have the same STL functions work? or even have the SHBrowseForFolder function work when called twice (works with VS2005 compiled code, but in VS2008 random crashes, and just nutty). It completely destabilized the code that was rock solid, and all that was done was move from 2005 to 2008. When it crashed, it was always inside of either the STL call function, or an internal call function (6-7 calls deep outside of our code). Obviously we had to go back to 2005 where we are now and its completely stable, but because the random crashes just made it unusable in 2008.&lt;/p&gt;
&lt;p&gt;Oh, and using STL file calls are still limited to 2GB (size_t/signed integer), so doing file IO using fstream on larger objects isnt realistic unless you want to redefine that. Minor item, but still an annoyance, 2GB+ files are quite realistic these days.&lt;/p&gt;
&lt;p&gt;How about an option to allow the toolbar stay collapsed when moused over (as autohide is very nice, but is a nuisance when you hit that right side line of code and mouse over accidentially). Yes, could easily disble autohide, but having the toolbar on that side is actually quite useful for DB connects as well as the tool objects themselves. &lt;/p&gt;
&lt;p&gt;The #1 reason I use VS as my preferred editor is because I can get to things fast, look up objects and cross reference quickly. But the newer versions scare me quite a bit because moving up to new platforms seems to have quite a bit of pain, especially when using the same documented calls. Back in VC6 -&amp;gt; VS.net it was understandable, but now?&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9752270</link><pubDate>Mon, 15 Jun 2009 09:47:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9752270</guid><dc:creator>SvenC</dc:creator><description>&lt;p&gt;@Royal,&lt;/p&gt;
&lt;p&gt;what is your SHBrowseForFolder code? This is a windows function, so the VS version cannot make the difference here. There must be some fault in how you call or use it.&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9752937</link><pubDate>Mon, 15 Jun 2009 14:47:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9752937</guid><dc:creator>Sam Martin</dc:creator><description>&lt;p&gt;@Raman Sharma&lt;/p&gt;
&lt;p&gt;Thanks very much for your feedback.&lt;/p&gt;
&lt;p&gt;I understand a find in files isn't accurate. However it is accurate enough in practice. It actually serves to underline my point: Ultimately this tool is meant to speed up my development. A search, even with false positives is faster - and therefore more suitable - than an accurate tool that is slow. Performance really is critical.&lt;/p&gt;
&lt;p&gt;I think CMC makes a good point. This is functionality I would be interested in. Incidentally, it's also something I can get a draft version from with some crude parsing (unreferenced functions typically only have two entries - the .h and .cpp). The implementation you propose would indeed be very slow. Are there not faster implementations that would produce useful data?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Sam&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9753617</link><pubDate>Mon, 15 Jun 2009 18:44:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9753617</guid><dc:creator>John Marduk</dc:creator><description>&lt;p&gt;Who cares about new features when you folks can't even get intellisense working? What about refactoring &amp;amp; syntax formatting?&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9753756</link><pubDate>Mon, 15 Jun 2009 19:45:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9753756</guid><dc:creator>Royal</dc:creator><description>&lt;p&gt;Pretty simple clean cut code, and in 2005 works great. in 2008 unpredictable crashing.&lt;/p&gt;
&lt;p&gt;BROWSEINFO m_brinfo; (in the .h of CFolderDialog as its a skinned holder)&lt;/p&gt;
&lt;p&gt;CFolderDialog::CFolderDialog(CWnd* pWnd)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	bCoInitSucceeded = (CoInitialize(NULL) == S_OK);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;CFolderDialog::~CFolderDialog()&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	if (bCoInitSucceeded) { CoUninitialize (); }&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;LRESULT CStatusMsgDlg::PopPathDialog(WPARAM wParam, LPARAM lParam)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	CFolderDialog dlg(this);&lt;/p&gt;
&lt;p&gt;	PWCHAR pwcPath = (PWCHAR) wParam;&lt;/p&gt;
&lt;p&gt;	(void) dlg.BrowseForFolder(L&amp;quot;Please Select the installation Path&amp;quot;, BIF_NEWDIALOGSTYLE | BIF_VALIDATE, pwcPath, TRUE);&lt;/p&gt;
&lt;p&gt;	SetEvent((HANDLE) lParam); // set the event to allow the app to continue&lt;/p&gt;
&lt;p&gt;	return 0;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;LPCITEMIDLIST CFolderDialog::BrowseForFolder(LPCTSTR title, UINT flags, LPWSTR csRoot, BOOL /*bFilter*/)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	m_brinfo.lpszTitle = title;&lt;/p&gt;
&lt;p&gt;	m_brinfo.ulFlags = flags;&lt;/p&gt;
&lt;p&gt;	m_brinfo.lpfn = CallbackProc;&lt;/p&gt;
&lt;p&gt;	m_brinfo.lParam = (LPARAM)this;&lt;/p&gt;
&lt;p&gt;	m_sSelFolder = csRoot;&lt;/p&gt;
&lt;p&gt;	LPCITEMIDLIST pidl = SHBrowseForFolder(&amp;amp;m_brinfo); // do it (Crash happens in this call 2008)&lt;/p&gt;
&lt;p&gt;	return pidl;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;int CALLBACK CFolderDialog::CallbackProc(HWND hwnd, UINT msg, LPARAM lp, LPARAM lpData)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	CFolderDialog* pDlg = (CFolderDialog*)lpData;&lt;/p&gt;
&lt;p&gt;	ASSERT(pDlg);&lt;/p&gt;
&lt;p&gt;	if (pDlg != NULL) {&lt;/p&gt;
&lt;p&gt;		if (pDlg-&amp;gt;m_hWnd!=hwnd) { pDlg-&amp;gt;m_hWnd = hwnd; };&lt;/p&gt;
&lt;p&gt;		return pDlg-&amp;gt;OnMessage(msg, lp);&lt;/p&gt;
&lt;p&gt;	}&lt;/p&gt;
&lt;p&gt;	return 0;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;int CFolderDialog::OnMessage(UINT msg, LPARAM lp)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	switch (msg) {&lt;/p&gt;
&lt;p&gt;	case BFFM_INITIALIZED:&lt;/p&gt;
&lt;p&gt;		OnInitialized();&lt;/p&gt;
&lt;p&gt;		return 0;&lt;/p&gt;
&lt;p&gt;	case BFFM_SELCHANGED:&lt;/p&gt;
&lt;p&gt;		OnSelChanged((LPCITEMIDLIST)lp);&lt;/p&gt;
&lt;p&gt;		return 0;&lt;/p&gt;
&lt;p&gt;	case BFFM_VALIDATEFAILED:&lt;/p&gt;
&lt;p&gt;		return OnValidateFailed((LPCTSTR)lp);&lt;/p&gt;
&lt;p&gt;	default:&lt;/p&gt;
&lt;p&gt;		TRACE(L&amp;quot;***Warning: unknown message %d in CFolderDialog::OnMessage\n&amp;quot;);&lt;/p&gt;
&lt;p&gt;	}&lt;/p&gt;
&lt;p&gt;	return 0;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9753761</link><pubDate>Mon, 15 Jun 2009 19:48:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9753761</guid><dc:creator>Royal</dc:creator><description>&lt;p&gt;&amp;quot;intellisense&amp;quot; -- what would be great is at least the ability to purge and reset intellisense so that it can work again when it dies instead of having to get out, delete the ncb and get back in.&lt;/p&gt;
&lt;p&gt;I find it dies on me quite a bit, and the deeper my code subclasses and inherits the worse it gets.&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9754225</link><pubDate>Mon, 15 Jun 2009 20:46:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9754225</guid><dc:creator>SvenC</dc:creator><description>&lt;p&gt;@Royal,&lt;/p&gt;
&lt;p&gt;read about CoInitialize here: you need to call CoUninitialize for CoInit == S_FALSE as well. So bCoInitSucceeded = SUCCEEDED(CoInitialize(NULL)) would be better. But: when you read the remarks section I would count it &amp;quot;dangerous&amp;quot; to call it in the middle of a program as you cannot make sure that if your thread is the first CoInit caller that it will be the last CoUninit caller as well - in fact you call CoUninit as soon as you destructor runs. If you control the exe as well you should CoInit somewhere early during app startup and CoUninit before it ends. When using COM in your own threads call CoInit at the beginning of your thread proc and CoUninit at its end - be sure to have Released all COM pointers used in that thread before calling CoUninit.&lt;/p&gt;
&lt;p&gt;You do not free the returned PIDL which you should with CoTaskMemFree if != NULL.&lt;/p&gt;
&lt;p&gt;You might likely have a multithread issue. I guess you do some multithread stuff due to your call to SetEvent.&lt;/p&gt;
&lt;p&gt;So I guess there are still some places where crashes could be caused by your code rather than by VC9. Just because your code runs compiled with VC8 does not say that it is correct.&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9754310</link><pubDate>Mon, 15 Jun 2009 21:14:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9754310</guid><dc:creator>S. Colcord</dc:creator><description>&lt;p&gt;@Raman:&lt;/p&gt;
&lt;p&gt;How does the Call Hierarchy handle dynamically-bound function calls (either through function pointers or virtual functions)?&lt;/p&gt;
&lt;p&gt;While it can't statically identify a dynamic call, it seems like it could at least list everywhere that there's a potential vtable match, or where the address of the function (or its virtual signature) is taken. &amp;nbsp;If the call hierarchy doesn't include potential dynamic calls, I'll still have to do a file text search to make sure not to miss them.&lt;/p&gt;
&lt;p&gt;Also, if the function is exported from a DLL, is that noted? &amp;nbsp;It seems like it would be worth emphasizing that this function signature may have external callers.&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9754371</link><pubDate>Mon, 15 Jun 2009 21:43:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9754371</guid><dc:creator>Royal</dc:creator><description>&lt;p&gt;I do Coinit at app start up and end. As this class is instantiated with the new thread created, I CoInit with the new thread at creation of the class object and remove at the thread's termination at the class object teardown. That said, when I remove the Coinit/uninit as I do it at thread startup as well as freeing up the returned PIDL. compile with VS2008, I get the same crash result in the same place internal to that call.&lt;/p&gt;
&lt;p&gt;The application is heavily multithreaded, but the path to this code is not at all. That said, there are specific reasons to using the SetEvent. This function is an 'up front' decision before a majority of the multithreading kicks in.&lt;/p&gt;
&lt;p&gt;I free my pidl with the documentation's method:&lt;/p&gt;
&lt;p&gt;CComQIPtr&amp;lt;IMalloc&amp;gt; iMalloc;	// shell's IMalloc&lt;/p&gt;
&lt;p&gt;HRESULT hr = SHGetMalloc(&amp;amp;iMalloc);&lt;/p&gt;
&lt;p&gt;ASSERT(SUCCEEDED(hr));&lt;/p&gt;
&lt;p&gt;iMalloc-&amp;gt;Free((void*)pidl);&lt;/p&gt;
&lt;p&gt;Unless using CoTaskMemFree is better?&lt;/p&gt;
&lt;p&gt;However this is what scares me: &amp;quot;So I guess there are still some places where crashes could be caused by your code rather than by VC9. Just because your code runs compiled with VC8 does not say that it is correct.&amp;quot;&lt;/p&gt;
&lt;p&gt;In one way its good, but in another, its bad because you almost have to go through a complete comprehensive code review when going from VC8 to VC9 because the output will be unpredictable. This may sound trivial, but when scouring over 50k of code, that can take quite a bit of time, even for a single developer.&lt;/p&gt;
&lt;p&gt;Its kind of funny, but in the windows drivers writing world, you really do not deal with much of this, which is why many of them chuckle at what many deal with in the win32 side.&lt;/p&gt;
&lt;p&gt;Its always easy to shrug it off to the developer and say poor practice, but when a product works 100% stable in its environment, then you upgrade to the next environment on functions you do not control and they change their behaviour, it tends to scare and prevent many from changing it. Many developers do not have the luxury of doing a full review of their own code to ensure compatibility with a new version of the development environment just to gain some new tools and shortcuts. &lt;/p&gt;
&lt;p&gt;Some more pragma warnings or documented areas of where things may have changed would make life a lot easier, and increase confidence because nothing is worse than chasing down a bug in code that has worked forever, and suddenly stops working when you link it against a newer external library that you did not write.&lt;/p&gt;
&lt;p&gt;Developers want to use the latest and greatest, especially if it makes their lives easier and increases productivity, but in the end we code to make applications, not code to use the development environment.&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9754372</link><pubDate>Mon, 15 Jun 2009 21:44:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9754372</guid><dc:creator>Royal</dc:creator><description>&lt;p&gt;And one last thing. Thank you for responding. It may not seem appreciative from many at times, but even the smallest amounts of feedback go a long way. I'm sure you may remember what it was like on the other side of the fence before your days there.&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9754832</link><pubDate>Mon, 15 Jun 2009 22:48:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9754832</guid><dc:creator>SvenC</dc:creator><description>&lt;p&gt;@Royal: But you are not saving the return value of dlg.BrowseForFolder, which is the PIDL, so you cannot free it.&lt;/p&gt;
&lt;p&gt;Another problem I see: you do not assign a buffer to m_brinfo.pszDisplayName. That is an out buffer, which should have space for at least MAX_PATH TCHARs. Could it be that this member points to garbage and hence SHBrowseForFolder fails randomly.&lt;/p&gt;
</description></item><item><title>VS Project, C++ and Editor team blogs</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9754986</link><pubDate>Mon, 15 Jun 2009 22:56:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9754986</guid><dc:creator>Kirill Osenkov</dc:creator><description>&lt;p&gt;This is just a quick announcement about some Visual Studio team blogs that might be really worth checking&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9755199</link><pubDate>Mon, 15 Jun 2009 23:07:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9755199</guid><dc:creator>Stephan T. Lavavej [MSFT]</dc:creator><description>&lt;p&gt;[Royal]&lt;/p&gt;
&lt;p&gt;&amp;gt; Oh, and using STL file calls are still limited to 2GB&lt;/p&gt;
&lt;p&gt;This should be fixed in VC10 Beta 1. Please try it out, and file a Connect bug if our fix was incomplete.&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9755928</link><pubDate>Tue, 16 Jun 2009 00:06:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9755928</guid><dc:creator>Royal</dc:creator><description>&lt;p&gt;It wasnt m_brinfo.pszDisplayName. I initialized it, and it was filling it with info, but same result. &lt;/p&gt;
&lt;p&gt;Now that I've decided to put hour into it and really check everything, I can tell you the crashing bug occurs when you change the path a second time.&lt;/p&gt;
&lt;p&gt;It is an update bug while drawing / updating the edit box portion of the dialog control invoked by SHBrowseForFolder. Each time it can be a little different, but basically the first couple times its run, it accesses a NULL window handle in the CWnd class for the editbox of the selection dialog. Other times, it fails to get the handle to the device context to determine the text extent GetOutputTextExtent.&lt;/p&gt;
&lt;p&gt;Easily reproduced by simply changing the path in the lower box the second time. First time always works and is clean.&lt;/p&gt;
&lt;p&gt;I do custom skinning on my objects, so I'm very familiar with how this works because its an interesting experience for any win32 coder doing UI work. That said, this one I do not do, its straight win32 stuff because I didnt want to write a custom path browser.&lt;/p&gt;
&lt;p&gt;@Stephan - I'll check it out on my old versioned code as I had to rewrite all of my STL file IO calls from 15 classes, but I still have the old code that should still work fine in SVN.&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9756003</link><pubDate>Tue, 16 Jun 2009 00:24:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9756003</guid><dc:creator>SvenC</dc:creator><description>&lt;p&gt;Hi Royal,&lt;/p&gt;
&lt;p&gt;not sure if I understood. Did you find the bug and solved it or did you describe what you think is the bug in SHBrowseForFolder? If the latter, I do not know what SHBrowseForFolder has to do with a CWnd? shlwapi.dll (where SHBFF lives in) does not use MFC where CWnd belongs to.&lt;/p&gt;
&lt;p&gt;What do you mean by &amp;quot;changing the path in the lower box the second time&amp;quot;? How and where do you change a path? And how does that cause a crash? You might need to show some more code.&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9756115</link><pubDate>Tue, 16 Jun 2009 01:15:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9756115</guid><dc:creator>Royal</dc:creator><description>&lt;p&gt;It is not solved, I found the bug.&lt;/p&gt;
&lt;p&gt;SHBrowseForFolder says in the docs: This function displays a dialog box that allows a user to select a folder.&lt;/p&gt;
&lt;p&gt;So that means it creates a dialog box, which last time I checked CDialog derives from the CWnd class. That would be how it relates to CWnd.&lt;/p&gt;
&lt;p&gt;If you put BIF_USENEWUI (which according to the docs is BIF_EDITBOX | BIF_NEWDIALOGSTYLE) and as a result BIF_EDITBOX by definition is: Include an edit control in the browse dialog box that allows the user to type the name of an item.&lt;/p&gt;
&lt;p&gt;So thats how I get the editbox which when you type anything in there will call its native functions, thus the crash, which is completely inside of that function's call since it is created and managed by SHBrowseForFolder. I do not override any of its drawing controls or even try to.&lt;/p&gt;
&lt;p&gt;Crash is: Unhandled exception at 0x77a39d80: 0xc0000005 - Access violation reading location 0x43790eec&lt;/p&gt;
&lt;p&gt;Which is in shdocvw.dll with module space:&lt;/p&gt;
&lt;p&gt;	shdocvw.dll	C:\WINDOWS\SysWOW64\shdocvw.dll	N/A	N/A	No symbols loaded.		64	6.00.3790.4134 (srv03_sp2_gdr.070817-0047)	8/18/2007 11:54 AM	77980000-77AF3000	[4436] BRWC_DEBUG.exe: Native	&lt;/p&gt;
&lt;p&gt;which this time was something different, but last 2 times it went to HDC and HWND.&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9756230</link><pubDate>Tue, 16 Jun 2009 02:05:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9756230</guid><dc:creator>Royal</dc:creator><description>&lt;p&gt;As for it not using MFC, a small inspection reports that it is comprised of a window, 4 static controls, 1 edit, 3 buttons, a scrollbar and a SysTreeView32. So MFC does not apply here, but it is indeed a window and it only crashes when you make a change in the Edit control owned by that window created by that call.&lt;/p&gt;
&lt;p&gt;This is actually getting off topic, which is why things break from VS2005 to VS2008 without a source code change.&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9756304</link><pubDate>Tue, 16 Jun 2009 02:30:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9756304</guid><dc:creator>Royal</dc:creator><description>&lt;p&gt;On a final note before I go and write one from scratch. The issue happens when you select the path and replace it by typing / replace.&lt;/p&gt;
&lt;p&gt;So lets say the editbox has C:\Program files\Stuff&lt;/p&gt;
&lt;p&gt;and you highlight C:\program files&lt;/p&gt;
&lt;p&gt;Then press the letter R (as if to change to R:\stuff)&lt;/p&gt;
&lt;p&gt;It will crash right after pressing the letter R.&lt;/p&gt;
&lt;p&gt;If you click in the editbox and type the path in (without selecting or highlighting any text) it works perfect every time.&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9759185</link><pubDate>Tue, 16 Jun 2009 09:15:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9759185</guid><dc:creator>SvenC</dc:creator><description>&lt;p&gt;Do you do m_brinfo.pszDisplayName = &amp;quot;some path&amp;quot;? That is not correct as the compiler could assign read only memory. Use TCHAR path[MAX_PATH]; lstrcpy(path, &amp;quot;some path&amp;quot;); m_brinfo.pszDisplayName = &amp;amp;path[0];&lt;/p&gt;
&lt;p&gt;Also make sure that you set all members of m_brinfo correctly whenever you call SHBFF, not only on the first call.&lt;/p&gt;
&lt;p&gt;I count this on topic if it shows that you relied on faulty code or undefined behaviour.&lt;/p&gt;
&lt;p&gt;But you are right that it is OT here. We could continue in a newsgroup like microsoft.public.vc.language if you want.&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9759241</link><pubDate>Tue, 16 Jun 2009 09:50:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9759241</guid><dc:creator>Royal</dc:creator><description>&lt;p&gt;All parms are always set the same way.&lt;/p&gt;
&lt;p&gt;m_brinfo.pszDisplayName = new WCHAR[MAX_PATH];&lt;/p&gt;
&lt;p&gt;ZeroMemory(m_brinfo.pszDisplayName, sizeof(WCHAR)*MAX_PATH);&lt;/p&gt;
&lt;p&gt;pszDisplayName receives the display name of the folder that I select. If I were to at least see a BFFM_SELCHANGED message hit that would be better, but we dont even get that far&lt;/p&gt;
&lt;p&gt;But remember, it only happens if I select the text and hit a key to replace it. From what i've seen on the crashes, it is trying to get the textextent to redraw it back into the control (since you would use textextent to determine the width of text so you can draw it inside of your control's space correctly), but somehow gets lost and either cant find the window, device context, or object. When it screwed up on the DC at the extent call, it had the correct number of chars and info to the caller.&lt;/p&gt;
&lt;p&gt;It doesnt happen before or after, its precisely in the same place doing that 1 method. I can delete the text, I can add to it, i can maneuver around it, but if I highlight it and replace with a key, it crashes. No extra messages, last WM to the control is VKEY press itself.&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9759302</link><pubDate>Tue, 16 Jun 2009 10:27:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9759302</guid><dc:creator>SvenC</dc:creator><description>&lt;p&gt;I created a Win32 app with the VS2008 wizard. Added a menu and in the WndProc for that menu command I added:&lt;/p&gt;
&lt;p&gt;BROWSEINFO brinfo;&lt;/p&gt;
&lt;p&gt;ZeroMemory(&amp;amp;brinfo, sizeof(brinfo));&lt;/p&gt;
&lt;p&gt;brinfo.hwndOwner = hWnd;&lt;/p&gt;
&lt;p&gt;brinfo.lpszTitle = _T(&amp;quot;Test SHBFF&amp;quot;);&lt;/p&gt;
&lt;p&gt;brinfo.pszDisplayName = new TCHAR[MAX_PATH];&lt;/p&gt;
&lt;p&gt;brinfo.pszDisplayName[0] = 0;&lt;/p&gt;
&lt;p&gt;brinfo.ulFlags = BIF_USENEWUI | BIF_VALIDATE;&lt;/p&gt;
&lt;p&gt;PIDLIST_ABSOLUTE pidl = SHBrowseForFolder(&amp;amp;brinfo);&lt;/p&gt;
&lt;p&gt;MessageBox(hWnd, brinfo.pszDisplayName, _T(&amp;quot;show SHBFF&amp;quot;), MB_OK);&lt;/p&gt;
&lt;p&gt;delete [] brinfo.pszDisplayName;&lt;/p&gt;
&lt;p&gt;CoTaskMemFree(pidl);&lt;/p&gt;
&lt;p&gt;I can call that menu command as often as I want, I can select the edit box text in any ways and press a key without any error no matter how often it is called.&lt;/p&gt;
&lt;p&gt;Try it for yourself, it is done in 5 minutes and you see that SHBFF has no problems.&lt;/p&gt;
&lt;p&gt;I wonder why you know all the details of the implementation of SHBFF like getting the textextent or trying to get to a window or device context? I guess you are doing something wrong in the callback function or by hooking, subclassing or some fancy stuff.&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9762547</link><pubDate>Tue, 16 Jun 2009 18:40:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9762547</guid><dc:creator>Royal</dc:creator><description>&lt;p&gt;In this case, there was nothing fancy. No hooking, subclassing, or anything. Just a &amp;nbsp;straight call. Like I mentioned before, I didnt want to have to write one.&lt;/p&gt;
&lt;p&gt;I'm a little surprised you would ask about the details of textextent and controls. If you have ever built an editbox control with or without multiline, its the basic '101' fundamental of accomplishing it.&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9762561</link><pubDate>Tue, 16 Jun 2009 18:50:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9762561</guid><dc:creator>SvenC</dc:creator><description>&lt;p&gt;But how could you possibly know any details of the implementation of SHBFF? It handles its dialog all on its own and the implementation is hidden in shlwapi. I do not understand how you could know which part of that shlwapi code causes your crash - nobody of us has source code for that.&lt;/p&gt;
&lt;p&gt;I used SHBFF before without errors and my test app did show no errors. I am still absolutely sure that the crash is caused by code external to SHBFF - most likely your code except you have installed an app which hooks into windows standard controls.&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9762806</link><pubDate>Tue, 16 Jun 2009 20:59:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9762806</guid><dc:creator>Raman Sharma [msft]</dc:creator><description>&lt;p&gt;@ S. Colcord:&lt;/p&gt;
&lt;p&gt;Admittedly the support for dynamically-bound function calls is not as efficient as it should have been. &amp;nbsp;For virtual functions, we list the calls based on type of the pointer rather than the object. &amp;nbsp;And the calls using function pointers are not listed. &amp;nbsp;This is one of the areas we had much discussion about while designing the feature. &amp;nbsp;Hopefully we will improve it in future.&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9762950</link><pubDate>Tue, 16 Jun 2009 22:39:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9762950</guid><dc:creator>Royal</dc:creator><description>&lt;p&gt;@SvenC - I've already told you that there is no hooking or anything fancy, but you are just in utter disbelief.&lt;/p&gt;
&lt;p&gt;I dont see a [msft] tag behind your name, so I'm going to write off your lack of basic debugging knowledge, and how basic windows control work internally. &lt;/p&gt;
&lt;p&gt;If you are with MS, then its quite shameful the elitist type of responses provided that its simply impossible the code could never have an issue. &lt;/p&gt;
&lt;p&gt;I dont need to know how SHBFF works because working with an edit control is always done the same basic way. In rough steps, you take your text, you measure it against the font (TextExtent) and compensate for largefont sizing, then clip off what will not fit, Draw it into the area. Pretty simple. And I also do not need source to use a checked build of the OS and look at assembly calls if I really want to dig into an issue.&lt;/p&gt;
&lt;p&gt;But I've wasted enough time on this and with you. Do your research into how controls work and how you actually draw them. I'm now remembering why I do not give detailed feedback because it is only met with arrogance and without any interest if there could possibly be a problem. My resolve, and im sure many other developers, is to simply not use the newer products and write the controls that I need for my market if the ones provided have any issues.&lt;/p&gt;
&lt;p&gt;Best wishes.&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9763004</link><pubDate>Tue, 16 Jun 2009 22:52:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9763004</guid><dc:creator>SvenC</dc:creator><description>&lt;p&gt;@Royal, I'm not working for MS just with MS technology. I'm sorry that you are not willing to understand that SHBFF has no bug. It is used in many, many apps which do not crash by calling it. Sorry if I sounded arrogant - I only wanted to help you find the real cause of the problem. Good luck to get your code straight.&lt;/p&gt;
</description></item><item><title>re: Call Hierarchy</title><link>http://blogs.msdn.com/vcblog/archive/2009/06/11/call-hierarchy.aspx#9807007</link><pubDate>Sun, 28 Jun 2009 05:22:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9807007</guid><dc:creator>Ben Voigt [C++ MVP]</dc:creator><description>&lt;p&gt;This feature needs to go beyond just functions. &amp;nbsp;Just like the browser has &amp;quot;Goto Declaration&amp;quot; and &amp;quot;Next Reference/Prev Reference&amp;quot; for variables, you should be able to use this tree for them as well.&lt;/p&gt;
&lt;p&gt;Take a look at Lutz Roeder's .NET Reflector (now maintained by Red Gate Software) and the Analyze option it provides.&lt;/p&gt;
&lt;p&gt;And I definitely think that identification of dead code should be done at design time, but I also agree that you can use the compiler instead of source code parsing (i.e. no need for the analysis to work with code that doesn't compile, which is the difference between Intellisense and the browser database created by the compiler). &amp;nbsp;It should use the browser database, not run against the binary, because the type information is important as already noted with indirect calls.&lt;/p&gt;
</description></item></channel></rss>