#include "lvdlg.h"
L_LVDLG_API L_INT L_VecDlgSetString(uString, pszString)
Sets the new string for the specified index
Index into a list of strings. For a list of the strings, refer to Dialog Strings.
Character string that contains the new string to set.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
To retrieve the character string for a specified index, use L_VecDlgGetStringLen to determine the length of the string and to allocate a buffer of appropriate size. Then call L_VecDlgGetString to retrieve the string.
Required DLLs and Libraries
L_INT VecDlgSetStringExample(
HWND hWnd,
pVECTORHANDLE pVector)
{
L_INT nRet;
HFONT hMyFont = NULL;
HFONT hOldFont = NULL;
HDC hDC;
L_TCHAR* pszString=NULL;
L_UINT uLen;
L_TCHAR szNewCaption[] = TEXT("My New Rotate Caption");
hDC = GetDC( NULL );
/* set a custom font and string for the rotate dialog */
/* NOTE, you should change the font name to a font on your system */
hMyFont = CreateFont( -MulDiv( 8, GetDeviceCaps( hDC, LOGPIXELSY ), 72),
0, 0, 0,
FW_BOLD, FALSE, FALSE, FALSE,
DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY, DEFAULT_PITCH,
TEXT("Bones"));
hOldFont = L_VecDlgSetFont( hMyFont );
/* get the default caption string */
nRet = L_VecDlgGetStringLen( VECTOR_DLGSTR_TRANSFORM_ROTATE_CAPTION, &uLen );
if(nRet != SUCCESS)
{
DeleteObject( hMyFont );
ReleaseDC( NULL, hDC );
return nRet;
}
pszString = (L_TCHAR*)GlobalAllocPtr(GHND, uLen * sizeof(L_TCHAR) + 1 * sizeof(L_TCHAR)); /* add 1, for the terminating NULL */
nRet = L_VecDlgGetString( VECTOR_DLGSTR_TRANSFORM_ROTATE_CAPTION, pszString );
if(nRet != SUCCESS)
{
GlobalFreePtr( pszString );
DeleteObject( hMyFont );
ReleaseDC( NULL, hDC );
return nRet;
}
///* display default caption string */
MessageBox( hWnd, pszString, TEXT("Default"), MB_OK );
GlobalFreePtr( pszString );
/* change caption string */
nRet = L_VecDlgSetString ( VECTOR_DLGSTR_TRANSFORM_ROTATE_CAPTION, szNewCaption );
if(nRet != SUCCESS)
{
DeleteObject( hMyFont );
ReleaseDC( NULL, hDC );
return nRet;
}
/* now, display the dialog to see our changes */
nRet = L_VecDlgRotate(
hWnd,
pVector,
NULL,
NULL,
VECTOR_DLG_SHOW_PREVIEW |
VECTOR_DLG_AUTO_PROCESS,
NULL,
NULL);
L_VecDlgSetFont( hOldFont );
DeleteObject( hMyFont );
ReleaseDC( NULL, hDC );
return nRet;
}