|
DavidCrow wrote: Is that useful? Wouldn't that be irritating to the Chinese user?
Hello All,
Thanks for your replies and suggestion to the given problem, I would try to apply ES_NOIME solution as suggested.
Regarding this requirement, actually we do have a poker table client, wherein various players from various contries(usa, china etc. etc.) will be able to play on the same table. Each player may have his/her own different language version of our software. However we also provide a chat facility, its all lobby chat, and personal chat is allowed. and its possible that 2 chinese player, if allowed to chat in chinese language(which other players may not know), can collude and cheat other players, so thats the reason we wish to restrict the chat input window to support only the english characters. Though we understand that there is no way to prohibit languages that uses english character set, like german.
Thanks again!
Regards
Suyash
|
|
|
|
|
override the WM_CHAR even for that editBox...
but as David told, consider seriously thinking about why you need this (what problem you're trying to solve), and if you cannot solve your problem another way...
|
|
|
|
|
With Richedit controls you can set the EM_NOIME style, this will prevent the user from being able to type chinese characters.Edit controls do not have this feature so you would have to go one step further and handle the WM_IME_CHAR and WM_IME_COMPOSITION yourself. But they would still have the option of being able to paste.
Really there is no simple way to prevent it. You could override the WM_CHAR, but this would involve comparing each character entered against those in the charset GB5 for traditional and GB2312 for simplified. Or limit it even further by only allowing charcters a-z and A-Z, but here you would have problems telling the difference between single byte and multibyte characters.
Another option is to set the font for the control to a font other than system and chinese. This would cause the control to display a special character (usually a box,star or Question mark) for those characters not found in the font.
|
|
|
|
|
Walder, welcome back
i'm sorry to be opposed to you again, but i'm not the one who asked the question
sorry for the disapointment :->
|
|
|
|
|
LOL, don't worry. I'm just under a bit of pressure to get this application finished. But one things for sure, I won't be asking questions again if I can help it.
|
|
|
|
|
lol
hey, don't worry, i'm cool
if you have particuliar points that you cannot find/understand/learn alone, then I'd be glad to help you in this
cheers,
|
|
|
|
|
waldermort wrote:
With Richedit controls you can set the EM_NOIME style...
Perhaps you meant ES_NOIME ?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
haha, so I did. I have no excuse, the 'S' and 'M' are too far apart to blame the keyboard. So, if anybody ask's, it was the wife
|
|
|
|
|
Hi,
Somebody has example on how calling managed (C#) DLL from unmanaged code (VC++ 6) ? I need it for backward compatibility reason.
Thanks before.
|
|
|
|
|
write a regular DLL in managed C++
My blogs:
http://blog.joycode.com/jiangsheng
http://blog.csdn.net/jiangsheng
http://bloglines.com/public/jiangsheng
Command what is yours
Conquer what is not
---Kane
|
|
|
|
|
Any direct link or reference in easier language, pls ? Your blog is half chinese and unfortuantely I don't understood any single letter of it.
Thanks anyway
|
|
|
|
|
|
Hi,
i made a MFC ActiveX Control with Visual Studio 2005!
i just take the default MFC ActivX Control Project!
than i added 3 methodes:
long CActiveX_ControlCtrl::Add(long x, long y);<br />
long CActiveX_ControlCtrl::Sub(long x, long y);<br />
void CActiveX_ControlCtrl::ViewResult(void);
than i read this article:
http://msdn2.microsoft.com/en-us/library/95357zak(vs.80).aspx
i manually added the methods in the DISPATCH_MAP:
------------------------------------------------
BEGIN_DISPATCH_MAP(CActiveX_ControlCtrl, COleControl)<br />
DISP_FUNCTION_ID(CActiveX_ControlCtrl, "AboutBox", DISPID_ABOUTBOX, AboutBox, VT_EMPTY, VTS_NONE)<br />
<br />
DISP_FUNCTION(CActiveX_ControlCtrl, "Add", Add, VT_R4, VTS_R4 VTS_R4)<br />
DISP_FUNCTION(CActiveX_ControlCtrl, "Sub", Sub, VT_R4, VTS_R4 VTS_R4)<br />
DISP_FUNCTION(CActiveX_ControlCtrl, "ViewResult", ViewResult, VT_EMPTY, VTS_NONE)<br />
<br />
END_DISPATCH_MAP()
and 4 lines are added to the control's .IDL:
--------------------------------------------
[ uuid(1103A7D0-19C1-41B5-9EE3-090B71B9ECFF),<br />
helpstring("Dispatch interface for ActiveX_Control Control")]<br />
dispinterface _DActiveX_Control<br />
{<br />
properties:<br />
methods:<br />
<br />
[id(DISPID_ABOUTBOX)] void AboutBox();<br />
[id(1)] long Add(long x, long y);<br />
[id(2)] long Sub(long x, long y);<br />
[id(3)] void ViewResult(void);<br />
};
the implementation of the methode Add:
--------------------------------------
long CActiveX_ControlCtrl::Add(long x, long y)<br />
{<br />
int result = x + y;<br />
stringstream str1;<br />
str1 << x;<br />
MessageBox(str1.str().c_str() , "info");<br />
return result;<br />
}<br />
when i test the activX control with ActiveX Control Test Container the Messagebox show the value "1073741824" when i call the methode with add(3, 3);
hm, any idea?
greets surf
|
|
|
|
|
Try this
long CActiveX_ControlCtrl::Add(long x, long y)
{
int result = x + y;
CString strMsg;
strMsg.Format("%i", result);
MessageBox(strMsg, "info");
return result;
}
Or this
long CActiveX_ControlCtrl::Add(long x, long y)
{
int result = x + y;
char szBuff[20];
itoa(result, szBuff, 10);
MessageBox(szBuff, "info");
return result;
}
-- modified at 11:41 Tuesday 28th March, 2006
|
|
|
|
|
i found the problem;)
i changed my code to:
dispinterface _DActiveX_Control<br />
{<br />
properties:<br />
methods:<br />
<br />
[id(DISPID_ABOUTBOX)] void AboutBox();<br />
[id(1)] long Add(long x, long y);<br />
[id(2)] long Sub(long x, long y);<br />
[id(3)] void ViewResult(void);<br />
BEGIN_DISPATCH_MAP(CActiveX_ControlCtrl, COleControl)<br />
DISP_FUNCTION_ID(CActiveX_ControlCtrl, "AboutBox", DISPID_ABOUTBOX, AboutBox, VT_EMPTY, VTS_NONE)<br />
<br />
DISP_FUNCTION_ID(CActiveX_ControlCtrl, "Add", 1, Add, VT_I4, VTS_I4 VTS_I4)<br />
DISP_FUNCTION_ID(CActiveX_ControlCtrl, "Sub", 2, Sub, VT_I4, VTS_I4 VTS_I4)<br />
DISP_FUNCTION_ID(CActiveX_ControlCtrl, "ViewResult", 3, ViewResult, VT_EMPTY, VTS_NONE)<br />
<br />
END_DISPATCH_MAP()
any idea why i cant take the DISP_FUNCTION like before?
cu
|
|
|
|
|
VTS_R4 is a float, VTS_I4 is a long. doesn't match your function definition. I didn't notice that before.
You should use the wizard & class view this is alot easier
-- modified at 14:13 Tuesday 28th March, 2006
|
|
|
|
|
You should use the wizard & class view this is alot easier ... but how can i call the wizard??????
i only can use CActiveX_ControlCtrl - Add - Add Function than i see the Add Member Function Wizard!
but i manually have to add the definition in the Dispatch map... and the definition in [ uuid(1103A7D0-19C1-41B5-9EE3-090B71B9ECFF),
helpstring("Dispatch interface for ActiveX_Control Control")]
dispinterface _DActiveX_Control
{
properties:
methods:
[id(DISPID_ABOUTBOX)] void AboutBox();
[id(1)] long Add(long x, long y); <---------------------------
right?
i use visual studio 2005!!!
cu
|
|
|
|
|
No your clicking on the actual class. Go to your interface node in the tree and right click and Add --> Add Method... It will generate everything for you.
|
|
|
|
|
ahhh;)
u mean:
ActiveX_ControlLib - _DActiveX_Control - Add Method...
what if i need a variable?
i got to C_ActiveX_ControlCtrl - Add Variable right?
cu
|
|
|
|
|
Yes & Yes.
Properties though are added the same way you add a method.
|
|
|
|
|
thx;)
are u from germany?
|
|
|
|
|
I had a understanding that overriding the the function with variable argument list will result in to ambiguity. However when i tried to compile and run following code on VC++ 6.0, its working as expected :
/////////////////////////////////////
void Func1( int i, ... )
//Lets refer it as Func1VariableArg
{
// do something.
}
void Func1( int i, int j)
//Lets refer it as Func1FixedArg
{
// Do something.
}
class A
{
};
int main(int argc, char* argv[])
{
Func1(1, 1); // Func1FixedArg is called as expected.
Func1(1, "1"); // Func1VariableArg is called as expected.
A a;
Func1(1, a); // Func1VariableArg is called as expected.
// This is the spoil spot
Func1(1, 1.0)// here we would expect Func1VariableArg to
//be called as second argument is double, however compiler
// implicitely typecasts it to int and calls the Func1FixedArg.
// however a warning for the same is issued at complie time.
return 0;
}
/////////////////////////////////////
Some one has any comments about this practice. Do we have any issues in this practice ?, any comments from C++ language specifications on this.
Thanks -
Suyash
|
|
|
|
|
if the compiler can find a function which signature fits exactly to the argument types it receives, then there's no problem.
the ambiguity can arrise when the compiler has to do some implicit conversions...
in you case Func1(1, 1); results in calling void Func1(int, int) because literal numbers are firstly interpreted as int s.
i don't know the priorities of the compiler's implicit casts, but take this for instance :
Func1(1, 'a');
'a' is of type char , but no function Func1(int, char) exists, so it continues looking if this call fits another existing overload before casting some parameters.
only if the compiler makes some implicit casts an ambiguity can come, because the call can then fit several overloads...
|
|
|
|
|
I want to build an application that do something like this:
- give to an ordinary user more rights over a directory or a registry key that is not intend to have normally
- when the application ends the rights are retiered
The need is to hide certain information from the user
|
|
|
|
|
I am about to start using VC++ 2005 but according to the information on MS's website it doesn't not support creation of x64 code.
I found the following page which has instructions for building x64 apps with VS 6 and VS 2003. Would this also work with VS 2005 ?
http://www.devx.com/amd/Article/21313
Is it possible to create x64 code with VC++ 2005 ?
|
|
|
|
|