You can Trap that. lets say in the main DLL , there are Configuration function that you dont want your users to use. What you need to do is check the user rights before accesing the DLL. put some if statements based on the credentials
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
I have created a new invisible form creating a new class with Main Run as an entry point and I haven't got any problems. My real problem is that I need that this program runs constantly and for this reason I have created a while(true) loop. This solution provided all my needs, but the cpu consumption rises to 50%, and for this reason is invalid. Any idea how can I fix it?. The solution "Windows Service" is not valid because these are started before logon and these have not the
Permissions of the Domain.
My real problem is that I need that this program runs constantly and for this reason I have created a while(true) loop.
This is dumb. It forces your code to work to do nothing, and that's why your CPU is 50% ( you're on a dual core and only one core is being needlessly worked by your code ).
The solution "Windows Service" is not valid because these are started before logon and these have not the
Permissions of the Domain.
Actually, that's not necessarily true, but, you don't need a service, your form will always run anyhow. If you need to check something and you can't watch for it, write a timer to check as often as is appropriate ( once a second, twice a second, once every ten seconds, it's up to you ).
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
I've got a FileSystemSwatcher for changes...My problem is that the form finish...Sorry, I don't think that always run..
This is recomedation of Microsoft for Invisible Forms..
To make the main form of a Windows-based application invisible when the application starts, you must move the application's startup logic into a separate class. You cannot simply set its Visible property to false.
After you have separated the lifetime of the application from the lifetime of the form, you can make forms visible (and invisible), because the application will end when you "close" the class that was used for application startup.
Because a module is invisible when its code is running, the procedure that follows includes a step for adding a message box to the startup module to simply demonstrate that the application is running.
To set a form to be invisible at its inception
Do one of the following:
In Visual Basic, add a module to your Windows-based application by right-clicking the project and choosing Add Module.
In Visual C#, create a new class.
For more information about creating a Windows-based application, see How to: Create a Windows Application Project.
Within the module or class, develop a Main subroutine that can act as the startup object for the project.
The following code example shows how you might approach this.
C# Copy Code
// All methods must be contained in a class.
// This class is added to the namespace containing the Form1 class.
public static void Main()
// Instantiate a new instance of Form1.
Form1 f1 = new Form1();
// Display a messagebox. This shows the application
// is running, yet there is nothing shown to the user.
// This is the point at which you customize your form.
System.Windows.Forms.MessageBox.Show("The application "
+ "is running now, but no forms have been shown.");
// Customize the form.
f1.Text = "Running Form";
// Show the instance of the form modally.
The message box in the previous code example is specified with a fully qualified namespace because the created module, unlike a standard Windows Form, does not import any namespaces by default. For more information about importing namespaces, see References and the Imports Statement (Visual Basic), the using Directive (C# Reference) (Visual C#), or the using Directive (C++) (Visual C++). Application.Run() will start the message pump, which is vital to the behavior of certain applications and can affect form behavior during certain times in the application lifecycle, such as on shutdown. For more information, see Application.Run Method.
My code in the new class is:
Form1 miF = new Form1();
FileSystemWatcher Fs = new FileSystemWatcher();
Fs.Created += new FileSystemEventHandler(Fs_Created);
Fs.Path = "c:\\my";
Fs.EnableRaisingEvents = true;
miF.ShowInTaskbar = true;
staticvoid Fs_Created(object sender, FileSystemEventArgs e)
//throw new Exception("The method or operation is not implemented.");
FileStream Fs = File.Open("c:\\my\\probe.txt", FileMode.CreateNew);
StreamWriter Sw = new StreamWriter(Fs);
I wrote a C# program to create enhanced metafile and store to clipboard for paste on office application, I don't know while I change the clipboard view with picture and EMF, the image in clipboard becomes distortion with picture view
And I wrote a VB program also to create enhanced metafile and store to clipboard, it is no problem
Can somebody help me on how to create multiple connection to different server using ip/port at the same time and receive data.
I have a program in C# but it's only working for 1 connection. Please help me or redirect me for a tutorial on multiple socket programming in C#.
I'm new to this thing.
You've shown that you have the code to connect from one machine to another. Just duplicate it. Nothing says that you can have only one socket open at a time so it's fine to do something like this:
open Socket A
open Socket B
. . .
read something from A
. . .
write the data to B
. . .
you don't even need to close the sockets for each operation. You can leave them open for the lifetime of the process if you need to instead of opening them and closing them each time that you need them.
Unfortunately I don't have any links to tutorials on multiple socket programming; i doubt that any really exist. There's no real difference between using one socket and using multiple sockets except that in the former you see things like Socket and in the latter you'll see things like List ( Socket ).
Last Visit: 31-Dec-99 18:00 Last Update: 26-Sep-23 0:28