The following instructions are designed to guide you, step by step through creating toolbars, setting toolbar and button characteristics and receiving event notifications. These tutorials were developed using a Visual C++ version 2005 compiler and they are designed for the WIN32 and X64 C API platform.
To open a project and add code that will create a new toolbar handle:
The following instructions are designed to guide you, step by step through creating toolbars, setting toolbar and button characteristics and receiving event notifications. These tutorials were developed using a Visual C++ version 2005 compiler and they are designed for the WIN32 and X64 C API platform.
To open a project and add code that will create a new toolbar handle:
Start a new project as follows: Run Microsoft Visual Studio 2005, select the File>New>Project, and do the following:
static LRESULT WINAPI WndProc ( HWND hWnd, L_UINT uMessage, WPARAM wParam, LPARAM lParam )
{
static HWND hwndMain ;
static pTOOLBARHANDLE pToolbar ;
switch( uMessage )
{
case WM_CREATE:
if ( SUCCESS == L_TBInit ( &pToolbar ) )
{
POINT pt = { 0, 0 } ;
hwndMain = hWnd ;
// Create the toolbar
L_TBCreate ( pToolbar, hWnd, TEXT("LEAD Toolbar"), TOOLBAR_PAINT ) ;
// Initiate the point will be used to align the toolbar at the top-left of its owner client area */
ClientToScreen ( hWnd, &pt ) ;
// Set the toolbar position
L_TBSetPosition ( pToolbar, &pt, TOOLBAR_POSITION_TOP | TOOLBAR_POSITION_LEFT ) ;
// Show the toolbar
L_TBSetVisible ( pToolbar, TRUE ) ;
return 0L ;
}
else
{
return -1L ;
}
case WM_DESTROY:
if ( SUCCESS == L_TBIsValid ( pToolbar ) )
{
L_TBFree ( pToolbar ) ;
}
PostQuitMessage( 0 ) ;
return 0L ;
default:
break ;
}
return DefWindowProc ( hWnd, uMessage, wParam, lParam ) ;
}
In stdafx.h add the following headers: (keep in mind, you may have to change the path to where the header files reside):
#include "..\\..\\..\\..\\..\\Include\\lttlb.h"
Create a new file called Imports.cpp and place it beside your project files:
#include "StdAfx.h"
#if defined(FOR_WIN64)
#pragma comment(lib, "..\\..\\..\\..\\..\\..\\Lib\\CDLL\\x64\\Ltkrn_x.lib")
#pragma comment(lib, "..\\..\\..\\..\\..\\..\\Lib\\CDLL\\x64\\Lttlb_x.lib")
#elif defined(FOR_WIN32)
#pragma comment(lib, "..\\..\\..\\..\\..\\..\\Lib\\CDLL\\Win32\\Ltkrn_u.lib")
#pragma comment(lib, "..\\..\\..\\..\\..\\..\\Lib\\CDLL\\Win32\\Lttlb_u.lib")
#endif // #if defined(FOR_WIN64)
Initializing and Freeing a Toolbar