|
|
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
|
|
|
|
|
How about using some of the methods and properties of the String class. An example:
string s = "Nick Parker";
int len = s.Length;
Console.WriteLine("string:{0} length:{1}", s, len);
- Nick Parker My Blog | My Articles
|
|
|
|
|
public int pointVal(string input)
{
int count = input.Split(new char[] {' '}).Length - 1;
if (count <= 3) return 250;
if (4 ==count || 5 == count) return 500;
if (count >= 6) return 1000;
}
Grim (aka Toby) MCDBA, MCSD, MCP+SB
SELECT * FROM user WHERE clue IS NOT NULL
GO
(0 row(s) affected)
|
|
|
|
|
Hello I have a technical question:
I am working in a project.my code is in a seperate DLL ,separate class.The point is it works correctly on most of the inputs.However on some inputsit gives the following alert box message:
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
Additional information: Index was out of range. Must be non-negative and less than the size of the collection.
I know this type of exception,but the problem is when i place a breakpoint (anywhere in the class,even in the constructor)to start debugging,in the debug mode itwould give the following message:
There is no source code available for the current location.
SHow dissassembly automatically
and ofcourse the cursor wont be standing on any line,to allow me to start debugging.
Does this mean that the first exception occured in another class or DLL which is not related to my code?
Thanks a million
|
|
|
|
|
hi,
your Wrote :'System.ArgumentOutOfRangeException' and 'ndex was out of range. Must be non-negative and less than the size of the collection' - > Please check your collection , whether you are not trying to access which is not there in the list.
You Wrote :Does this mean that the first exception occured in another class or DLL which is not related to my code?
Here you are assumption may correct. Try to use proper error handling methods in your .dlls. Otherwise try to throw exception to your base.
//code in dll file.
public void add()
try
{
//something
}
catch(Exception Ex)
{
throw Ex;
}
//code in your application.
try
{
dll_instance.Add();
}
catch(Exception Ex)
{
Messagebox.show(Ex.StachTrace.ToSting());
}
//Here you will get information from where error occures.
Sreejith Nair
[ My Articles ]
|
|
|
|
|
You may be able to step into the code of the separate DLL if the debug symbols are available for it.
Is the dll raising the exception written in managed code (C#, VB.Net etc)? If so, compile it in debug mode and reset the reference in the calling application. You should be able to then either set a breakpoint immediately before the call raising the exception and "step into" the code that's having trouble, or just set the debug feature to break into the debugger on all exceptions.
The previous poster was correct, however, the error you're seeing is because somewhere you've got code indexing past the end of an array/collection. This commonly happens for a couple of reasons:
1. Developer forgets that arrays are 0-based (so the index of the last element is Array.Length - 1)
2. The collection is being shortened (items are being removed) within the code while an iterative loop moves from lowest to highest index (e.g. 0-10). Since each removal essentially re-indexes the collection, eventually an index will be selected that is past the end of the array.
Hope this helps
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
Hi!
I'm looking for two controls, one to do Gantt diagrams and another one to implement an Calendar in wich I could post dates (like outlook for example). Does anyone know any free control implementing one (or both) of this funcitonalities?
I'm developping a Windows Forms application.
Thank you!
Jordi
PS - If I don't find it I will try to develop them. If I do it i'll post them in this fabulous website!
"Catalonia is not Spain"
|
|
|
|
|
You are looking for some thing like 'Planner'. Microsoft Project Planner ?
Sreejith Nair
[ My Articles ]
|
|
|
|