|
SaRath C wrote: I think type defined by TCHAR has dependency to the current build environement(unicode/ MBCS). The compiler will define char array instead of unicode character array (wchar_t)in an MBCS environment. so there is a chance for error.
Actually TCHAR is defined as :-
#ifdef UNICODE
#define TCHAR wchar_t
#else
#define TCHAR char
#endif so you can use in both Character set. plus little mistake from my side too, wsprintf should be written something like this to make it character set independent
wsprintf(szChar,_T("%d"),100);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Thanks ThatsAlok
I'm getting there is almost working
how about doubles?
Appreciate the help
|
|
|
|
|
|
antonaras wrote: how about doubles?
use %e format
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Re
|
|
|
|
|
Hey ThatsAlok
i tried your code and it works fine with integers but i have
double valField4;
TCHAR szStr2[100];
wsprintf(szStr2,"%e",valField4);
_bstr_t bstText2(szStr2);
printf("%s\n",(LPCSTR)bstText2);
the otput for bstText2 that i get is e
why does that happen thanks again
|
|
|
|
|
If you are familiar with STL, you can use one more method:
int i = 1234567;
double d = 123.4567;
_bstr_t s1, s2;
{
std::ostrstream os;
os << i << std::ends;
s1 = os.str();
}
{
std::ostrstream os;
os << d << std::ends;
s2 = os.str();
}
|
|
|
|
|
Thanks Viorel
i tried your code but i get lots of compilation errors
'ostrstream' : undeclared identifier
syntax error : missing ';' before identifier 'os'
'os' : undeclared identifier
and so on
what i'm doing wrong i have included string is there anything else i need to include
thanks
|
|
|
|
|
In order to use these STL features, you have to include a header file:
#include <strstream>
Next, you may receive an "unresolved external symbol" error displayed by the linker. In this case, you have to make one more addition: specify "comsuppwd.lib" in the "Linker --> Input --> Additional Dependencies" configuration option of your project. (In release compilation mode, specify "comsuppw.lib").
You can always see which header file or library is required by analyzing the descriptions in MSDN.
|
|
|
|
|
thanks Viorel is working fine now thanks for all the help
|
|
|
|
|
antonaras wrote: can i convert
integers and doubles to _bstr_t;
Just assign them:
double d;
int x;
_bstr_t str;
str = d;
str = (long) x;
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi.
I am creating a project which needs a GUI (although it can work without GUI).
I need some classes or some library which could manage creating small dragable windows with multiple nodes on the sides of the windows. And of course ability to interactively connect window nodes with lines between windows. I started to do it myself and I have already made windows and connection management but I have many troubles - it is hard to track and disable all these redraws and erases for the main window and child windows so I have a total mess of overriden OnPaint and OnEraseBackground message handlers which still do not act as I need.
So I thought maybe there are some free downloadable snippets/classes/libraries which could help me?
I know many programs have such "subwindow networks" (like kX driver project, Microsoft DirectX Graph Edit Utility).
The problem is that I cannot imagine how could I call this class library or smth. like that so I do not know what to "google" for (English is not my native). The only thing I found is GO++:
http://www.hallogram.com/go++/index.html[^]
and it is not free. But it looks like the thing I need.
Would be grateful for some useful advice or link to something like GO++ open-source or free library.
Thanks
|
|
|
|
|
OK, finally I did it myself. But I had to completely override OnPaint and OnErase functionality and call redraws in another ways. It still is kinda jumpy but it works!
|
|
|
|
|
Hi,
I need to scale the image frame that I captured from a AVI player, The image can in BYTEs or BITMAP.
Please help me to do this.
Thank in advance!
|
|
|
|
|
|
huutribk2001 wrote: BITMAP.
Is StretchBlt of any use
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hello!
How do i call MyFunction in _asm block, for a VC++ code?
my function takes a "char*" value as its parameter.
///////////////////////////////////////////////////////
_asm
{
Main2 :
push eax
lea eax, text
mov eax, [eax]
push eax
Call MyFunction
pop eax
pop eax
text: __asm _emit 'Z' __asm _emit ' ' __asm _emit '0'
}
//////////////////////////////////////////////////////
void MyDecode(char* chCaption) {
AfxMessageBox(chCaption);
};
Zo.Naderi-Iran
|
|
|
|
|
The following fragment seems to work:
void MyFunction(char* chCaption)
{
MessageBox(0, chCaption, "", 0);
}
void main()
{
_asm
{
push eax
lea eax, text
push eax
Call MyFunction
pop eax
pop eax
}
return;
text: __asm _emit 'Z' __asm _emit ' ' __asm _emit 0
}
Your problems was:
- The "
mov eax, [eax] " instruction hase no sence; - The
text string is incorectly ended with '0' instead of 0 ; - No exit function at the program end; I used the
return instruction in this sample.
|
|
|
|
|
Thank you Viorel!
I corrected them.
Zo.Naderi-Iran
|
|
|
|
|
Hi All,
when I get the client rect, I used to pass GetClientRect(rect);
but in many places i have seen that GetClientRect(rect); and GetClientRect(&rect); interchangeably. but the result is same.
Actually what is happening in teh above scenario.
SaRath.
"Don't Do Different things... Do Things Differently..."
|
|
|
|
|
SaRath. wrote: when I get the client rect, I used to pass GetClientRect(rect);
but in many places i have seen that GetClientRect(rect); and GetClientRect(&rect); interchangeably. but the result is same.
GetClientRect(rect);
In this scenario we pass object as Value
GetClientRect(&rect);
In this scenario we pass object as Reference
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
A_LaxmanGetClientRect(&rect);
In this scenario we pass object as Reference
false... we pass the object by pointer.
in this case, the prototype of the function is not GetClientRect(RECT&); but GetClientRect(RECT*);
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
When GetClientRect(RECT&); prototype used??
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
|
The CWnd::GetClientRect function actually requires an argument of type “pointer to RECT ” -- RECT * , or LPRECT .
Nevertheless, this function can be used in more contexts:
RECT rect1;
GetClientRect(&rect1);
<br>
CRect rect2;
GetClientRect(&rect2);
CRect rect3;
GetClientRect(rect3);
The design of CRect class allow you to use it with Windows functions that actually require LPRECT .
-- modified at 6:10 Tuesday 6th June, 2006
|
|
|
|
|
Thanks for the detailed reply.
when I have checked the MFC defintion of CRect, I could find that
the operators are defined as follows
operator LPRECT() throw();
operator LPCRECT() const throw();
SaRath.
"Don't Do Different things... Do Things Differently..."
|
|
|
|