RSS Feed 6 Posts and 12 Comments till now

Organize Your Mind

So, my new job as a project manager in a big company requires me to take in a lot of information and then formulate the information and ideas into workable plans. In the past when I needed to organize my thoughts I would usually use good ole paper and pen or a Word or text file. However, a few months ago a co-worker introduced me to mind mapping.

In a nutshell mind mapping involves organizing thoughts and ideas in a tree-like format rather than the usual top-down. The real power comes in that you just start doing a brain-dump without worring about seuqence or formatting. Once you get used to it mind mapping becomes a really fast, gratifying way to organize and communicate your thoughts and plans.

I will not get into the basics or background too much - see the Wikipedia article above for that. However, I do want to point out a really good, free software package for mind mapping that I use. It is called FreeMind and is available on sourceforge.

My point is - try it. There are times when a mind map helps better than anything else I have done.

How to Create a Simple Win32 DLL Using Visual C++ 2005

This tutorial is an update to one I did years back for Visual C++ 6.0. That article has consistently been the most viewed page on icynorth.com by a long shot. I didn’t realize that until a year ago when I started using Google Analytics on the site, but it really surprised me to see. It goes to show that sometimes bringing things back to the basics can be a big hit.

This tutorial will teach you how to use Visual C++ 2005 (Visual Studio 2005 Professional) to create a small Win32 C++ DLL that can be called from C++, Visual Basic, Delphi, C# or any other program capable at calling DLL functions.

This DLL will have one purpose; to generate a unique filename using the Windows API function GetTempFileName. This function is useful if you need to store temporary data in a unique file for the user of your application and want to ensure that the file does not already exist. However, the point of this tutorial is not to generate unique filenames, but rather to show you how easy it is to create simple Windows DLLs using Visual C++.

The key here is “simple”. Windows DLLs are capable of much, much more than outlined here. This tutorial will only cover simple, Win32 DLL creation for those quick-and-dirty projects.

Continue Reading »

My First .NET 3.0 WPF Application - Password Vault 2.0

OK, well here is my first (VERY Alpha) version of Password Vault 2.0. It is version 0.1.0.0 and the source code is provided. It requires .NET 3.0 to be installed on your system. The source code project was created in Visual Studio 2008 Professional Edition Beta 2. I am not sure if it will open or compile in Visual Studio 2005 with Visual Studio 2005 extensions for .NET Framework 3.0 at this point, but let me know if you try it.

In order to cover my butt and make sure that everyone enjoys the source code and software, I have released it under the Creative Commons Attribution-Noncommercial-Share Alike 2.5 Canada License. What that means is you are free to use the source code for educational purposes and to use the compiled program for personal use. I may change the license later, but for now, we will go with that.

This is really a baseline version of the software and is very incomplete. I just want to get the ball rolling by releasing it. By poking around in the code you will see how a real, live Windows Presentation Foundation application looks. I would like to keep improving this product to the point where it is truly useful and cool to look at. If you want to contribute ideas, suggestions, or code, let me know.

So, without further delay, here are the downloads:

Teaching an Old Dog New Tricks

Earlier this year I looked back at my life and said, “you’ve change, man - you used to be about the code”. From my first computer (a Commodore 64 when I was 13) I was always fascinated by computer programming. It was like leggo for big kids. I was (like many of you) fascinated by the process of learning a new technologies and languages.

About 11 years ago I started into Windows programming with the Win 32 API and then MFC. I have used those technologies day in and day out for the past decade and have for the most part got a good grip on them (depending on who you ask). However, I got comfortable and stopped keeping up with the new stuff. Sure, I played with PHP, flirted with Perl, and loved Lua, but I never really got deep into a technology again. It is not like I learned nothing else in that time - I learned a lot. Project management, marketing, software lifecycle management, how to change a diaper, etc. But when I stopped learning new programming languages I started to lose my edge.

I think that as a technical manager it is imperative that you keep that love of technology as an end unto itself - not just as a way to meet the next business goal. Not just for yourself, but for the company as well. Exposing yourself to new technologies and techniques will start to get your imagination going again like nothing else.

So, that being the case, a few months ago I started reading about the new changes coming out in .NET 3.0 like WPF and WCF and decided that would be my next project. I started by reading Charles Petzold’s most excellent free eBook “.NET Book Zero“. Wow, that guy knows how to treat a nerd right. Many years ago I read “Programming Windows” by Petzold and have gone back to it more times than I can count as a reference so I knew Petzold was the place to start. Now I have moved to “Applications = Code + Markup: A Guide to the Microsoft Windows Presentation Foundation” and will do a review of such soon.

 My first project is to make a new version of Password Vault completely in .NET 3.0 using WPF. I have already started and it is slowly coming along as I slog through delegates, XAML, not “deleteting” stuff I “new” (which freaks me right out). I will be posting more about the project as time goes on.

So, wish me luck. I am out to recapture my programming youth.

comctl32v6 + MBCS + CEdit::SetFont = 6 hours of pain

Today I was doing some research for an upcoming update to AutoPlay Media Studio. It is an MFC product developed in Visual C++ 6.0 and is compiled with _MBCS (not _UNICODE). The product has user-configurable fonts for many elements such as edit fields.

So, the problem is the if someone chooses a non-Western character set such as Arabic for a font, it will not show characters in the extended character set (codepage) properly in the edit field at runtime or design-time. So, for example, if I type Alt+0199 it should show a funky-cool Arabic character. But instead it shows the 199 character from the standard ASCII character set (Western).

The long and the short of it is that my solution was to take the user’s font settings, create a CFont from them (including the character set) and then set the font into the CEdit control. Here is a clip from a test I did.

m_fnt.CreateFont(-11,0,0,0,0,0,0,0,ARABIC_CHARSET,OUT_DEFAULT_PRECIS,
  CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,_T("Arial"));
c_EditField.SetFont(&m_fnt);

In the above code, m_fnt is a CFont member variable of the dialog and c_EditField is a CEdit field member of the dialog class. I know this should work because if I make a font like the above, apply it to a device context and then do some text out, the arabic characters will show up properly.

So what is happening??? Well, after much Googling and MSDN reading everything seemed to indicate that I was doing things right. Well at this point I start trying to isolate the problem in a smaller, more controlled situation. I made a new MFC dialog app using the project wizard. I used all of the same project settings that the larger product has. And what do you know, it worked!

So, what was different between this sample app and the big app? Well, for one, the sample dialog app looked old-school (not XP-themed) so I went and added the famous XML manifest that declares a dependency on comctl32.dll v6.0.0.0. And preto-breako - no more Arabic characters.

Long story short, I tried and tried to fix it. Tried setlocale, _setmbcp, SetThreadLocale, etc. Nothing works. From my understanding none of this would be a problem if I was truly on an Arabic version of Windows XP, but it should work - and that is what bugs me. I searched and searched for anything related to this specific problem but could not find anything. So our options are:

  1. Drop the XP theming
  2. Convert the product to Unicode.

1 is not an option because, well, XP theming is sexy. 2 is not an option due to the time constraints of the project at this point and for other technical reasons. So for now I will go with option 3 - do nothing.

If you can help me solve this, I will be eternally grateful.

The Start

OK, I am blogging for real. I have wanted to make a tech blog for sometime now and was recently inspired by fellow Indigo Roser Mark Mruss to get going. Mark started the learning python blog and has had a lot of traffic.

I work for Indigo Rose Software during the day (and sometimes at night) as Director of Product Development. My other Web presence is Icy North Technologies where I have some shareware and articles put together over the years.

So, why the blog then? Well I think that at this point I can add more value to the world and my life by starting to give back some of what I have learned and am learning. I enjoy programming, learning, business and writing, so here I go…