Welcome to my laboratory. Boohahahaha
New Unmanaged APIs in Longhorn
Published on November 6, 2003 By Ian Hanschen In Software Development
Last week I was priviledged to see, first-hand, a lot of the new technologies going into the Longhorn.

It was an incredible amount of information to absorb, and I came away from it feeling just like the first time I saw the movie "Evil Dead" - impressed, and a little sickened.

It all comes down to managed code. Now, before you go thinking "Oh, this is another one of those programmers who simply refuses to get with the times and move on to newer, greater, fuzzy things", please note that I am not a B2B solution provider yearning for a strategic fit in creating next-generation content with low corporate bandwidth congestion. I research and develop products that embrace and extend the whole platform. Managed code obfuscates this quite a bit. Having said that, I'm learning managed code anyway. A lot of the new stuff I'll be writing in a few years will have to deal with it.

But I won't be writing about WinFX for a few weeks. There's a lot to absorb. In this post I'm going to run through the new bits added that are not managed code. Sorry it's sloppy - I'm really spending a lot more of my time doing something else with this build...

But first, the magic disclaimer:
Note: None of this stuff is finalized - it's all subject to change. Don't base production code on it. If it's there and not documented in the future, for some reason, using it is your own gamble. Unless otherwise specified, it's in the headers. #define _WIN32_WINNT 0x0600 mandatory. None of this(excluding CS_MIL) made the SDK documentation, YMMV. 2 years from now Longhorn could be completely different.

USER/WMGR:
Horizontal mousewheel scrolling:
WM_MOUSEHWHEEL

CS_MIL for combining GDI & Avalon in an application.

Horizontal mouse input for mouse_event:
MOUSEEVENTF_HWHEEL

Checking horizontal mouse wheel w/GetSystemMetrics:
SM_MOUSEHORIZONTALWHEELPRESENT

Button Message, two guesses: Either it disables, or stops event notification:
BM_SETDONTCLICK

New for SystemParametersInfo:
SPI_GETWHEELSCROLLCHARS (yay!)
SPI_SETWHEELSCROLLCHARS (yay!)
SPI_GETSHOWIMEUI
SPI_SETSHOWIMEUI

Other than changes under the hood for the composited desktop, that's it for user in this round.

GDI:
GDI has no friends. No new methods.

COMMCTRL (Note that the manifest has to specify 6.0.200.0 to get the new functionality):

NM_FONTCHANGED notification message.

IImageList:raw gets ILS_EMBOSS, ILS_REFLECT, ILS_INVERT, and ILS_EFFECTS IMAGELISTSTATEFLAGS

ImageList_Draw gets ILD_ASYNC (ooh)
.. Also gets: ILGT_NORMAL and ILGT_ASYNC. Not sure.

Headers get a checkbox style with HDS_CHECKBOXES...

and new flags:
HDF_CHECKBOX, HDF_CHECKED, HDF_FIXEDWIDTH, HDF_HIDDEN...

and new HDHITTESTINFO location HHT_ONITEMSTATEICON...

and a new notification message: HDN_ITEMSTATEICONCLICK

Toolbars get the new exstyle TBSTYLE_EX_CALLBACKIMAGELABELS..
TBCDRF_USECDCOLORS customdraw return flag for forcing custom colors.

And new TBBUTTONINFO flag TBIF_IMAGELABEL & new member "iImageLabel". They are calling these ink labels, not sure what they are yet.

NMTBDISPINFO adds TBNF_IMAGELABEL & iImageLabel member.

Rebars add style RBS_TRANSPARENT(yay!)

TTTOOLINFO adds an hbmp HBITMAP member for displaying large preview bitmaps(think image hover in the shell)..

TTDISPINFO predictably adds an hbmp HBITMAP member for querying the large preview bitmap on the fly.

Hyperlinks add style TTS_USEVISUALSTYLE. Apparently UXTheme has added support for hyperlink theming in tooltips beyond the hotlight color.

Listview gets new extended styles:

LVS_EX_JUSTIFYCOLUMNS // Icons are lined up in columns that use up the whole view area.
LVS_EX_TRANSPARENTBKGND // Background is painted by the parent via WM_PRINTCLIENT
LVS_EX_TRANSPARENTSHADOWTEXT // Enable shadow text on transparent backgrounds only (useful with bitmaps)
LVS_EX_SHOWNUMORDER
LVS_EX_AUTOAUTOARRANGE // Icons automatically arrange if no icon positions have been set
LVS_EX_HEADERINALLMODES // Show column headers in all view modes
LVS_EX_AUTOCHECKSELECT
LVS_EX_AUTOSIZECOLUMNS

New LVTILEVIEWINFO flag: LVTVIF_EXTENDED (perhaps for the highlight?)

LVIF_IMAGETITLE, LVIF_TASKS, and LVIF_COLFMT LVITEM mask flags.

LVITEM gets cTasks count member, LVTASK(new structure, see below) array pointer, iImageTitle integer, and a pointer for an int piColFmt(column format)

Column formats: (Just going to paste this one with header comments)

LVCFMT_FIXED_WIDTH // Can't resize the column; same as HDF_FIXEDWIDTH
LVCFMT_NO_DPI_SCALE // If not set, CCM_DPISCALE will govern scaling up fixed width
LVCFMT_FIXED_RATIO // Width will augment with the row height
LVCFMT_LINKS_PARSEONLY // Parse out markup tags but don't show links
LVCFMT_LINKS_PARSEANDSHOW // Parse and show hyperlinks
LVCFMT_LINKS_SHOWAUTOMATIC // Whole item is a link with no anchor tag
LVCFMT_LINKS_MASK (LVCFMT_LINKS_PARSEONLY | LVCFMT_LINKS_PARSEANDSHOW | LVCFMT_LINKS_SHOWAUTOMATIC)
LVCFMT_TILE_FIRST // First column always
LVCFMT_TILE_SECOND // Second column if there's three
LVCFMT_TILE_THIRD // Third formated column
LVCFMT_TILE_PLACEMENTMASK (LVCFMT_TILE_FIRST | LVCFMT_TILE_SECOND | LVCFMT_TILE_THIRD)
LVCFMT_TILE_MULTILINE // Takes a whole column
LVCFMT_HIDDEN // Column is hidden; same as HDF_HIDDEN

New LVGROUP flags:
LVGF_SUBTITLE // pszSubtitle is valid
LVGF_TASK // pszTask is valid
LVGF_DESCRIPTIONTOP // pszDescriptionTop is valid
LVGF_DESCRIPTIONBOTTOM // pszDescriptionBottom is valid
LVGF_TITLEIMAGE // iTitleImage is valid
LVGF_EXTENDEDIMAGE // iExtendedImage is valid
LVGF_ITEMS // iFirstItem and cItems are valid

LVGROUP structure adds:
LPWSTR pszSubtitle;
UINT cchSubtitle;
LPWSTR pszTask;
UINT cchTask;
LPWSTR pszDescriptionTop;
UINT cchDescriptionTop;
LPWSTR pszDescriptionBottom;
UINT cchDescriptionBottom;
int iTitleImage;
int iExtendedImage;
int iFirstItem; // Read only
UINT cItems; // Read only

So it looks like the listview has been extended quite a bit!

LVTILEINFO gets a column format pointer.

LVSETINFOTIP gets an hbmp member for bitmap tooltip.

#define ListView_SetGroupHeaderImageList(hwnd, himl) \
(HIMAGELIST)SNDMSG((hwnd), LVM_SETIMAGELIST, (WPARAM)LVSIL_GROUPHEADER, (LPARAM)(HIMAGELIST)(himl))

#define ListView_GetGroupHeaderImageList(hwnd) \
(HIMAGELIST)SNDMSG((hwnd), LVM_GETIMAGELIST, (WPARAM)LVSIL_GROUPHEADER, 0L)

^^^^ Group header images supported. Neato.

LVLINK notification structure added w/NMHDR, LITEM link structure, item & subitem identifiers..

NMLVGETINFOTIP gets hbmp member for tooltip bitmap & LVGIT_BITMAP for specifying it.

New notifications:
LVN_ORDERCHANGED & LVN_LINKCLICK(w/LVLINK notify structure pointed to I guess)


ListView Async drawing functionality:

LVN_ASYNCDRAWN notification message, with NMLVASYNCDRAWN structure, as follows(Seems it has failure redundancy):

typedef struct tagNMLVASYNCDRAWN
{
NMHDR hdr;
IMAGELISTDRAWPARAMS *pimldp; // the draw that failed
HRESULT hr; // why it failed
int iPart; // LVADPART_*
int iItem; // meaning depends on iPart
int iSubItem; // meaning depends on iPart
LPARAM lParam; // meaning depends on iPart
// Out Params
DWORD dwRetFlags; // What listview should do on return
int iRetImageIndex; // used if ADRF_DRAWIMAGE is returned
} NMLVASYNCDRAWN;

LVADPART_ITEM // iItem, iSubItem = listview item/subitem index, lParam = item lParam
LVADPART_GROUP // iItem = group id, iSubItem = lParam = unused
LVADPART_IMAGETITLE // iItem, iSubItem = listview item/subitem index, lParam = item lParam

ADRF_DRAWSYNC // draw synchronously (act same as if LVS_EX_DRAWIMAGEASYNC weren't set)
ADRF_DRAWNOTHING // draw nothing (LVADPART_ITEM, LVADPART_GROUP)
ADRF_DRAWFALLBACK // draw fallback text (LVADPART_IMAGETITLE)
ADRF_DRAWIMAGE // draw image returned in iRetImageIndex instead

LVGETINFOTIP notification expanded with hbmp member for bitmap tooltip and LVGIT_BITMAP for requesting it.

Edit control gets EM_SETHILITE and EM_GETHILITE messages.

New API:
DrawScrollArrow, supporting the following flags:

DCHF_TOPALIGN // default is center-align
DCHF_HORIZONTAL // default is vertical
DCHF_HOT // default is flat
DCHF_PUSHED // default is flat
DCHF_FLIPPED // if horiz, default is pointing right
// if vert, default is pointing up
DCHF_TRANSPARENT
DCHF_INACTIVE
DCHF_NOBORDER

SysLink control adds LWS_NOPREFIX & LWS_USEVISUALSTYLE styles(confirming link theming) and new item styles: LIS_HOTTRACK and LIS_DEFAULTCOLORS.

And here's something that's just schwiggedy sweet.

SysAnimate controls get the ability to PLAY X MESH FILES. And assign textures to them, by providing the texture name defined in the mesh, and the hbitmap of the texture. When you copy a file in explorer, you'll see a rotating arrow dance across the copy dialog rather than the usual boring file moving along. That right there is a mesh-based animation on a sysanimate control. Same with when you insert a piece of media and autoplay runs and shows the rotating drive icon in the upper left.

Messages:
ACM_OPENXFILE, ACM_SETTEXTURE.

#define Animate_OpenXFile(hwnd, hInst, szName) (BOOL)SNDMSG(hwnd, ACM_OPENXFILE, (WPARAM)(hInst), (LPARAM)(LPTSTR)(szName))
#define Animate_SetTexture(hwnd, pszTextureID, hbmp) (BOOL)SNDMSG(hwnd, ACM_SETTEXTURE, (WPARAM)(LPTSTR)(pszTextureID), (LPARAM)(LPTSTR)(hbmp))

This is really freaking sweet, if you have the hardware. Mesh based animations with shaders, loaded from a resource file. Wonder why shell32 is so big? Why the new common controls dll has ballooned to 7 megs? Wonder no more. Cool animations.

I'll try and post a sample app for playing with this tomorrow(today? It's late!).

Buttons get a bunch of new stuff. Wonder why? Take a look at that new avalon titlebar. It's not a large titlebar, it's just a a titlebar with a rebar riding up to the top with a matching texture in the background. The rebar returns HTCAPTION on hittest so dragging from the rebar moves the window as if it was the caption. The navigation buttons with the funky dropdowns on the left are just win32 buttons.

Not had a chance to look at any of this yet:

// BUTTON STATE FLAGS
BST_DROPDOWNPUSHED

// BUTTON STYLES
BS_SPLITBUTTON
BS_DEFSPLITBUTTON

// SPLIT BUTTON INFO mask flags
BCSIF_GLYPH
BCSIF_IMAGE
BCSIF_STYLE
BCSIF_SIZE

// SPLIT BUTTON STYLE flags
BCSS_NOSPLIT
BCSS_STRETCH
BCSS_ALIGNLEFT
BCSS_IMAGE

// BUTTON STRUCTURES
typedef struct tagBUTTON_SPLITINFO
{
UINT mask;
HIMAGELIST himlGlyph; // interpreted as WCHAR if BCSIF_GLYPH is set
UINT uSplitStyle;
SIZE size;
} BUTTON_SPLITINFO, * PBUTTON_SPLITINFO;

// BUTTON MESSAGES
BCM_SETDROPDOWNSTATE
Button_SetDropDownState(hwnd, pState) \
(BOOL)SNDMSG((hwnd), BCM_SETDROPDOWNSTATE, 0, (LPARAM)(pState))

BCM_SETSPLITINFO
Button_SetSplitInfo(hwnd, pInfo) \
(BOOL)SNDMSG((hwnd), BCM_SETSPLITINFO, 0, (LPARAM)(pInfo))

BCM_GETSPLITINFO
Button_GetSplitInfo(hwnd, pInfo) \
(BOOL)SNDMSG((hwnd), BCM_GETSPLITINFO, 0, (LPARAM)(pInfo))

// NOTIFICATION MESSAGES
typedef struct tagNMBCDROPDOWN
{
NMHDR hdr;
RECT rcButton;
} NMBCDROPDOWN, * LPNMBCDROPDOWN;

BCN_DROPDOWN notify on the above.

PRSHT:

(Need to investigate - Several things added for header bar animations, guessing they use mesh sysanimate) See prsht.h for details.

KERNEL:

DWORD64 GetTickCount64()
BOOL WINAPI SetEndOfFileEx(HANDLE hFile, LARGE_INTEGER lpNewEndOfFile);

BOOLEAN
WINAPI
CreateSymbolicLinkW(
LPCWSTR lpSymlinkFileName,
LPCWSTR lpTargetVolumeName,
LPCWSTR lpTargetPathName,
DWORD dwFlags
);
dwFlags:
SYMBOLIC_LINK_FLAG_DIRECTORY
SYMBOLIC_LINK_FLAG_RELATIVE_LINK

Product Friendly Name API!
GetOSProductName(LPSTR pszProductName, UINT cchProductName, DWORD dwFlags) (flags not defined)

Windows Error Reporting API? WOW!

typedef struct _WER_MANIFEST {
DWORD dwSize;
LPCWSTR lpszBucketParams;
LPCWSTR lpszUserSID;
} WER_MANIFEST, *PWER_MANIFEST, *LPWER_MANIFEST;

WINBASEAPI
HANDLE
WINAPI
WerCreateReport(
IN DWORD dwFlags,
IN HANDLE hProcess,
IN DWORD dwProcessId,
IN LPCWSTR lpszEventType,
IN LPSECURITY_ATTRIBUTES lpDirectoryAttributes OPTIONAL,
OUT LPWSTR lpszReportDirectory OPTIONAL,
IN DWORD dwReportDirectoryChars
);

WER_DELETE_REPORT
WER_GATHER_VOLATILE_DATA
WER_DEFER_REPORT_UI
WER_DEFER_REPORT_SEND

WINBASEAPI
BOOL
WINAPI
WerCompleteReport(
IN HANDLE hReport,
IN DWORD dwFlags,
IN LPWER_MANIFEST lpManifest
);

WINBASEAPI
BOOL
WINAPI
WerAddReportText(
IN HANDLE hReport,
IN LPCWSTR lpszManifestToken,
IN LPCWSTR lpszManifestValue
);

WER_USE_MINIDUMP_FLAGS
WER_ADD_APP_NAME

typedef struct _WER_EXCEPTION_DATA {
DWORD dwSize;
DWORD dwThreadId;
LPEXCEPTION_POINTERS lpExceptionPointers;
LPCWSTR lpszExceptionModuleName OPTIONAL;
LPVOID lpvExceptionAddress OPTIONAL;
DWORD dwMinidumpFlags;
DWORD dwExceptionThreadMiniFlags;
DWORD dwOtherThreadMiniFlags;
DWORD dwExceptionModuleMiniFlags;
DWORD dwOtherModuleMiniFlags;
DWORD dwBucketParamChars;
LPWSTR lpszBucketParams OPTIONAL;
} WER_EXCEPTION_DATA, *PWER_EXCEPTION_DATA, *LPWER_EXCEPTION_DATA;

WINBASEAPI
BOOL
WINAPI
WerAddExceptionData(
IN HANDLE hReport,
IN DWORD dwFlags,
IN LPWER_EXCEPTION_DATA lpData
);

WER_COPY_FILE_DELETE
WER_COPY_FILE_DEFER_COPY

WINBASEAPI
BOOL
WINAPI
WerCopyFile(
IN HANDLE hReport,
IN LPCWSTR lpszFileName,
IN LPCWSTR lpszReportToken,
IN DWORD dwFlags
);

WER_GATHER_FILE_DELETE

WINBASEAPI

HANDLE
WINAPI
WerGatherData(
IN LPCWSTR lpszReportToken,
IN PVOID lpDataAddress,
IN DWORD dwDataSize
);

WINBASEAPI
HANDLE
WINAPI
WerGatherFile(
IN LPCWSTR lpszReportToken,
IN LPCWSTR lpszFileName,
IN DWORD dwFlags
);

WER_GATHER_REGISTRY_RECURSIVE

WINBASEAPI
HANDLE
WINAPI
WerGatherRegistry(
IN HKEY hRoot,
IN LPCWSTR lpszReportToken,
IN LPCWSTR lpszKeyName,
IN LPCWSTR lpszValueName OPTIONAL,
IN DWORD dwFlags
);

WINBASEAPI
BOOL
WINAPI
WerRemoveGatherEntry(
IN HANDLE hEntry
);

That's about it. Sorry for the mess.
Comments
No one has commented on this article. Be the first!