Gets the current string for the specified index.
#include "ltwrappr.h"
static L_INT LVectorDialog::GetString(uString, pString)
Index into a list of strings. For a list of the strings, refer to Dialog Strings.
Pointer to the buffer to be updated with the current string.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Before calling this function, call LVectorDialog::GetStringLen to get the length of the text you want to retrieve.
Use LVectorDialog::SetString to modify the automated menu item.
Before calling this function, you must declare a variable as a pointer to a character string. Then, pass the variable in the pString parameter. This function will update the variable with the character string at the given index.
This example will set a custom font and string for the rotate dialog.
# include "Windowsx.h"
L_INT LVectorDialog__GetStringExample(LVectorBase *pVector, HWND hWnd)
{
L_INT nRet;
HFONT hMyFont=NULL;
HDC hDC;
L_TCHAR* pszString=NULL;
L_UINT uLen;
L_TCHAR szNewCaption[] = TEXT("My New Rotate Caption");
LVectorDialog VectorDlg(pVector);
hDC = GetDC(hWnd);
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") );
if(VectorDlg.SetFont( hMyFont ) == NULL)
return FAILURE;
//get the default caption string
nRet = VectorDlg.GetStringLen( VECTOR_DLGSTR_TRANSFORM_ROTATE_CAPTION, &uLen );
if(nRet != SUCCESS)
return nRet;
pszString = (L_TCHAR*) GlobalAllocPtr( GHND, uLen * sizeof( L_TCHAR ) ); //+1 for NULL
nRet = VectorDlg.GetString ( VECTOR_DLGSTR_TRANSFORM_ROTATE_CAPTION, pszString );
if(nRet != SUCCESS)
return nRet;
// display default caption string
MessageBox(hWnd, pszString, TEXT("Default Vector Dialog Rotate Caption"), MB_OK );
GlobalFreePtr( pszString );
// change caption string
nRet = VectorDlg.SetString( VECTOR_DLGSTR_TRANSFORM_ROTATE_CAPTION, szNewCaption );
if(nRet != SUCCESS)
return nRet;
// now, display the dialog to see our changes
VectorDlg.EnablePreview();
VectorDlg.EnableAutoProcess();
nRet = VectorDlg.DoModalVectorRotate();
if(VectorDlg.SetFont (NULL) == NULL)
return FAILURE;
::DeleteObject( hMyFont );
ReleaseDC(hWnd, hDC);
return nRet;
}