Figure 1   New NTFS File-related Flags

FILE_FLAG_OPEN_REPARSE_POINT When opening a file, inhibit any effects that may exist due to an associated reparse point
FILE_ATTRIBUTE_SPARSE_FILE The file is a sparse file
FILE_ATTRIBUTE_ENCRYPTED The file is encrypted
FILE_ATTRIBUTE_REPARSE_POINT The file has an associated reparse point
FILE_VOLUME_QUOTAS The volume supports disk quotas (NTFS 5 required)
FILE_SUPPORTS_SPARSE_FILES The volume supports sparse file (NTFS 5 required)
FILE_SUPPORTS_REPARSE_POINTS The volume supports reparse points
FILE_SUPPORTS_ENCRYPTION The volume supports encryption


Figure 2   LongPathNameDemo.cpp


//===============================================================
// Matt Pietrek
// Microsoft Systems Journal, November 1997
// FILE: LongPathNameDemo.CPP
// To compile: CL </DUNICODE=1 /D_UNICODE=1> LongPathNameDemo.CPP 
//===============================================================
#define WIN32_LEAN_AND_MEAN
#define _WIN32_WINNT 0x500
#include <windows.h>
#include <stdio.h>
#include <tchar.h>

TCHAR g_szMyLongFilename[] = _T("ThisIsALongFileName.TXT");

int main()
{
    HKEY hKey;

    // Create a file with a long filename (see above)
    HANDLE hFile = CreateFile(  g_szMyLongFilename,
                                GENERIC_WRITE,
                                0,
                                0,
                                CREATE_NEW,
                                FILE_ATTRIBUTE_NORMAL,
                                0 );

    if ( hFile )            // If the file was opened, close
        CloseHandle( hFile );
    
    TCHAR szShortFilename[MAX_PATH];

    // Get the short version of the filename        
    GetShortPathName(   g_szMyLongFilename, szShortFilename,
                        sizeof(szShortFilename)/sizeof(TCHAR) );
    
    _tprintf( _T("Short pathname: %s\n"), szShortFilename );

    TCHAR szLongFilename[MAX_PATH];

    // Reverse the process, getting the long filename from the
    // short filename obtained earlier
    GetLongPathName(    szShortFilename, szLongFilename,
                        sizeof(szLongFilename)/sizeof(TCHAR) );
    
    _tprintf( _T("Long pathname: %s\n"), szLongFilename );
    
    if ( hFile )        // If we created a file earlier, delete it now
        DeleteFile( g_szMyLongFilename );

    return 0;
}                   

Figure 4   New Windows NT 5.0 Window Messages

WM_GETOBJECT Sent to Microsoft Active Accessibility (MSAA) servers to obtain a reference to an object
WM_SYNCPAINT Sent to a window that needs to be painted when it's overlaid by another window of a different thread
WM_MENURBUTTONUP
WM_MENUDRAG
WM_MENUGETOBJECT
WM_UNINITMENUPOPUP
Sent when a drop-down menu or submenu is about to become active
WM_MENUCOMMAND Menu owner receives this when the user makes a selection


Figure 5   InSendMessageEx Flags

ISMEX_NOSEND Message being processed wasn't sent
ISMEX_SEND Message was sent through SendMessage or SendMessageTimeout
ISMEX_NOTIFY Message sent through SendNotifyMessage. Sender is not blocked
ISMEX_CALLBACK Message sent through SendMessageCallback. Sender is not blocked
ISMEX_REPLIED Message has been replied to. Sender is no longer blocked


Figure 6   AnimateWindow in TH32DEMO.c


void Handle_WM_INITDIALOG(HWND hWndDlg)
{
    DWORD tabStops = 20;

    // Set appropriate tab stops in all the listboxes of the main dialog
    SendDlgItemMessage( hWndDlg, IDC_LISTBOX_PROCESSES,
                        LB_SETTABSTOPS, 1, (LPARAM)&tabStops );
    SendDlgItemMessage( hWndDlg, IDC_LISTBOX_THREADS,
                        LB_SETTABSTOPS, 1, (LPARAM)&tabStops );
    SendDlgItemMessage( hWndDlg, IDC_LISTBOX_HEAPS,
                        LB_SETTABSTOPS, 1, (LPARAM)&tabStops );
    SendDlgItemMessage( hWndDlg, IDC_LISTBOX_MODULES,
                        LB_SETTABSTOPS, 1, (LPARAM)&tabStops );

    // Fill in the process listbox (and in a cascade reaction, update
    // all the other listboxes )
    UpdateProcesses( hWndDlg );

    // Set focus to the main listbox (the process list)
    SetFocus( GetDlgItem(hWndDlg, IDC_LISTBOX_PROCESSES) );

    // Cool blend in animation effect
    AnimateWindow( hWndDlg, 10, AW_BLEND | AW_ACTIVATE );
}

Figure 7   New SystemParametersInfo Values

SPI_GETMOUSESPEED
SPI_SETMOUSESPEED
The same value as you'd set via the Mouse applet in the Control Panel.
SPI_GETSCREENSAVERRUNNING Is a screen saver currently running?
SPI_GETACTIVEWINDOWTRACKING
SPI_SETACTIVEWINDOWTRACKING
Makes the active window "track" the mouse. Whatever window the mouse is over becomes the active window.
SPI_GETMENUANIMATION
SPI_SETMENUANIMATION
If menu animation is enabled, menus will slide open. If disabled, menus pop up fully formed (just as in previous versions).
SPI_GETCOMBOBOXANIMATION
SPI_SETCOMBOBOXANIMATION
If enabled, combo boxes slide open instead of pop open.
SPI_GETLISTBOXSMOOTHSCROLLING
SPI_SETLISTBOXSMOOTHSCROLLING
If enabled, list boxes use the smooth-scrolling effect.
SPI_GETGRADIENTCAPTIONS
SPI_SETGRADIENTCAPTIONS
If enabled, the background color of window title bars blends from the right to the left color. Use GetSysColor with the COLOR_GRADIENTACTIVECAPTION and COLOR_ACTIVECAPTION flags to specify the right and left colors for active windows. Use the COLOR_GRADIENTINACTIVECAPTION and COLOR_INACTIVECAPTION flags for inactive windows.
SPI_GETMENUUNDERLINES
SPI_SETMENUUNDERLINES
If menu underlines are enabled, the menu shortcut underlines are always drawn. Otherwise, they are only drawn when the menu is activated through the keyboard.
SPI_GETACTIVEWNDTRKZORDER
SPI_SETACTIVEWNDTRKZORDER
If active window z-order tracking is enabled, the active window will be brought to the top of the z-order.
SPI_GETHOTTRACKING
SPI_SETHOTTRACKING
If hot tracking is enabled, the system hot tracks and displays tooltips for non-client area buttons and menu bar items.
SPI_GETFOREGROUNDLOCKTIMEOUT
SPI_SETFOREGROUNDLOCKTIMEOUT
SPI_GETACTIVEWNDTRKTIMEOUT
SPI_SETACTIVEWNDTRKTIMEOUT
Active window tracking delay, in milliseconds. This happens regardless of the z-ordering mode (see SPI_SETACTIVEWNDTRKZORDER).
SPI_GETFOREGROUNDFLASHCOUNT
SPI_SETFOREGROUNDFLASHCOUNT
This is the number of times SetForegroundWindow will flash the tray button when rejecting a request by another program to switch to the foreground.


Figure 8   SystemMetricParams.cpp


//=============================================================================
// Matt Pietrek
// Microsoft Systems Journal, November 1997
// FILE: ScheduledTasks.CPP
// To compile: CL </DUNICODE=1 /D_UNICODE=1> SystemMetricParams.CPP user32.lib
//=============================================================================
#define WIN32_LEAN_AND_MEAN
#define _WIN32_WINNT 0x500
#include <windows.h>
#include <stdio.h>
#include <tchar.h>

#define WIDTH 40
#define DISPLAY_SM( x ) _tprintf(   _T("%-*s%u\n"), WIDTH, \
                                    _T(#x), GetSystemMetrics(x) );

#define DISPLAY_SPI( x )    dwValue = 0xBAADF00D;                           \
                            SystemParametersInfo( x, 0, &dwValue, 0 );      \
                            _tprintf(   _T("%-*s%u\n"), WIDTH, _T(#x),      \      
 	                    dwValue);
int main()
{
    DISPLAY_SM( SM_XVIRTUALSCREEN )
    DISPLAY_SM( SM_YVIRTUALSCREEN )
    DISPLAY_SM( SM_CXVIRTUALSCREEN )
    DISPLAY_SM( SM_CYVIRTUALSCREEN )
    DISPLAY_SM( SM_CMONITORS )
    DISPLAY_SM( SM_SAMEDISPLAYFORMAT )

    _tprintf( _T("\n") );   // separator
    
    DWORD dwValue;
    
    DISPLAY_SPI( SPI_GETMOUSESPEED )
    DISPLAY_SPI( SPI_GETSCREENSAVERRUNNING )
    DISPLAY_SPI( SPI_GETACTIVEWINDOWTRACKING )
    DISPLAY_SPI( SPI_GETMENUANIMATION )
    DISPLAY_SPI( SPI_GETCOMBOBOXANIMATION )
    DISPLAY_SPI( SPI_GETLISTBOXSMOOTHSCROLLING )
    DISPLAY_SPI( SPI_GETGRADIENTCAPTIONS )
    DISPLAY_SPI( SPI_GETMENUUNDERLINES )
    DISPLAY_SPI( SPI_GETACTIVEWNDTRKZORDER )
    DISPLAY_SPI( SPI_GETHOTTRACKING )
    DISPLAY_SPI( SPI_GETFOREGROUNDLOCKTIMEOUT )
    
    return 0;
}