|
When AnimateWinodw finishes it's processing then it waits for 4 seconds and then pop back. I need to click at the time when it wait for 4 second. I know i can't click anything when it's playing animation. Just need to click when it stops for 4 second...
|
|
|
|
|
Do i need to update or invalidate the Window when animatewindow stops??
I tried that but no success. Can someone throw any light on that??
Thanks..
|
|
|
|
|
Hi
Please excuse my english. I'm from germany.
Does anybody know if it's possible to call managed code (c#) from VC++ 6.0? I already found the ManWrap Library, but this library does not work with VC++ 6.0.
I hope somebody knows an alternative.
Thank you very much in advance
modified on Tuesday, October 14, 2008 10:30 AM
|
|
|
|
|
Why are you doing it anyways? If you are already using managed code, why not just write the entire thing in managed code?
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
I know. But in this case this doesn't work. It has to be VC++ 6.0. Not my decision.
|
|
|
|
|
This is not really the right forum and I'm not an expert but I think the answer you're looking for is COM InterOp. VC++6 can create and also use COM objects, so can C# through the InterOp library. At worst you'll need to create a separate 'broker' object that's an 'automation' compatible COM object which is written in C++ but CoCreated from the C# side and talks with the rest of your C++ code by COM or whatever means you wish.
C#Class ---> CoCreate functionality in OS ---> automation COM object ---> Your C++ stuff
C#Class <--- InterOp functionality in OS <--- automation COM object <--- Your C++ stuff
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|
|
Thanks that helped me a lot!
Could i also write the COM object in C#, expose it and call it from VC++ 6.0?
|
|
|
|
|
playxn wrote: Could i also write the COM object in C#, expose it and call it from VC++ 6.0?
I think that should be possible but I've never done it that way round myself. I'm not sure how you'd do an automation compatible COM object in C# itself but then I'm no C# expert. I guess the guys on the C# forum will know all about it though. Good luck.
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|
|
Hello,
I am working on a chat application where we enter some text in the edit box.
The text i need to convert it in UTF8 encode. I am able to encode it but there is only one problem that is if the text consist of + or & sign it is not able to convert and the text after + or & sign is omitted.
Please tell me whats the problem.
I am sending the code.
void CChatDlg::OnSendmsg()
{
CString strText;
GetDlgItemText(IDC_EDIT,strText);
strText = g_ChatManager.UTF8andURLEncode(strText);
}
CString CChatManager::UTF8andURLEncode(CString sIn)
{
return EncodeToUTF8(sIn);
}
CString CChatManager::URLEncode(CString sIn)
{
CString sOut;
const int nLen = sIn.GetLength();
for (int i = 0; i<nLen; i++)
{
TCHAR c = sIn.GetAt(i);
if(iswalnum(c))
sOut.AppendChar(c);
else
if(_istspace(c))
sOut.AppendChar(_T('+'));
else
{
int ic = _TINT(c);
sOut.AppendChar(_T('%'));
sOut.AppendChar(toHex((BYTE)(ic>>4)));
sOut.AppendChar(toHex((BYTE)(ic%16)));
}
}
sOut.AppendChar(_T('\0'));
return sOut;
}
CString CChatManager::EncodeToUTF8(LPCTSTR szSource)
{
WORD ch;
BYTE bt1, bt2, bt3, bt4, bt5, bt6;
int n, nMax = _tcslen(szSource);
CString sFinal, sTemp;
for (n = 0; n < nMax; ++n)
{
ch = (WORD)szSource[n];
if (ch == _T('='))
{
sTemp.Format(_T("%%%02X"), ch);
sFinal += sTemp;
}
else if (ch < 128)
{
sFinal += szSource[n];
}
else if (ch <= 2047)
{
bt1 = (BYTE)(192 + (ch / 64));
bt2 = (BYTE)(128 + (ch % 64));
sTemp.Format(_T("%%%02X%%%02X"), bt1, bt2);
sFinal += sTemp;
}
else if (ch <= 65535)
{
bt1 = (BYTE)(224 + (ch / 4096));
bt2 = (BYTE)(128 + ((ch / 64) % 64));
bt3 = (BYTE)(128 + (ch % 64));
sTemp.Format(_T("%%%02X%%%02X%%%02X"), bt1, bt2, bt3);
sFinal += sTemp;
}
else if (ch <= 2097151)
{
bt1 = (BYTE)(240 + (ch / 262144));
bt2 = (BYTE)(128 + ((ch / 4096) % 64));
bt3 = (BYTE)(128 + ((ch / 64) % 64));
bt4 = (BYTE)(128 + (ch % 64));
sTemp.Format(_T("%%%02X%%%02X%%%02X%%%02X"), bt1, bt2, bt3, bt4);
sFinal += sTemp;
}
else if (ch <=67108863)
{
bt1 = (BYTE)(248 + (ch / 16777216));
bt2 = (BYTE)(128 + ((ch / 262144) % 64));
bt3 = (BYTE)(128 + ((ch / 4096) % 64));
bt4 = (BYTE)(128 + ((ch / 64) % 64));
bt5 = (BYTE)(128 + (ch % 64));
sTemp.Format(_T("%%%02X%%%02X%%%02X%%%02X%%%02X"), bt1, bt2, bt3, bt4, bt5);
sFinal += sTemp;
}
else if (ch <=2147483647)
{
bt1 = (BYTE)(252 + (ch / 1073741824));
bt2 = (BYTE)(128 + ((ch / 16777216) % 64));
bt3 = (BYTE)(128 + ((ch / 262144) % 64));
bt4 = (BYTE)(128 + ((ch / 4096) % 64));
bt5 = (BYTE)(128 + ((ch / 64) % 64));
bt6 = (BYTE)(128 + (ch % 64));
sTemp.Format(_T("%%%02X%%%02X%%%02X%%%02X%%%02X%%%02X"),
bt1, bt2, bt3, bt4, bt5, bt6);
sFinal += sTemp;
}
}
return sFinal;
}
Please help me
Thanks In advance
Dhiraj
|
|
|
|
|
Couldn't you just use WideCharToMultiByte(CP_UTF8, ...)?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
please help me with some code as to how to use WideCharToMultiByte(CP_UTF8, ...)
Thanks In Advance
|
|
|
|
|
What is the type of characters passed to your EncodeToUTF8 method?
You use LPCTSTR as the passed parameter type, which can be a
const char * or a const wchar_t * ... which is it?
If you are going to do specific character set conversions, you need
to use specific char types, not generics.
Here's an example of your EncodeToUTF8() method for a Unicode build
<code>CStringA</code> CChatManager::EncodeToUTF8(LPCTSTR szSource)
{
CStringA utf8str;
#ifdef _UNICODE
int utf8length = ::WideCharToMultiByte(CP_UTF8, 0, szSource, -1, NULL, 0, NULL, NULL);
if (utf8length > 0)
{
char *utf8strchars = utf8str.GetBuffer(utf8length - 1);
::WideCharToMultiByte(CP_UTF8, 0, szSource, -1, utf8strchars, utf8length, NULL, NULL);
utf8str.ReleaseBuffer();
}
#endif
return utf8str;
}
Note I changed the return type to a more specific CStringT type that
is the most appropriate for UTF-8.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
is there a way to switch off implicit inline,
that is
class ClassOfImplementationNamespace
{
void itsFunc(int x)
{
}
};
should no more give a compiler hint automatically,
to inline this. Something like a #pragma NoImplicitInline?
Thank you,
Werner
|
|
|
|
|
WernerP wrote: Something like a #pragma NoImplicitInline?
You are possibly looking for auto_inline(off)[^].
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
WernerP wrote: is there a way to switch off implicit inline,
Such as the /Ob0 compiler switch?
There's also #pragma auto_inline(off) .
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I think it's the compiler option "/Ob0" you want.
See here[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Thank you. I'm not quite certain, whether this is, what I want.
What I definitely do not want is to prevent the compiler from inlining. I think it knows best.
What I actually want is to switch that implicit "inline" off, which is automatically associated with the function, although you don't see it, and which is a sweettalk to the compiler to inline the function whatever might be best.
Werner
|
|
|
|
|
WernerP wrote: What I definitely do not want is to prevent the compiler from inlining. I think it knows best.
..........
What I actually want is to switch that implicit "inline" off, which is automatically associated with the function, although you don't see it, and which is a sweettalk to the compiler to inline the function whatever might be best.
I find these two conditions to be contradictory.
In the first you want the compiler to decide, but in the second you don't want it to be automatic....
It's probably the compiler option "/Ob1" you want, but you should also have a look at what happens when you're using the keywords for inlining here[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Roger Stoltz wrote: find these two conditions to be contradictory.
In the first you want the compiler to decide, but in the second you don't want it to be automatic.... Confused Unsure
In the second I *want* it to be automatic. That's my point. The inline keyword, and I think implicit inline too, means, that you don't let the compiler be automatic but try to tell him what to do. This is what I *don't* want and would like to switch off.
Regards
Werner
|
|
|
|
|
WernerP wrote: The inline keyword, and I think implicit inline too, means, that you don't let the compiler be automatic but try to tell him what to do.
Read the link I provided in my previous post and you will find that you cannot force the compiler to do inline expansion, not even with __forceinline .
The "implicit inline" your talking about must be the "/Ob2" compiler setting, thus if you're not compiling your code with that option, there won't be any "implicit inline".
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
I will do that. Thank you. Maybe I misunderstood the definition of implicit inline? I understood, that if a function is defined like that
class A
{
void someFunc()
{
}
}
this is equivalent to
inline void A::someFunc()
{
}
and I want it to be equivalent just to
void A::someFunc()
{
}
Best regards
Werner
|
|
|
|
|
WernerP wrote: The inline keyword, and I think implicit inline too, means, that you don't let the compiler be automatic but try to tell him what to do. This is what I *don't* want and would like to switch off.
Marking something as inline (while you think it would be beneficial) may turn out to be expensive too (well, with certain cases). So, the best way is to let the compiler do the dirty work for you. I am believing that I can never outsmart the compiler on making such a decision.
With the default settings, the compiler won't inline any function automatically.
BTW - Instead of the switch, the #pragma directive would give you greater flexibility on where to impose the restriction, in case you need it.
[Added] BTW - if that is you who has low-voted this post of mine, please do let me know what is that you feel so bad about it.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
modified on Tuesday, October 14, 2008 11:29 AM
|
|
|
|
|
Dear Rajesh,
I am very sorry, this happened automatically because in Germany marks at school are like that 1 = best, 6 = worst. I still can't get rid of that.
Thank you very much and best regards
Werner
|
|
|
|
|
WernerP wrote: I am very sorry, this happened automatically because in Germany marks at school are like that 1 = best, 6 = worst. I still can't get rid of that.
Thanks for the explanation. It is times like this when I realise CP is a truly global community.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
but the true question is : why would you do that ?
|
|
|
|
|