Skip to main content

Posts

Code Snippets for Visual Studio

Visual Studio has a great feature to speed entry of frequently typed lines of code called Code Snippets. It works by typing a few chars and pressing tab (C++) or tab-tab (C#). For C# my favorites are 'cw' for adding 'Console.WriteLine' and 'mbox' for adding 'MessageBox.Show'. Visual C++ lacks a similar snippet for adding AfxMessageBox--until now. To add this as a new snippet, save the XML below as a file with extension *.snippet and open the Visual Studio Snippet manager. (Searching "Code Snippets Manager" from the search box is an easy way to find it.)  Then import the snippet under Visual C++/My Code Snippets. Enjoy the increased productivity! <?xml version="1.0" encoding="utf-8"?> <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> <CodeSnippet Format="1.0.0">   <Header>     <Title>AfxMessageBox</Title>     <Author>nzmCode...
Recent posts

Use GitHub Pages for a simple website

It used to be common for ISPs to provide storage to host a simple web page but no longer. This idea was probably a casualty of  the move to dynamically generated pages, which requires a database, significantly more cpu power, and user support beyond what ISPs want to provide. But if the user (like me) just wants a simple, static web page, there are options. Today I set up my simple, static web page on GitHub pages. I have linked this blog with the website and have renamed the blog, consistent with my GitHub account, as nzmCoder.  

How to create a small Visual Studio 2017 Native C++/MFC Application

Sometimes it is useful to create a native Windows application that has no DLL dependencies. An example would be creating a simple tool application that you wish to share with others. If you need to ensure that end users have a large DLL installed to support the run time environment, this is can be counterproductive to making it easy. The solution is to use a native Windows application and statically link all required libraries into the single executable file. The user can run the application without installing anything, just by having the single executable. Back in the days of Microsoft Visual Studio 6, you could by default make small Dialog-based executables that would compile into an EXE of only a few hundred kB in size. Somewhere along the road from 1998 to Microsoft's 2017 version of Visual Studio, the default size got a lot larger.  Today, if you accept all default options, your Dialog-based GUI application will begin weighing in at a hefty 3.3MB. Can't we do better t...

How to fix Lego Mindstorms EV3 Bluetooth connection

The EV3 Bluetooth connection feature is very useful, but can also be frustrating when it fails. Here are instructions to fix a failed Bluetooth connection. This was written for Windows 7 where it seems to fail more regularly. Turn off the EV3 bot. (Wait several seconds for it to turn off completely.) Run the EV3 software on the PC (if not already running) and press the Bluetooth Scan feature. The scan should now find no bots listed as being connected.  If it still shows the EV3 bot, press Scan again repeatedly until no bots are shown. Close the EV3 software on the PC. Go to the Windows Devices and Printers screen, find the EV3 bot device, right click, and remove the device. Restart the PC. The shutdown process may complain that a process is hung that can't be stopped.  This is the misbehaving Bluetooth driver. Now turn on the EV3 bot. After the PC restarts, go to the Windows Devices and Printers screen, and click Add device. The EV3 should show up as a found device th...

Convert a Microsoft Visual Studio project from VC6 to VC2017

How to convert a Microsoft Visual Studio project from VC6 to VC2017 In VS2017, open the *.dsp file of the project to be converted. Accept the suggestion to convert the project to the new VS2017. In the menu: Project\Properties. Change the selection to “All Configurations” On the General tab: Character Set: MBCS On the C/C++ tab: Enable Function-Level linking: Yes (/Gy) On the C/C++ tab: Warning Level: /W2 On the Linker tab: Image Has Safe Exception Handlers: No On the Linker tab: Generate Manifest: No In the menu: View\Solution Explorer. Browse to and open stdafx.h, and add these lines near the beginning, after the #include guards: #define _WIN32_WINNT 0x05010000   // Might not need this #define _CRT_SECURE_NO_WARNINGS #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS   

First Post

This is a blog devoted to topics, some related to programming, some even useful. The blog address is a dedication to my first computer (1983), the TRS-80 Color Computer. It used a Motorola 6809E microprocessor. The 'E' meant it used an external clock circuit. Still hold fond memories of that time, of that machine. When the mood strikes, I will post things here. For years I had small, personal web pages hosted in turn by my schools, and my ISPs. My new ISP no longer provides that service. I've been out of school for many years. . . So here is Blog Post #1.