# Thursday, 12 June 2008

How can you avoid the UAC prompt for applications you frequently run? Well, you could turn off UAC entirely, but that's a bad plan. There are two ways: one is realistic and feasible, and one much less so.

The less feasible one is that you could re-enable the Administrator account (not just some account you happen to have that is in the Adminstrators group, but the actual Administrator account) and log on as that. Pretty much everything you do will be elevated and you won't be prompted about it. But I don't want to do that. I want to log on as me. Plus, I kind of want to control my prompt-noprompt life, or we're right back to malware using my powers without me knowing.

So here's my solution. Get yourself an elevated command prompt (Start menu, spot a command prompt shortcut, right click, Run as Administrator.) Consent once and for all (till your next boot) to elevating that prompt. Now everything you launch from there is elevated, no prompt. Don't believe me? Try regedit. Try notepad. Then try, say, editing your hosts file with that notepad. Cool, no?

Leave the elevated command prompt open, and use it whenever you want to do something elevated. No prompting. You have to type the name of the app (Visual Studio is devenv, which you will care if you're still using 2005.) But pretty painless.

Kate

Thursday, 12 June 2008 21:28:29 (Eastern Daylight Time, UTC-04:00)  #    Comments [0]
# Wednesday, 11 June 2008

If you've ever watched Star Trek: The Original Series you know it had a trope or a meme where an "away team" would beam down to the planet and suddenly one of them would be killed. Usually vapourized or dragged off by a yeti or somesuch. And as my four year old once said to me "Red people fall down. Not red people don't fall down." This is also known as the redshirt phenomenon. To this day, when I see three main characters (on any show) plus some guy we've never seen before, someone is sure to call that guy out as a red shirt just as the suspenseful music starts to rise.

Well, Matt Bailey has run the math. Are red-shirted crewmen more likely to die than yellow or blue shirts? Indubitably. But - is it good news or bad news, redshirt-wise, if the episode also features what I've always referred to as Kirk putting his boots on, though strictly speaking he does that after the plot point Matt refers to as "meeting" alien women. See how some solid data analysis and well chosen visuals can truly illustrate the redshirt phenomenon on Star Trek, at least for TOS. The powerpoints alone are worth the click.

Kate

Wednesday, 11 June 2008 18:53:20 (Eastern Daylight Time, UTC-04:00)  #    Comments [0]
# Tuesday, 10 June 2008

Have you seen the Deep Zoom example with the Hard Rock Cafe artifacts? It's pretty darn cool. If you don't have Silverlight and would like to see why it's cool, there's a video on the Mix blog. But I love the zooming into Virtual Earth example I was just sent. It's a CodePlex project, so you can be part of it. It can take a while to load so be patient. I showed it to someone who said that Google Earth did that, but requires downloading and installing an application. If you already have Silverlight, you don't need anything else to use this. I like that.

Kate

Tuesday, 10 June 2008 18:43:49 (Eastern Daylight Time, UTC-04:00)  #    Comments [0]
# Monday, 09 June 2008

I've been carrying this link around for a while and it seems like a good time to share it. Rico Mariani knows a LOT about performance and why it's important. And he knows that many of us no longer care. We trust optimizers and runtimes and frameworks and auto-caches and such to take care of things for us. Sometimes, we're right to do that. Other times, we're not. Thinking about games will naturally make you think about performance.

Kate

Monday, 09 June 2008 18:24:50 (Eastern Daylight Time, UTC-04:00)  #    Comments [0]
# Sunday, 08 June 2008

One of the questions I got in the booth at Tech Ed was about First Chance Exceptions. The attendee was getting these messages in the output window in Visual C++ warning about "first chance exception" and was concerned about it. A long-long-neglected neuron fired. I think I ran an article in a journal I edited 10 or so years ago in which Mike Blaszczak covered this. And I think the bottom line was "don't worry." So I ran a quick search and found this knowledge base article that indeed says "don't worry." The debugger gets the exception first, before your code. It just writes to the screen that it got it. Then your code handles the exception and life goes on as before. If your code doesn't handle the exception, then the debugger gets it again, and then perhaps something interesting happens. But first chance exceptions are nothing.

Having a long memory for tiny details is handy sometimes.

Kate

Sunday, 08 June 2008 18:20:53 (Eastern Daylight Time, UTC-04:00)  #    Comments [0]
# Saturday, 07 June 2008

UAC prompts you whenever you do something that requires your administrator privileges, with a couple of exceptions I'll get to later. Part of not being driven crazy by UAC is coming to expect that prompt. When you choose particular menu items or click particular buttons, you are warned with the shield:

  

What lots of people don't spot is that some executables are also marked with the shield. Compare these two:

One of these will get you a UAC prompt if you run it, and one won't. Once you know to look for it, it's easy to see -- at least down in the properties area with the big thumbnail. Look closely at the little icon in the main part of the window (the icon you would double click) and you'll see it, too.

What puts that icon there? What suppresses that icon? Well these two executables have manifests. One says the exection level is asInvoker and the other says requireAdministrator. So that's a pretty obvious distinction. There are other things that put the overlay there, but thery all boil down to this: if Vista plans to show you a UAC prompt (and there are reasons other than a manifest why it might) it will overlay the icon to warn you.

Remember, though, that the icon on menus and buttons and such is not magically put there by the OS. It's put there by a thoughtful programmer who likes users to know what's going on. The same sort of programmer who puts ... on menu items that will bring up a dialog (take a look at File, Save in almost any program) and omits ... on menu items that will just act (such as File, Close.). If you're programming for Vista, you need to be that kind of programmer.

Kate

Saturday, 07 June 2008 18:11:50 (Eastern Daylight Time, UTC-04:00)  #    Comments [0]
# Friday, 06 June 2008

In addition to the talks with C++ in the title (3 of them) and with C++ or a related word in the abstract (3 more) I listed in an earlier posting, I spotted this in a Tech Ed deck:

Heh. That sure isn't C#. What talk is it?

MBL302 Building Windows Mobile Applications That Work with Windows Vista Sync Center

The new Sync Center in Windows Vista will become the hub for all data synchronization between the PC, Mobile Devices, and online services. Take a closer look at the development framework, as well as the end-user experience that Sync Center helps create. This session dives into the code you need to write in order to plug your application into the Sync Center user interface. If you're writing an application for Windows today that has any synchronization components, you should not miss this session.
 
The speaker has a blog entry that states his pro-C++, pro-COM position unambiguously:
This is easy, this is Windows software development like it has been for at least 10 years. It is well defined, well known and well supported...go and learn C++ and COM, it is how many of the Windows Vista features are exposed to developers and with good reason. If you are not prepared to learn how to program your computer then you should question why you are in the software development business.
I think easy might be an overstatement, but I do certainly agree that "old style" programming techniques still have real value in the Vista universe. Keep your skills sharp!
 
Kate
 
Friday, 06 June 2008 09:20:52 (Eastern Daylight Time, UTC-04:00)  #    Comments [1]
# Thursday, 05 June 2008

How many C++ talks are there at Tech Ed this year? Well if you just run your eye down the titles, you'll see these:

MBL202 Maximizing the Usability and Compatibility of Your Mobile Microsoft Visual C++ Application

This session is targeted towards native (C++) developers. The next version of Windows Mobile will have a radical new look, with lots of new common controls and UI capabilities. This session helps you understand what you can do today to minimize backward compatibility issues. We also share many tips and best practices for improving the usability and overall quality of your mobile applications.

TLA327 Parallelize Your Microsoft Visual C++ Applications with the Concurrency Runtime

Introducing concurrency into native Visual C++ applications has long been the domain of true experts and gurus. Yet, as the hardware industry shifts toward multi-core and manycore processors, all developers will need to be able to write robust and scalable parallel applications. As part of its work on Visual C++ and Visual Studio, the Parallel Computing Platform team is building a key set of technologies that will enable the development of such applications. In this talk, we explore libraries for expressing concurrency, a set of messaging APIs that allow developers to consistently build parallel applications that are robust and resilient, and a shared user mode runtime for scheduling and for coordinating system resources. Come learn about these exciting new technologies that will help bring concurrency to the masses.

TLA403 Microsoft Visual C++ 2008 for Unrepentant C++ Developers

Visual C++ 2008 is packed full of changes for those who prefer the C++ language syntax and power. This session covers STL/CLR, the new extensible marshalling library, and changes coming in the C++ standard, specifically TR1. If templates don’t scare you, Boost has intrigued you, and you’re the one everyone turns to for mixing managed and native code, this session is for you.

But there are others, they just don't have C++ in the session title.

TLA321 Microsoft Visual Studio 2008 IDE Tips and Tricks

Harness the power of the 2008 IDE using new tips and tricks used by top Microsoft MVP developers and Microsoft employees. We look at new keyboard shortcuts, new options, the powerful "Quick Command" system, macros, tweaking IDE performance, and more that will make any developer using Visual Studio instantly more productive. The entire session is hands-on inside the IDE and applicable to any language, including Microsoft Visual Basic, Visual C#, and Visual C++. If you've been using Microsoft Visual Studio 2005 or have never touched Visual Studio, you're guaranteed to walk away a VS power user.

WIN312 Windows Presentation Foundation and Legacy Code

Yes, legacy (MFC/Win32) applications can interoperate with a Windows Presentation Foundation (WPF) user interface. Companies that have large Microsoft Visual C++ codebases can modernize their legacy applications by giving them a contemporary user interface. They can do this without having to rewrite the core of their codebase. This talk presents "best practices" for how to modify an application so that the native code operates correctly with a new WPF-based managed user interface. The talk covers such questions as "Can MFC applications move to use WPF," "Does it make more sense to rewrite or upgrade the UI," and "How do you design an interop solution between MFC/Win32 and WPF?” As the talk unfolds, it includes a number of "do's" as well as "don'ts."

TLA326 MFC Updates for Microsoft Visual Studio 2008 and Beyond

This session demonstrates the new features added to MFC in Visual Studio 2008, including support for Windows Vista Common Dialogs, Vista Common Controls, the 2007 Microsoft Office system look and feel (including support for an Office Ribbon-style interface), Office and Visual Studio-style Docking Toolbars and Tabbed Documents.


If you're here and you missed one of these, grab the slides on CommNet and see if you can find the speakers on site. If you didn't come to Tech Ed this year, consider ordering the DVD of all the sessions.

Kate

(note to self: add "C++" to abstract of any future MFC talk I deliver :-).)

 

 

 

Thursday, 05 June 2008 09:05:40 (Eastern Daylight Time, UTC-04:00)  #    Comments [0]