|
How do you start the application, exactly?
If you're trying to run it from a UNC path, then the internet zone security settings will apply, even if the computer is in your local intranet.
Regards,
mav
|
|
|
|
|
We browse to the network path (e.g. Z:\C# Stuff\Program Folder\Program.exe) and run it directly.
This is the only computer that will not run it from the network (we have 50+ that run it just fine).
-- modified at 14:04 Tuesday 4th October, 2005
The .NET internet security settings are full trust also.
|
|
|
|
|
The problem turned out to be some network glitch with the user's profile (on the network itself).
Our I.T. dept is checking into the fix.
Thanks for your help
|
|
|
|
|
Dear All,
I want to check the CPU Usage in C#. May be through Perfprmance counters?? Can I get sample code for that.
With Regards
Manoj
|
|
|
|
|
What type of CPU usage you want to check is important. You can browse the various performance counters and read their descriptions using the Server Explorer tab in Visual Studio - right-clicking on the perf counter you want and select Properties - or use perfmon.exe o NT-based Windows OSes.
An example of just getting values every .5 seconds follows:
using System;
using System.Diagnostics;
using System.Threading;
class Usage
{
static void Main()
{
using (PerformanceCounter pc = new PerformanceCounter())
{
pc.CategoryName = "Processor";
pc.CounterName = "% User Time";
pc.InstanceName = "_Total";
Console.Error.WriteLine("Total % User Time:");
Console.Error.WriteLine("Press any key to exit...");
ThreadPool.QueueUserWorkItem(new WaitCallback(Count), pc);
Console.Read();
Console.Error.WriteLine("Done");
}
}
static void Count(object state)
{
PerformanceCounter pc = state as PerformanceCounter;
while (pc != null)
{
Console.WriteLine("{0,3:f2}%", pc.NextValue());
Thread.Sleep(500);
}
}
}
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thanks you lot.
Actually I want to implement cluster. in which I want to check CPU Usage before assigning it to computation.
With Regards
Manoj
|
|
|
|
|
You can still use the performance counters and should consider taking a brief running average before giving more work to a CPU. CPU usage goes up and down and performance counters only have so much resolution between ticks (no where near as fast as a CPU tick).
There is actually APIS for clustering in Windows available either as automation objects (which you can use with a Runtime-Callable Wrapper (RCW) created by tlbimp.exe) or native functions you can P/Invoke. See http://msdn.microsoft.com/library/en-us/mscs/mscs/windows_clustering.asp[^] for details.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hello,
I have an MDI application. At the start of Main I call EnableVisualStyles and DoEvents to enable XP theming and everything works fine.
But now, I'm trying to automatically simulate a click event for a menu item to display a login form on top of that MDI parent.
First I tried to display the form the first time the Activated event is fired for the MDI parent, and it kind of works, but the main form is displayed partially resized (titlebar is resized to saved position, but not client area) and only totally paints itself after the login form is closed.
I have a timer, so I tried setting a flag and displaying the form the first time the Tick event fires for the timer, before clearing the flag. This to wait for the form to process all the creation events. And it works perfect, except that I don't get visual styles in any of my application's dialogs (but I do in toolbars and message boxes.)
I'm using .NET 1.1 (VS 2003) on Windows XP.
So, any ideas?
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
I just removed the calls to EnableVisualStyles and DoEvents and added an app.manifest file. Everything works great now!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
Hi!
You could also try using the Application.Idle event instead of your timer. That way the menu item click is simulated when the application is finished initializing the main form.
Regards,
mav
|
|
|
|
|
I am new to remoting and have created 3 projects on the same machine
1) Server object
2) Server activation object
3) Client
The client calls the server activation object which includes specifying a URI to show where the Server activation application resides. This client code might look something like this...
TcpClientChannel ch = new TcpClientChannel();
ChannelServices.RegisterChannel(ch);
RemotingConfiguration.RegisterWellKnownClientType(
typeof(SAO_server_single_call.clsSAO_singlecall),
"tcp:davelaptop:1234/clsSAO_singlecall");
objSAO_singlecall = new SAO_server_single_call.clsSAO_singlecall();
Can anybody tell me how to work out how the URI should be constructed? I've not used them much before. My computer is called 'davelaptop' and the client activation server project lives at 'D:\Work\Exercise\RemotingTest\RemotingTest\TestServer'
Can anyone tell me what the URI should look like or tell me where I'm going wrong?
Thanks in advance - Dave
|
|
|
|
|
The URI doesn't have anything to do with the physical location of the server. You only need to provide the port number of the channel which you registered on the server. For example, if your server code looked like this
ChannelServices.RegisterChannel(new TcpChannel(8082));
RemotingConfiguration.ApplicationName = "HelloServiceApplication";
RemotingConfiguration.RegisterWellKnownServiceType( typeof(HelloService),
"MyUri",
WellKnownObjectMode.SingleCall
);
Then the client call will look like
RemotingConfiguration.RegisterWellKnownClientType(
typeof(SAO_server_single_call.clsSAO_singlecall),
"tcp://localhost:8082/HelloServiceApplication/MyUri");
Quoted from MSDN[^]
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
im using visual studio beta 2
i have richtextbox and listbox in my C# windows application.
my application works like intellisense/Autocomplete like typing System, then a "."
inside Visual Studio .NET will show a drop down list of types for the System namespace.
when i type a recognized word into the richtextbox then a period/fullstop,
a listbox appears.
problem:
how do i position my listbox to appear right after the period('.') i would have typed in my richtextbox
code example would be appreciated
thanks
regards paula
|
|
|
|
|
listBox.Location = richTextBox.GetPositionFromCharIndex(richTextBox.SelectionStart);
|
|
|
|
|
how do i play short wav file in c# then stop when it finishes.
i have a timer that will fire when a remote server goes offline, the timer_tick fires every 10000 millisec, and the wav file is 1.5 secs long.
when i use the code below and play synchronisly it just repeats continouslyand seems to stall the form, as i cant click the button to shut it up
if i play it asynchronously, then it plays over the top of itself repeatedly
how can i just play it one every 10 seconds until i cancel it ?
<br />
if(online)<br />
{<br />
this.stationStatus.Text = "ONLINE";<br />
this.stationStatusPicture.Image = this.statusImages.Images[0];<br />
}<br />
else<br />
{<br />
this.recogniseAlertButton.Visible = true;<br />
<br />
offlineTimer = new Timer();<br />
offlineTimer.Interval = 10000;<br />
offlineTimer.Tick += new EventHandler(offlineTimer_Tick);<br />
offlineTimer.Start();<br />
} <br />
<br />
WSounds ws;<br />
private void offlineTimer_Tick(object sender, EventArgs e)<br />
{<br />
ws = new WSounds();<br />
<br />
try<br />
{<br />
ws.Play("offline.wav", ws.SND_FILENAME);<br />
<br />
this.stationStatus.Text = "OFFLINE";<br />
this.stationStatusPicture.Image = this.statusImages.Images[1];<br />
}<br />
catch(IOException ioe)<br />
{<br />
Debug.WriteLine(ioe.Message);<br />
}<br />
}<br />
<br />
public class WSounds<br />
{<br />
[DllImport("WinMM.dll")]<br />
public static extern bool PlaySound(string fname, int Mod, int flag);<br />
<br />
public int SND_ASYNC = 0x0001;
public int SND_FILENAME = 0x00020000;
public int SND_PURGE = 0x0040;
<br />
public void Play(string fname, int SoundFlags)<br />
{<br />
PlaySound(fname, 0, SoundFlags);<br />
}<br />
<br />
public void StopPlay()<br />
{<br />
PlaySound(null, 0, SND_PURGE);<br />
}<br />
}<br />
kid regards,
g00fy
|
|
|
|
|
How is SQL generally handled? I'm building my first application for windows using c# and have just finished up the base class for the application forms to inherit from.
Next, I'm wondering how to handle the SQL (connection, selects, inserts, updates, deletes) and wondering if these should all go into there own class. One class per table or something like that as opposed to having each form use it's own set of SQL. ex: Customer form loads a grid using customer table. Customer search populates a listbox from customer table and displays this in a dialog. Customer edit takes an existing record (or allows the creation of a new record). 3 seperate forms. Should 1 class handle the customer SQL or would you handle that individually in each of the 3 forms? (frmGrid, frmSearch, frmEdit) I'm concerned that if anything changes (and it probably will) within the table, I'd need to search through each form that uses that table to handle mod's.
Thanks for any guidance you can offer!
|
|
|
|
|
I usually put all my database handling into one class and have any forms that need to access the database keep a reference to that class. I have my database class manage the connection, all the different data adapters and all the data tables.
|
|
|
|
|
Excellent and thank you for such a quick response. I'll start in on this today!
|
|
|
|
|
|
Awesome link. I'm not familiar with ORM, so I've bookmarked that URL and will give it a read!
Thanks
|
|
|
|
|
I have a project with a main form that accesses inherited forms with their appropriate .dll's. I have several that work fine. However, the latest form gives me the following error when I try to compile the main form:
" "_Form() is inaccessible due to its protection level
I understand what it is saying. I just dont see why. I am able to compile and run the inherited form separately with no problem. However, once I call it from my main form, I receive the previous error. Any help would be much appreciated. Thanks.
D
|
|
|
|
|
Is the _Form declared as protected instead of public as it should be?
I'm in the high-fidelity first class traveling set.
And I think I need a Lear jet.
|
|
|
|
|
spif,
Thanks for the quick response. However, the form is declared as public. public _Form(){}
Any other ideas? I am assuming it isn't a user control because it would give me this error when I run the application stand-alone. What could it be?
D
|
|
|
|
|
spif,
Thanks again for your help. You got me going in the right direction. The form was declared null within the protected override void dispose method. Thanks again for everything.
|
|
|
|
|
Try to write the whole namespace in front of the initialization.
ex.
System.Windows.Forms.Form f = new System.Windows.Forms.Form();
^^replace with the _Form's namespace.
There may be another Form with same name which is inaccesable (private or protected)
I'm in the high-fidelity first class traveling set.
And I think I need a Lear jet.
|
|
|
|