Monday, 29 May 2017

Session 0

Every user in Windows is place in a separate session. Session 0 is created on startup and additional sessions are created as needed. Processes (generally services) running in Session 0 have no access to the graphics hardware. User applications must run in Session 1 or higher.

Saturday, 15 April 2017

Make Table Headings Run on to Subsequent Pages

By default, table headings are omitted when tables run on to subsequent pages.

To change this -

1. Right click on your table and select "Table Properties"
2. Select "Row"
3. Tick "Repeat as header row at the top of each page"

Job done.

Saturday, 4 March 2017

Viewing Code in Landscape Mode in Microsoft Word

Code in Word often looks better in Landscape mode rather than Portrait mode when rendered in Word.

To change a document to Landscape, click on "Layout" (or "Page Layout" in some versions of Word), find Orientation and switch to Landscape.

Manipulating Code in Microsoft Word

Manipulating Visual Studio code in Microsoft Word can be a messy affair.

For example, System.Text is not a recognized word in Word's dictionary.

An Error(argument) function might be corrected to Error ( argument ) by the Grammar Check.

So if you are manipulating code in Microsoft Word, here's the best thing to do. Turn off automatic spelling AND grammar checking as you type.

To do this, go to File, Options, Proofing and uncheck:

  • Check spelling as you type
  • Mark grammar errors as you type
Job done.

Sunday, 19 February 2017

Windows Magazines

Visual Studio Magazine is usually the best for previewing upcoming changes in Visual Studio.

MCPmag is also a great resource for Microsoft Certified Professionals.

Sunday, 12 February 2017

The NUL terminated string in C - An Ode to the PDP-11

In C, strings are null (or NUL) terminated ("backslash 0").  The PDP-11 assembly language supported NUL terminated strings, as did Martin Richards' BCPL, the precursor of C. Dennis Ritchie found the use of a NUL terminator more convenient than having to store the length of a string. It also makes for some elegant pointer based code!

MBCS and other Compiler Flags in Visual C/C++

When writing C and C++ code in Visual Studio understanding your compiler flags is critical.

These are configured under -

Project -> Properties -> Configuration Properties -> C/C++ -> Preprocessor.

One of the default ones you might come across is _MBCS, which stands for multi-byte character set (an alternative to _UNICODE).  These directives define what the compiler understands a "character" to be. ASCII and ANSI are not multi-byte character encodings.

A useful directive if you want to use the "traditional" C functions like fopen etc.which are deprecated in recent Visual Studio releases is _CRT_SECURE_NO_WARNINGS. (CRT is shorthand for C runtime).

More detail on why functions like fopen are deprecated can be found in this article on Security Features in the CRT.