Visual Studio’s Step Into Specific command

If you’d rather leave your fingers on the keyboard while debugging, try Shit+Alt+F11 as it maps to Debug.StepIntoSpecific.

Back to Chromium debugging…

Posted in Uncategorized | Leave a comment

Cerbero PE Insider

Maybe you’ve had the Explorer Suite sitting on your hard-disk for a while. Did you know that there’s a “completely free PE viewer for the community called PE Insider“?

Posted in Uncategorized | Leave a comment

Visual Studio : Options to bind the selected item

You know, the icon that eventually appears when you forgot to fully qualify a C# type and the IDE is offering to do it for you or add a using statement.

I finally find the keyboard shortcut to open it instead of losing time trying to get it to open with the mouse: ALT + SHIFT + F10.

That’s a weird shortcut…

Posted in Computers and Internet | Leave a comment

Using C++ decltype to ease implementation of “late” binding to a DLL

You can just include the file with the prototype of the function exported by the DLL you’ll load with LoadLibrary. Then use decltype on it:

#include <iostream>
#include <UserEnv.h>

int wmain() {
   auto h  = LoadLibrary(L"Userenv.dll");
   if (!h)
      return -1;
   auto farproc = GetProcAddress(h, "GetDefaultUserProfileDirectoryW");
   if (!farproc)
      return -2;
   auto fn = reinterpret_cast<decltype(& GetDefaultUserProfileDirectory)>(farproc);
   wchar_t path[MAX_PATH];
   DWORD count;
   if(!fn(path, & count))
      return -3;
   std::wcout << path 
              << std::endl;
   return 0;
}
Posted in Computers and Internet | Leave a comment

Herb Sutter again on Lambda tonight

As usual, his talk delivered to the Northwest C++ Users Group was excellent and very entertaining. It’s very enjoyable to be surrounded by people who love the language and are passionate about it.

I hope he and Scott Meyers are working on new editions of their books that will take those new C++ 0x features into account.

If you’re interested, you can see a scaled down version of it on http://channel9.msdn.com/Events/PDC/PDC10/FT13.

À plus tard.

Posted in Computers and Internet | Leave a comment

Local help with disconnected OOB Silverlight applications…

Yes, displaying an HTML Help, .CHM, file…

A person asked me how to do this and before spending time explaining the approach, I’ll just show some sample code for now. If there’s any question/comment, I’ll add more text:

<UserControl x:Class="HelpSystemTest.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

   <Grid>
      <toolkit:BusyIndicator Name="BusyDownloadingHelpFile" BusyContent="Downloading Help File">
         <StackPanel>
            <Button Content="Install" Height="23" HorizontalAlignment="Left" Margin="12,12,0,0" Name="Install" VerticalAlignment="Top" Width="75" Click="Install_Click" />
            <Button Content="Launch Help" Height="23" HorizontalAlignment="Left" Margin="12,12,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="LaunchHelp" />
         </StackPanel>
      </toolkit:BusyIndicator>
   </Grid>
</UserControl>

public partial class MainPage : UserControl {
   public MainPage() {
      InitializeComponent();
      if (Application.Current.IsRunningOutOfBrowser && Application.Current.HasElevatedPermissions)
         DownloadHelpFile();
   }

   string _helpFileFolder = null;
   const string _helpFileName = "HelpFile.chm";
   string _helpFilePath = null;

   private void LaunchHelp(object sender, RoutedEventArgs e0) {
      if (!Application.Current.IsRunningOutOfBrowser
            || !Application.Current.HasElevatedPermissions
            || !AutomationFactory.IsAvailable) {
         MessageBox.Show("The Windows help system cannot be launched in the current context");
         return;
      }
      DownloadHelpFile(() => {
         using (dynamic shell = AutomationFactory.CreateObject("WScript.Shell"))
            shell.Exec("HH.EXE \"" + _helpFilePath + "\"");
      });
   }

   void DownloadHelpFile(Action actionWhenHelpFileOnDisk = null) {
      try {
         if (_helpFileFolder == null) {
            _helpFileFolder = IoPath.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "MyCompany");
            _helpFilePath = IoPath.Combine(_helpFileFolder, _helpFileName);
         }

         if (Directory.Exists(_helpFileFolder)) {
            if (File.Exists(_helpFilePath)) {
               if (actionWhenHelpFileOnDisk != null)
                  actionWhenHelpFileOnDisk();
               return;
            }
         } else
            Directory.CreateDirectory(_helpFileFolder);
         if (actionWhenHelpFileOnDisk != null) // We're NOT silently downloading in the background...
            BusyDownloadingHelpFile.IsBusy = true;
         var wc = new WebClient();
         wc.OpenReadCompleted += (s, e) => {
            using (var toStream = new FileStream(_helpFilePath, FileMode.CreateNew)) {
               e.Result.CopyTo(toStream);
            }
            BusyDownloadingHelpFile.IsBusy = false;
            actionWhenHelpFileOnDisk();
         };
         wc.OpenReadAsync(new Uri(_helpFileName, UriKind.Relative));
      } catch (Exception ex) {
         BusyDownloadingHelpFile.IsBusy = false;
         MessageBox.Show(ex.Message + ex.StackTrace, "Exception while storing help file locally", MessageBoxButton.OK);
      }
   }

   private void Install_Click(object sender, RoutedEventArgs e) {
      if (Application.Current.InstallState == InstallState.NotInstalled)
         Application.Current.Install();
   }
}
Posted in Computers and Internet | Tagged , , , , | Leave a comment

ALM for C++ in Visual Studio 2010 by Ale Contenti during TechEd Europe 2010

I liked this talk: http://www.msteched.com/2010/Europe/DPR202-LNC

 

Posted in Uncategorized | Leave a comment