L_VecDlgSetString

#include "lvdlg.h"

L_LVDLG_API L_INT L_VecDlgSetString(uString, pszString)

L_UINT32 uString;

/* index of a string */

const L_TCHAR * pszString;

/* character string that contains the string to set */

Sets the new string for the specified index

Parameter

Description

uString

Index into a list of strings. For a list of the strings, refer to Dialog Strings.

pszString

Character string that contains the new string to set.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

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

LVDLG

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

L_VecDlgGetStringLen, L_VecDlgGetString

Topics:

Vector Common Dialogs

Example

L_INT VecDlgSetStringExample(
   HWND hWnd,
   pVECTORHANDLE pVector)
{
   L_INT    nRet;
   HFONT    hMyFont = NULL;
   HFONT    hRet;
   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"));
   hRet = L_VecDlgSetFont( hMyFont );
   if (hRet == NULL)
      return FAILURE;

   /* get the default caption string */
   nRet = L_VecDlgGetStringLen( VECTOR_DLGSTR_TRANSFORM_ROTATE_CAPTION, &uLen );
   if(nRet != SUCCESS)
      return nRet;

   pszString = (L_TCHAR*) GlobalAllocPtr( GHND, uLen * sizeof( L_TCHAR ) + 1 ); /* add 1, for the terminating NULL */
   nRet = L_VecDlgGetString( VECTOR_DLGSTR_TRANSFORM_ROTATE_CAPTION, pszString );
   if(nRet != SUCCESS)
      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)
      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);
   if(nRet != SUCCESS)
      return nRet;

   hRet = L_VecDlgSetFont( NULL );
   if (hRet == NULL)
      return FAILURE;

   DeleteObject( hMyFont );
   ReleaseDC( NULL, hDC );
   return SUCCESS;
}