|
By default Katakana charactor (in Japanese) takes two bytes, but it can also be displayed using one byte(that reduces charactor width). Is there any standard way to convert two byte Katakana charactors in to one byte charactor in a given string that may have Kanji and Katakana in it.
Please guide.
|
|
|
|
|
No there isn't. You'll have to use some customized compression technique on the strings. But, when you wanted to do ANYTHING with them, like display them or manipulate the strings in any way, you'd have to decompress what your using.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi , i click button1 to open form1. if i click the button1 again, i don't want to open a new form1 BUT focus on the already opened form1. i tried for1.focus() but is not working. why?
Chris
|
|
|
|
|
Create Form1 as Singleton class. this will solve the problem
|
|
|
|
|
|
Try this.
<br />
private Form Frm;<br />
private void button1_Click(object sender, System.EventArgs e)<br />
{<br />
if(Frm!=null)<br />
{<br />
Frm.TopMost=true;<br />
Frm.Activate();<br />
<br />
}<br />
else<br />
{<br />
Frm=new Form();<br />
Frm.TopMost=true;<br />
Frm.Show();<br />
}<br />
<br />
}
Sreejith Nair
[ My Articles ]
|
|
|
|
|
Hi, all.
I am working on a C# code that can retrieve system log by using WMI.
However, the code is working fine under windows 2000, but got error messages
under Windows XP.
The erro message is :
Unhandled Exception: System.Management.ManagementException:Access denied.
at System.Management.Management.Exception.ThrowWithExtendedInfo(ManagementStatus errorCode)
at System.Management.ManagementEventWatcher.Start()
Part of my code is like following and I believe this is where the problem at:
----------------------------------------------------------------
public static ManagementEventWatcher getWatcher(string comp, string LogName)
{
ConnectionOptions co;
ManagementPath mp;
ManagementScope ms;
WqlEventQuery EventQuery;
ManagementEventWatcher watcher;
string wql;
string wqlAnd;
co = new ConnectionOptions();
co.Timeout = new TimeSpan(0, 0, 60);
co.EnablePrivileges = true;
mp = new ManagementPath();
mp.NamespacePath = @"\root\cimv2";
mp.Server = comp; // comp is the computer you are connecting to
ms = new ManagementScope(mp, co);
Console.WriteLine("host is" + comp +"Logname is "+LogName);
switch(LogName.ToUpper())
{
case "ALL":
wqlAnd = "";
break;
case "SECURITY":
wqlAnd = " AND TargetInstance.Logfile ='Security'";
break;
case "SYSTEM":
wqlAnd = " AND TargetInstance.Logfile ='System'";
break;
case "APPLICATION":
wqlAnd = " AND TargetInstance.Logfile ='Application'";
break;
default:
wqlAnd = "";
break;
}
wql = "select * from __instancecreationevent where targetinstance isa 'Win32_NTLogEvent'" + wqlAnd;
EventQuery = new WqlEventQuery(wql);
watcher = new ManagementEventWatcher(ms, EventQuery);
Console.WriteLine("end of first watcher");
return watcher;
}
---------------------------------------------------------
Could any of you tell me how to solve this problem?
Thanks a lot.
|
|
|
|
|
|
Thanks for replying.
the code is running under admin privileges.
|
|
|
|
|
Is this code running with full trust on both machines? According to the docs, ManagementEventWatcher.Start requires full trust to run, so if you're running it across your network with the default code access security settings, it won't work.
Charlie
if(!curlies){ return; }
|
|
|
|
|
Ever hear to try/catch blocks
Ex:
public void Example()
{
try
{
}
catch(Exceptopn){}
catch(Excetion e)
{
Console.WriteLine(e.ToString());
}
}
One part of my progs
<br />
#region Constructor<br />
private Game(Control cTarget)<br />
{<br />
try<br />
{ <br />
this.target = cTarget;<br />
this.target.GotFocus += new System.EventHandler(this.Restore);<br />
<br />
this.graphics = new GraphicsHandler(this.target);<br />
this.sounds = new SoundHandler(this.target);<br />
this.keyboard = new InputHandler(this.target);<br />
<br />
this.presentState = new GameState();<br />
this.previousState = new GameState();<br />
this.presentData = new GameData();<br />
this.presentDataTemp = this.presentData.DeSerialize();<br />
<br />
this.physics = new GamePhysics();<br />
<br />
this.InitGame();<br />
<br />
Timer.Init();<br />
}<br />
catch(Exception e)<br />
{<br />
MessageBox.Show("ERROR WHILE INITIALIZING GAME " + e.ToString());<br />
return;<br />
}<br />
<br />
this.presentState = GameState.Initialized;<br />
this.previousState = GameState.Initialized;<br />
<br />
this.GameLoop();<br />
}<br />
#endregion<br />
cdmlb
|
|
|
|
|
To add to what Charlie said, and he's got the most likely answer to your problem, ...
He, and I, are both assuming that your running your application from a network share. Even though your logged in under an admin account, the .NET Framework will not give your application Full Trust to run. Read up on Code Access Security here[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi!
As you know,even though there is not any card in the socket of the cardreader,when we attach the cardreader to
the PC,the OS can show us how many drivers this cardreader
has,such as:CARD(G),CARD(H),etc. And,as far as I know, the message WM_DEVICECHANGE must be broadcasted when the
cardreader attached to the PC,but after this,when you insert the card(s)(such as CF,MS,MFC,etc.) into the socket(s),I suppose there is not any message be broadcasted.Am I right?If I am wrong,then can you tell me which kind of message(or something else which can inform us that card(s) arrived) will be broadcast when the card(s) be inserted the socket(s) of the cardreader? If I am right,then can you tell me how can I know the card arrival and leaving?
Thanks!
Best wishes!
momer
|
|
|
|
|
Ask in the correct forum please. This doesn't have anything to do with .NET.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
How can I let my .net program run after clicking my custom menu in IE contextMenu?
Assuming I know how to modify the register
me
|
|
|
|
|
Jason Xie wrote:
How can I let my .net program run after clicking my custom menu in IE contextMenu?
Assuming I know how to modify the register
Your question is rather nebulous; could you please clarify or post some code? Did you write an IDocHostUIHandler for an embedded IE control? More information will be helpful in answering your question.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Thanks.
.net code following:
******************************
using System;
namespace DiscussInterface
{
public class Class1
{
//Form1 is only a simple form.
Form1 f= new Form1();
public Class1()
{
}
public void Show()
{ f.Show();
}
}
public class Form1 : System.Windows.Forms.Form
{
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.Size = new System.Drawing.Size(300,300);
this.Text = "Form1";
}
#endregion
}
}
********************************
I have a html page following
****************************
I modify the windows register and add key under HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\
more detail
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/ext/tutorials/context.asp[^]
*************************************
when I click my custom menu in IE explore context menu, my .net program run and disappear immediately.
me
|
|
|
|
|
Jason Xie wrote:
when I click my custom menu in IE explore context menu, my .net program run and disappear immediately.
You need a modal dialog, try calling ShowDialog() instead.
var wdApp = new ActiveXObject("DiscussInterface.Class1");
wdApp.ShowDialog();
- Nick Parker My Blog | My Articles
|
|
|
|
|
DiscussInterface.Class1 has no method "ShowDialog()".
and
when I change the f.Show() to f.ShowDialog(),it disappears immediately,too.
me
|
|
|
|
|
Jason Xie wrote:
DiscussInterface.Class1 has no method "ShowDialog()".
Sorry, I missed the fact that you were embedding a Form within Class1 . Why don't you change your code around so that it is inheriting from System.Windows.Forms.Form ? That way your not wrapping all the method the Form is providing you. ShowDialog() works for me.
- Nick Parker My Blog | My Articles
|
|
|
|
|
I try it by you suggest.but failed again.
I think that
Automation object can run . but how I can build the object.
me
|
|
|
|
|
when i try to compile this code I get this error:
Program 'xxx.exe' does not have an entry point defined
What am i doing wrong?
|
|
|
|
|
The code is compiled to **.dll,not to **.exe
me
|
|
|
|
|
Greetings all,
Comming from a unix/C background here I'm attempting to get the length of a string entered from the user. Here is some code...
namespace _250_question_1
{
class HowEasy
{
public int pointVal(string input)
{
int word_count = 0;
for(int x = 0; x <= strlen(input); x++)
if(input[x] == " ") word_count++;
if(word_count <= 3) return 250;
if((word_count == 4) ||
(word_count == 5)) return 500;
if(word_count >= 6) return 1000;
}
static void Main(string[] args)
{
string user_input;
Console.WriteLine("Please enter a string:");
Console.ReadLine(user_input);
pointVal(user_input);
}
}
}
The algorithm is how I would do it in C, However in C# I can't compare an array element (string[x]) for equality. Not only that, I would normally use strlen() in for() and apparently the standard C library isn't used. Could anyone rewrite this in C# so I can see what's going on, or at least give me some hints?
Thanks all!!
kha0s
"There are 10 types of people in this world; Those that know binary and those that do not."
|
|
|
|
|
Use a regular expression, or even better, Split and count your array.
To get the string length, just use the Length property.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|