|
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"
|
|
|
|
|
Hi,
No lauren ...
I had stupid question, maybe ...
---
About Crystal Report, i got your example, it was very nice ... but my Crystal Report version is 7.0, and you sent to me Crystal Reports header files for version 8.0 ...
Can you tell me, how can i download the header files(peplus.h and peplus.cpp) for Crystal Report 7.0 ???
Thanks again,
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
go to www.crystaldecisions.com and search for files called peplus.*
i found a version for cr vr 6 and cr vr 8 but not 7
maybe ask the tech support people for what version you can use
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Alright I'm trying to intercept the Messages sent to a paticular window like Spy++ that comes with MSVS. I have a DLL file that (I think) starts and stops a global hook. When I start the test program (or step debug the DLL) the messages stop getting sent to the window that i'm blocking, but aren't getting sent to my callback function. I would greatly appericate it if anyone could enlighten me with some help. I can give more info or code if nessacary. Thanks
Alex Waag
alexxwaag@hotmail.com
My Software nerver has bugs, It just develops random features.
|
|
|
|
|
Take a look to samples on MSDN.
Try this "DLL: Windows Message Spy Sample" or "Spy: Monitoring Messages with SPY".
Good luck.
Oscar L.
|
|
|
|
|
I create a dynamic array in a function:
int* pNumber = new int [SomeProgramVariable];
for (inti=0;i{
*(pNumber+i) = i;
}
...
...
delete [] pNumber;
I want to return the pNumber, so that another function can use this pointer.....for example, I can call this function liked...... GetPointer(pNumber)....and when the function calls this, it can get pNumber from the parameter.........
But I cannot get the information i want.....
how to do it???
|
|
|
|
|
First of all, do not delete it!
However, you have to store the pointer somewhere, in a global variable or, better, in a member variable if you're using classes.
Then provide whichever method you prefer to access the pointer. If it's global or public memeber you don't need an access function, otherwise provide one.
Hope this helps,
Paolo.
|
|
|
|
|
You should no delete it!
If you need it as return value, declare:
int *GetPointer()
{
int *pNumber = new int [SomeProgramVariable];
...
return pNumber;
}
If you need it as parameter, pointer to pointer is necesary because you are allocate memory on function body:
void GetPointer(int **pNumber)
{
*pNumber = new int [SomeProgramVariable];
...
}
|
|
|
|
|
>>void GetPointer(int **pNumber)
>>{
>> *pNumber = new int [SomeProgramVariable];
>> ...
>>}
"pointer to pointer" is just plain silly - in C++ it should almost always be reference to pointer :
void GetPointer(int *&pNumber)
{
pNumber = new int [SomeProgramVariable];
...
}
With "pointer to pointer" the following code compiles but crashes
GetPointer(NULL);
With "reference to pointer" it would never compile.
|
|
|
|
|
Ok. That's good. It's an alternate form.
No necesary it's plain silly!
Remember, good programers don't trust only on compiler. You should verify every part of code. And, if you look COM interfaces, 'pointer to pointer' is essential.
Oscar L.
|
|
|
|
|
This may be a dumb question, but I'm having trouble getting the CIPAddressCtrl in my application. When I place a IP Address Control on the dialog in the resource editor I can't start my app. The Run function fails to create my main Dialog when the app starts. If I try and manually create a CIPAssressCtrl in my OnInitDialog the create method return 0 every time. Anybody got some examples that I could look at?
Timothy Bish
|
|
|
|