|
can we create an application in C# so that we put a dll on some other machine and application on some other machine. when we run the application it uses dll of that machine and executes the application smoothly. please help i have no knowledge of the topic and provide some help url if any.
Thanks and regards
|
|
|
|
|
|
A better solution is to use a service, web or windows, this being the current flavour of remoting.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Whenever you run an application in Windows, it needs to be able to find all the libraries that it runs on the same machine. In .NET, these are either located in the local directory, or in the GAC. When you think about it, you should be able to see that it could be a major security hole in an application if it relied on components that weren't installed with it and were sourced from an external, potentially unsecured, server.
|
|
|
|
|
if say Data access layer of the application is on server of the organisation and every body is accessing it from his client machine will it work through remoting.
|
|
|
|
|
I think so, like a plug-in, but then it won't work if the network is down. Better to copy updates down when available. Provided you can do so securely.
|
|
|
|
|
Hi,
I am working on an application which doesn't have a UI excpet for system tray icon. It doesn't show up in taskbar and also in Alt + Tab menu. For this I have done the following in the constructor of the form,
this.Opacity = 0.0;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.ShowInTaskbar = false;
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Show();
this.Visible = true;
I have a timer event handler whose job is to get the focus back to this form if it is doen't have the focus.For this I am doing the following,
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Visible = true;
this.Show();
this.Activate();
This should have worked fine but it's not It works sometime. Is there anything wrong in this?
What is that I am missing here which causes it to fail in getting the focus? Is there a better logic to get the focus? I have even tried using the Win32 API SetForegroundWindow but not successful.
Any help is appreciated.
|
|
|
|
|
HalliHaida wrote: I am working on an application which doesn't have a UI excpet for system tray icon.
..and a form
HalliHaida wrote: This should have worked fine but it's not
By design; it gets very frustrating if other applications "steal" the inputfocus. You're merrily typing away in Microsoft Word, and all of a sudden some popup comes along, asking whether to delete everything on "C:\". You're still typing merrily, and hit the "O" button, confirming the delete..
The best thing you can do is to show you application. If the user wants to work with that Window, they'll click it and give it focus. If they're still working in Word, they can move the focus whenever they're done there.
I are Troll
|
|
|
|
|
Well, let me give some more details. I am preparing a POC (proof of conecpt). To meet the actual requirement, the POC should have the following funtionalities,
1) System tray icon is the only UI of the application and it will have a option to exit the application.
2) The application should not appear in taskbar or Alt + Tab menu.
3) When an event is received from an external source, application should display a form, having a text box control and enter button, should appear and user should be able to type something and hit enter.
4) As soon as the user hits enter, the form should disappear.
5) Steps 3 and 4 could be repeated.
To achieve this, I have done the following,
1) Created a system tray icon with exit option in a window application
2) This main thread spawns a thread which will create a form having TextBox and button control and which will be hidden. To make it not appear in the Alt + Tab or taskbar have done the following,
this.Opacity = 0.0;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.ShowInTaskbar = false;
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Visible = true;
3) This worker thread spawns another thread which will create a TCP listner to receive the events from external source.
4) When the event is received, I am doing the following to display the form so that user can enter some text.
this.WindowState = FormWindowState.Maximized;
this.Activate();
This is not working for me The form is not getting the focus so that user can enter the text. The Activate() method is not working fine.
I tried setting the form as topmost before activating ans resetting it after activating like below
thi.TopMost = true;
this.Activate();
this.TopMost = false;
But this worked once or twice, but most of the time it fails. When it worked, if we shift the focus to some other application, then on receiving the next event the form fails to get the focus back.
All I need here is to display the form and make sure that it has the focus so that user can type. I tried setting the focus to the control like below,
<textBox>.Focus();
Any help is really appreciated.
|
|
|
|
|
HalliHaida wrote: This is not working for me
Your application won't be in the Alt-Tab list if there's no form visible. If one is visible, it'll be in the list, just as it should. You can't change the z-order of a form without a form. Hence, only visible apps participate.
HalliHaida wrote: The form is not getting the focus so that user can enter the text. The Activate() method is not working fine.
There's something built into Windows that prevents you from stealing the focus from another application, for the reasons prior given.
HalliHaida wrote: then on receiving the next event the form fails to get the focus back.
Because it'd mess dearly with the user-experience. Imagine typing a post here and loosing the inputfocus every second.
I are Troll
|
|
|
|
|
Hi,
Thanks for the reply. Just for clarification, I am reducing my statement of problem to the scenario below.
I have created the following sample code/setup. The setup is, a form (receiver) will activate itself on receiving a event from the socket, another form (sender) which will send the event to the receiver form.
FormRecvr:
1) Create a simple form with textbox control
2) Have a TCP listner listning on some port to receive the event
3) On the reception of event, activate the form i.e bring it to front so that it has focus and user can type some text.
FormSender:
1) Create a simple form with two button controls, one to activate the rcvr form by sending an event through socket and the other to exit the application.
2) Create a TCP socket with the listner and send the event.
After executing this simple program, what I have noticed is the receiver form doesn't get the focus. The taskbar menu of that app keeps blinking. The window doesn't come as foreground.
I have tried the following to bring it to focus.
this.TopMost = true;
this.Activate();
this.TopMost = false;
So, you mean to say, that even the behavior of this sample set up is expected? There is no way to make this setup work in the expected way?
Please do the needful.
Thanks in advance.
|
|
|
|
|
HalliHaida wrote: So, you mean to say, that even the behavior of this sample set up is expected?
Yes. All kind of things go wrong when someone is working and something steals the focus without the user noticing. I expect the same thing to go wrong if it were a popping up based on polling a file.
HalliHaida wrote: There is no way to make this setup work in the expected way?
You'd have to search long and hard for a hack. The expected way is a bad idea, for the reasons prior given. The Old New Thing[^] has a good explanation on the subject, and more items that may be helpfull[^]
I are Troll
|
|
|
|
|
But in this set up, the user know what he is doing i.e. he is activating the rcvr form by clicking a button on the sender form. So in this the focus shift happens with user notice right?
Please correct me if I am worng.
|
|
|
|
|
HalliHaida wrote: doing i.e. he is activating the rcvr form by clicking a button on the sender form. So in this the focus shift happens with user notice right?
You stated that the form is shown on an external event; that means the app isn't active and won't get focus. If the user has clicked a form within your app, that the app has focus, and can move it around in it's own forms.
In short, the button would receive focus, execute the command, it'd open a new form (with focus again) and show it. But that is based on the other form having focus that the button is positioned on.
I are Troll
|
|
|
|
|
Yes, as you have mentioned the receiver form is shown on receiving the external event i.e through TCP listner. This external event is sent by the sender form when the "Activate Rcvr Form" button on it is clicked by the user. In the click event handler an event is sent to the receiver form.
These sender and receiver forms are running as separate apps.
Why I want this functionality is, in my final application I will be receiveing the mouse click event through a call back which will be sent by a dll. On receiving the call back, I have to activate the form so that user can type some text in the text box field.
|
|
|
|
|
HalliHaida wrote: I have to activate the form so that user can type some text in the text box field.
I tried to explain that you shouldn't steal the focus. It seems that failed, since you're still requesting this functionality.
An example on activating an app can be found on PIEBALD's[^] profile.
Good luck
|
|
|
|
|
hi
i have this code:
var lines = File.ReadAllLines(@"d:\text.txt", Encoding.Default);<br />
<br />
var questions = new Dictionary<int, string>();<br />
<br />
foreach (var line in lines)<br />
<br />
{<br />
<br />
var parts = line.Split(new[] { ". " }, StringSplitOptions.RemoveEmptyEntries);<br />
<br />
var number = Int32.Parse(parts[0]);<br />
<br />
questions.Add(number, parts[1]);<br />
<br />
}
i need it in class and that all my forms will
recognize the var questions
how to do it ? can i get any sample code ?
thanks in advance
|
|
|
|
|
You already have sample code. What I suggest you need to do is create a static class that wraps this code and store the results of the file read in a member.
|
|
|
|
|
This question was already answered in the Q&A section. I just went back there to find that it has been deleted. I don't know if it was you who posed that question, got it answered and decided to delete it. You can start by wrapping this code into a small console app yourself and come back when you run into problems with that task.
Best of luck!
|
|
|
|
|
Go ahead an try then. If you have issues, be more specific about what they are.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
You have been around for a year now; you should know code snippets look best inside PRE tags.
And BTW, you are abusing the var keyword.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Make this class static or else have a look at the singleton design pattern.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
|
|
|
|
|
It seems to me, you don´t know what a 'class' is.
No problem.
Solution: Start with reading a good book about 'C#', and/or a book about the '.NET Framework'. There is also enough material on the net, if you use this very unknown thing called 'google'.
Then you can either solve this simple coding problem by your own, or maybe you will run into other troubles. Then you can ask again.
I cannot remember: What did I before google?
|
|
|
|
|
Hi
i have a several problems with hosting designer within my app.
i've found some useful articles such as this[^] and this[^], but my problem does not solved and this codes is very complex.
can anybody help me give me a site, blog or someone which have an experience in hosting designer topics ?
thanks in advance
|
|
|
|
|
As I pointed out to you before, hosting a designer is a complex task.
Perhaps if you were to edit your post to explain what it is that you are trying to do. i.e. what it is that you are trying to design that needs a designer.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I wouldn't let CG touch my Abacus!
|
|
|
|