|
Thans Nick,
I'll give it a try!
Richard
|
|
|
|
|
Hi,
In this example Favorite Bars is field name ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hi,
Yes Favourite Bars is a field name. FindFirst works OK until a key is passed that contains an apostrophe (Joe's Place, for example). I've tried everything I know to work around this (which isn't much).
All ideas appreciated!
Richard
|
|
|
|
|
How can I
type cast a CString to a LPTSTR
to avoid this error:
'type cast' : cannot convert from 'char *(__thiscall CString::*)(int)' to 'char *'
|
|
|
|
|
Try CString::GetBuffer.;)
Oscar L.
|
|
|
|
|
I did but I get a type cast error too.
|
|
|
|
|
Code problem:
This is the structure of rvi:
typedef struct _RVITEM
{
UINT nMask;
INT iItem;
INT iSubItem;
LPTSTR lpszText;
INT iTextMax;
INT iTextColor;
INT iImage;
INT iCheck;
INT iBkColor;
UINT nPreview;
INT iIndent;
UINT nState;
LPARAM lParam;
INT iOverlay;
_RVITEM() : nMask(0), iItem(RVI_INVALID), iSubItem(-1), lpszText(NULL), iTextMax(0), iTextColor(-1), iImage(-1), iCheck(-1), iBkColor(-1), nPreview(0), iIndent(-1), nState(0), lParam(0), iOverlay(0) {};
} RVITEM, FAR* LPRVITEM;
CString strDato;
//The followin returns a CString: pBdeDb->GetFieldAsString(1,&bIsBlank);
strDato = pBdeDb->GetFieldAsString(1,&bIsBlank);
//strncpy(strDato, Dato, strDato.GetLength());
rvi.iSubItem = 0;
rvi.lpszText = strDato.GetBuffer;//<--------------Problem---------
rc.SetItem(&rvi);
|
|
|
|
|
Sorry. Use -> strDato.GetBuffer(0);
But, remember that this buffer is temporary if strDato is local variable.!! To avoid this, create a buffer :
rvi.lpszText = new char[strDato.GetLength()];
strcpy(rvi.lpszText, strDato);
Oscar L.
|
|
|
|
|
Thank you very much.
|
|
|
|
|
Te aconsejo usar strcpy(rvi.lpszText, strDato.GetBuffer(0));
Cheers!!!
Carlos Antollini.
|
|
|
|
|
Ese tambien funciona. La diferencia esta en que la primera devuelve un LPCTSTR (que es constante y es menos peligrosa) y la segunda devuelve un LPTSTR que se puede modificar directamente.
Si deseas poder usar cast:
strcpy(rvi.lpszText, (LPCTSTR) strDato);
Oscar L.
|
|
|
|
|
Abusando de tu amabilidad:
Podrias enseñarme como convierto de:
double a LPTSTR.
BOOL PTSTR.
COleDateTime a LPTSTR.
Long a LPTSTR.
int a LPTSTR.
|
|
|
|
|
Jose!
Dale un vistazo a la documentación de CString::Format con la cual podes realizar las conversiones tipo sprintf.
De igual forma COleDateTime tambien tiene el método COleDataTime::Format.
Oscar L.
|
|
|
|
|
y que tal de int, long y BOOL a LPTSTR
|
|
|
|
|
Gracias.
Podrias echarme la mno con mi otra pregunta.
de como convertir de los otros diferentes tipos de datos a LPTSTR
|
|
|
|
|
Usa wsprintf.
LPTSTR str = NULL;
int n = 1000;
malloc((LPTSTR)str, 256); //or the size that you want
wsprintf(str, "%d", n); //int -> LPTSTR
Check the documentatión about wsprintf for other types.
Carlos Antollini.
|
|
|
|
|
También tenes las funciones itoa() y ltoa() para convertir the int y long a Ascii
luego lo convertis a LPCTSTR.
El booleano es sencillo.
BOOL bVAl = TRUE;
LPTSTR str = bVal ? "TRUE": "FALSE";
Saludos
Carlos Antollini.
|
|
|
|
|
Is there any site that has VC++ source code for N-ary tree? Or is there such class provided by MS Visual studio?
|
|
|
|
|
|
That's a clever aphorism in your sig... Just out of interest, where is it from?
|
|
|
|
|
Thanks Nick,
It is just a disclaimer so my answers here don't get mixed up with my work , ideological background or my hair cut preferences
Cheers
It is Illogical to define an inventor by his invention
|
|
|
|
|
Hi all,
Please explain to me, how can i add LIB to my project ? and how can i use of it ?
Because, first i copy the LIB files to my project directory, then in Project Setting i wrote the lib file in Link section in setting ...
But, i want to add the classes from LIB file to my project which i'll can use of classes in my project ...
Please help me ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
You'll need to include the LIB's .h files into your source code then you'll be able to inherit the classes into your own classes.
Michael
|
|
|
|
|
Thanks alot,
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
hey hadi
are you talking about the crystal reports thing again? you must link in crpe32m.lib (i think thats what is called) in your project settings as well as include the .h file in your stdafx.h file
i emailed you some sample code earlier today and the files you need to include ... did you get them?
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|