|
Hi,
I would like to verify the version information of an installed application in a computer programatically (does any in built class in C# supports this). It would be great if you some one helps in this regard.
Thanks in advance:
Rakesh
Rakesh
|
|
|
|
|
Hi,
this depends on the kind of application you want to check. I dont know any other standard than file versioning (for executables and dlls) which would allow to retrieve such information. If you want to check applications installed by windows installer there is a way to retrieve the information by using wmi if i remember right. All together there is no "in-built" class for such things and as far as i know you will have to create your own classes to retrieve these information.
|
|
|
|
|
Thanks for responding,
My application do not use Windows Installer, so as per you I need to write a class of my own. So I would like to know how can I access these version info in my class, can you be broad in this...
Rakesh
|
|
|
|
|
I've been googling for retrieving the "standard" product version info of a exe/dll and found a forum post pointing to this article. The third example describes how to retrieve the version info by using the windows api (unsafe code). It's a bit complex but pretty self-explanatory. let me know if you don't get it and good luck so far
MSDN - C# Unsafe Code Tutorial
|
|
|
|
|
Hi!
In this case you can use the AssemblyName.Version property.
If you have the path to your assembly (doesn't matter if it's an exe or a dll), you can call AssemblyName.GetAssemblyName(pathToAssembly); to retrieve the AssemblyName instance.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
In My Application I have Three textboxes for phone number to maintain the format as 3-3-4.Once the user enters the first 3 numbers of a phone number the focus should automatically go to nextbox How can I do it in C#
chanti
|
|
|
|
|
on the textbox1 keyup event u can check the length of text entered in textbox
by following way textbox1.text.length and then check the condition
if(textbox1.text.length==3)
textbox2.focus();
same way you can put same condition for textbox2 on its keyup event
to transfer focus on textbox3.
rahul
|
|
|
|
|
Hi,
you could do this by binding the textboxes KeyUp-Event. The first argument passed to the eventhandler is the triggering object (in this case the textbox where the user has written in). the code for the eventhandler could look like:
TextBox mytxtbox = (TextBox) sender;
if (mytxtbox.Text.Length == 3)
theNextTextBox.Focus();
if you need further assistance feel free to ask
|
|
|
|
|
hi Chanti,
You can do this by more than one way. The most easy way that I could think of right now is to set the maximum lenght property of the three text boxes (lets say firstTextBox, secondTextBox, thirdTextBox) to 3-3-4 simultanuously.
After doing so the program want allow u to type more than 3 digits in the first text box but wont take u to the next one. So u have to fire an event of that text box. The event that u should fire is the TextChanged event and write inside this method the following code:
if (firstTextBox.Text.Length == 3)
{
secondTextBox.Focus();
}
This will take the focus and the next character to the secondTextBox. And u can do this for the other textboxes too.
If you need any help in any other issue, don't be shy to add me at the following MSN address: jamilaboukhalil@hotmail.com or you can just send a mail.
Jamil Abou khalil
|
|
|
|
|
yes this is right solution
the previous one does fail when we keep the key pressed
|
|
|
|
|
then you should use the keypressed value
if there already are 3 characters in the textbox set e.Handled to true and set focus to the next textbox otherwise allow it to write the value
|
|
|
|
|
Yea right, that's the negative side about the keydown/keyup/keypressed events.u don't know which key is pressed.
Anyway hope that i did benifit u.
Feel free to contact me at my MSN address jamilaboukhalil@hotmail.com.
Take care
|
|
|
|
|
Hi,
I am using a simple popup application in which I popup a window and the window will write the value into the parent window text box.
child.aspx
function Fillvalue()
{
var txtDefault = document.getElementById('txtChild');
window.opener.document.form1.txtDefault.value = txtDefault.value;
window.close();
}
default.aspx
function OpenPopup(parentID)
{
var winHeight = 600;
var winWidth = 830;
var url = 'frmChild.aspx?';
options = 'menubar=0,resizable=1,status=0,scrollbars=1,height=' + winHeight + ',width= ' + winWidth +
',left=' + ((screen.width-winWidth)/2) + ',top=' + ((screen.height-winHeight)/2);
window.open( url, '', options );
}
This is working fine and returning me the desired value. which I entered in the child(popup) window.
but, when I am using
window.opener.document.form1.txtDefault.value = txtDefault.value;
in my other application the above is not working. I am very much confussed, what might be wrong, any solution please....
Ram
|
|
|
|
|
Hi all,
I need to know how to authenticate a user before sending a mail using a
C# application. The authentication should be done after sending mail order is initiated. or in other case if possible i need to know how to get the user name and password from the session that the user is signed in to.
The source code i use is this:
private void sendMailButton_Click(object sender, EventArgs e)
{
try
{
MailMessage mailMessage = new
MailMessage(toTextBox.Text, fromTextBox.Text, subjectTextBox.Text,
bodyTextBox.Text);
SmtpClient obj = new SmtpClient(SMTPTextBox.Text);
obj.Send(mailMessage);
MessageBox.Show("Message Sent");
}
catch (Exception ex)
{
MessageBox.Show("message not sent");
}
}
I need to add the authentication part. This is working but with no
authentication for the user or the mail sender address. I am using a
local SMTP server.
Thanks,
Jamil abou khalil
|
|
|
|
|
For sending a mail with authentication..you could try:
try
{
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
message.To.Add(toTextBox.Text);
message.Subject = subjectTextBox.Text;
message.From = new System.Net.Mail.MailAddress(fromTextBox.Text);
message.Body = bodyTextBox.Text;
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient(SMTPTextBox.Text);
smtp.Credentials = new System.Net.NetworkCredential("username", "password");
smtp.Send(message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
Replace the "username" and "password" with the actual username and password.
Hope that helps,
Ashish
Time flies like an arrow;
Fruit flies like a banana.
Ashish Derhgawen - http://ashishrd.blogspot.com
|
|
|
|
|
HI,
Thanks for your reply but the funny thing is that i posted this article in more than one discussion board and all the replys and answers that i got were the same as your answer. The funny in that is that it never worked. Even if i put the user name and password of the sender and put another sender name it never worked. It is sending the mail all the time.
If there is any other way please do reply and tell me how to.
Thnaks in advance,
Jamil Abou Khalil
|
|
|
|
|
I did a quick google search..I couldn't find any other way..but perhaps you'd find something at: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=717&SiteID=1
I'm still searching for other methods...I'll let you know if I find any.
- Ashish
Time flies like an arrow;
Fruit flies like a banana.
Ashish Derhgawen - http://ashishrd.blogspot.com
|
|
|
|
|
Hi,
I'd like to know how I could launch an URL (preferably in the default browser) with a specific referer, by clicking a a button (or any control really). I've seen various tutorials about making your own web browser, where they show you how this can be done (through the navigate method of the WebBrowser control I believe) but I haven't come across any tutorial that shows how one could achieve that by opening a process (IE, Firefox, etc).
Any help, would be greatly appreciated. Thank you.
|
|
|
|
|
The following will open the specified URL in your default browser:
Process.Start("http://www.codeproject.com");
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Okay thanks, but is there a way to open it with a specific referer. As in, launching "http://www.codeproject.com" in the default browser with the referer "http://www.google.com" for example?
|
|
|
|
|
Sorry man but I don't know a way, which doesn't mean there isn't one
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hii all,
I am doing an application which lists the installed softwares in local system as well as remote systems. I can get the installed softwres by reading the registry key value "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall".
But when I tried to read the registry of remote systems using the method "OpenRemoteBaseKey" I am getting an access restriction exception. How can I solve this or is there any alternative method to do this.. Plz help
Thanks in advance
Ranjith Stephen
|
|
|
|
|
hi Ranjith!
u should have administrator rights for accessing remote registry service on a remote machine ..
by d way why dont u use WMI for getting all d installed applications on local or remote machine..
try using 'Win32_Product' class for getting the list of installed application..
but for this also u should have Administrator Previleges .. on remote machines..
abhinav
|
|
|
|
|
Hii Abhinav
Thank you very much for your reply. Actually I am not familiar with WMI. Anyway I will find it out.
We can add registry permission using regsvr32.exe.
thanks
Ranjith Stephen
|
|
|
|
|
Hi,
We are developing a software, it has two versions. Trial version and full version. Our
main concern is ensuring customers cannot stick the full version on a file sharing
network or give it away to friends.
If any user buy the full version, he should not be able to give it to another person (It should not work in other machines).
What is the best way to achieve this goal?
Thanks!!
jayasshc
|
|
|
|