1.Default button runtime 2. App running after unistall

G

Guest

Hello,

I am working on C# using vs.net 2003. I have faced two interesting
problems.

1. Dynamically setting Default Button:
I created a form and used it in various contexts. On basis of the context,
the panel of a form which contains various buttons , are shown or hides. Now
at design time i set the default button property to one of button. But when
the form object is created in different context and set visibilty of default
one false while some other buttons is/are visible then no one has default
button. My main form is basically a derived form from a control called
TD.SandDock.DockControl. Now on function which is called before display the
form but after creating its object, set the buttons , where i need to set the
default button as well. But i find no helper function/property to do so! How
can i achieve the same.

I cant set the default button to be appear on there (& set its
text) ,as its click event process is completely differ.

2. I created a small server application which basically listen on a port
for its client. Its GUI is absent and its only appear in taskbar icon(with
right click menu). One interesting thing i note is that this
applicaiton(.net) when uninstalled (installer is created using default .net
installation) while the applicaiton running. it doesnt complaint for
uninstall and thus it uninstalls the application while server applicaiton is
still running. As i create a mutex in applicaiton startup to check wherether
applicaiton is running or not . Hence when user install again the server
(note that server is still running even after uinstall) and runs the program
it says applcation is already running.

How can i assure that either it should not uninstall the applicaiton or it
should close the server applicaiton.

Thanks
Anil
 
G

Guest

You might use Process.GetProcessByName to obtain a list of processes having
the same name. If it's existing, sounds like it's running.
 
G

Guest

About your first query, the "default" state of a button is defined at buttons
creation time. Regarding win32 api (CreateWindow - Button Styles), it might
be possible but with some tricks. You can ask a control to recreate himself
(might need to derive the class to access needed method to use SetStyle and
UpdateStyles).

Hope it helps.
 
G

Guest

Hi sebastieng,
Thanks for kind and prompt reply. But you see, when creating installer
in .net build in installer, i cant find a way to code in it (as we do in
install shield). Thats why my application creates a mutex and checks the
other instance of same applicaiton. So my server application wont run twice
in any case. In code i can do this but when insataller of .net is in picture,
its look tough to go through it.
To be straight how can in installer i check for it. For other application
, one can not delete/uninstall the application while its running. But
surprisingly my server application exe can be deleted and hence uninstalled
even when its running.


Thanks again.
Anil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top