|
Hi Friends,
I need to create a windows application that will run in system tray, and should load on Startup.
It needs input of URL and value. Eg: www.google.com, and value=1,if Browser is opened with URL www.google.com?value=1 then application should give a message or say ballon tip.
Now all i am searching is which method is there which can know whether an explorer.exe or mozilla.exe has been opened. And read if the wanted URL is opened.
I see System.Diagnostics is used to start processes. I am trying to play around with it. I am not sure i am in the write direction.
Any suggestions related to this would be highly appreciated.
Cheers
Menon
|
|
|
|
|
Well I want I have password in my Form but I want to change it and how? what will you advice me
namespace WestNotePad
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void changePasswordToolStripMenuItem_Click(object sender, EventArgs e)
{
PasswordChange ps = new PasswordChange();
ps.ShowDialog();
}
}
}
namespace WestNotePad {
public partial class frnPassword : Form {
public frnPassword() {
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e) {
DialogResult = DialogResult.Cancel;
}
private void txtPassword_TextChanged(object sender, EventArgs e) {
}
private void button1_Click(object sender, EventArgs e) {
DialogResult = DialogResult.OK;
}
}
}
namespace WestNotePad
{
public partial class PasswordChange : Form
{
public PasswordChange()
{
InitializeComponent();
}
private void ChnButton1_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
}
}
}
namespace WestNotePad
{
static class Program
{
public static bool a = true;
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
int n = 0;
m:
if (ValidatePassword())
{
if (a)
{
Application.Run(new Form1());
}
}
else
{
n++;
while (n<4)
{
MessageBox.Show("Erorr");
goto m;
}
}
}
private static bool ValidatePassword()
{
if (string.IsNullOrEmpty(Settings1.Default.Password))
{
return true;
}
frnPassword f2 = new frnPassword();
if (f2.ShowDialog() == DialogResult.OK)
{
return f2.txtPassword.Text== Settings1.Default.Password;
}
else
{
a = false;
}
return true;
}
}
}
Settings1.cs
Password | string | User | ABCD
C# Developer
|
|
|
|
|
I've hit a stumbling block on trying to figure out this problem. I have a winform app written in C# that was started back with 1.0 frame, then upgraded to 1.1, and recently I created a test 3.5 version. The deployed app is still the 1.1 as we have a lot of old 98 machines several of which don't want to upgrade to the 2.0 framework.
Here's the simplified code that I'm having problems with:
//1
PrintDocument printDocument1=new PrintDocument();
printDocument1.PrinterSettings.PrinterName=LastPrinterName;
//2
PrinterSettings ps=printDocument1.PrinterSettings;
PageSettings dps=ps.DefaultPageSettings;
string defaultsourcename=dps.PaperSource.SourceName;
//3
foreach(PaperSource p in ps.PaperSources)
comboBoxPaperSources.Items.Add(p.SourceName);
//4
string defaultsizename=dps.PaperSize.PaperName;
//5
foreach(PaperSize p in ps.PaperSizes)
comboBoxPaperSizes.Items.Add(p.PaperName);
//6
Basically my software has some 280 different reports and different ones go to different printers and to different sizes of paper. So the full code brings up an option screen that remembers the last settings and allows the user to store the settings for the specific report section and select a checkbox to not ask them for settings the next time they generate the report. The comments with numbers are to help identify how long it takes to do each section.
On my machine, a dual-core Server 2008 64 bit 4 gigs of ram, 8 printers set up, my 3.5 version in release mode takes this long:
1->2 0ms
1->3 31.2ms
1->4 46.8ms
1->5 78ms
1->6 109.2ms
On another Vista 32 bit machine, 2 gigs of ram, 12 printers set up, my 1.1 version in debug mode:
1->2 0ms
1->3 73ms
1->4 101ms
1->5 201ms
1->6 289ms
On my machine in a Hyper-V XP 32 bit window, 7 printers set up, using my 1.1 version in debug mode:
1->2 0ms
1->3 78.08ms
1->4 93.7ms
1->5 171.79ms
1->6 234.26ms
On my bosses new machine he received last week, a quad-core Vista 32 bit, 3 gigs of ram, 2 printers set up, my 3.5 version in release mode:
1->2 0ms
1->3 4,056ms
1->4 6,864ms
1->5 11,856ms
1->6 15,600ms
Using the 1.1 debug version puts 1->6 up to 17,255ms
Obviously, there's some sort of titanic problem with my bosses machine. The machine itself is incredibly fast. Every other operation in my software beats the tar timing-wise compared to my machine. As soon as it touches printers, it craps out. Wordpad/notepad/word/excel/acrobat/etc all seem to pull up printers fine. The machine is pretty "clean", all the crapware was uninstalled off of it, no virus scanner running, I've task manager killed everything non-critical. I've deleted all his printers out, reinstalled just the Microsoft XPS Document Writer. I've cleared out his temp folders and run a chkdsk. I've eliminated all the standard "this is why its slow" reasons that I know of. If it had been any other program on the machine, I would think its a windows issue, but since its just my software I'm stuck.
Does anyone have any suggestions on where to go from here?
It doesn't seem to be Vista 32 bit.
It doesn't seem to be number of printers.
It doesn't seem to be amount of ram.
It doesn't seem to be something running in the background.
It doesn't seem to be disk or printer corruption
It not affecting any "mainstream" apps
It doesn't seem to be a specific .NET framework version
So I don't know if its
Quad core and .NET
Some chunk of code I'm missing
Something I haven't thought of.
|
|
|
|
|
Hi,
my guess is the slow machine has one or more printers set up that are hard to find, networked ones e.g.
so it takes a long time building the list of available printers or whatever other information it needs
to respond to your code. So check the list of installed printers. Or (temporarily) remove most of them.
|
|
|
|
|
Already tried that. I went down to having nothing but a local "virtual" printer(the XPS document writer that comes with Vista). Didn't change the speed very much.
|
|
|
|
|
Dear sir,
I am developing one windows application , in this we are using visual studio.net 2005, c#.net .
I have msi file package & set up file for this application.
To run the application I need windows encoder set up also.
So, Externally I install windows encoder set up also
Now my application is ready but In this situation, when I give it to client I ask him to install “windows media encoder “ also. Other wise I will go to customer home & I install both my set up and windows media encoder.
My requirement:
I want to make my msi file & setup automatically install the “windows media encoder” also , when customer install my setup.
How can I done this.
Similarly , when I uninstall my set up, it automatically uninstall windows media encoder also.
Please help me by giving solution for this.
Thank you ,
|
|
|
|
|
I have a DataGridView on a form with a number of columns that are calculated and hence set to readonly. What I wanted was to have these columns skipped whenever the user entered them. I thought to use the OnEnter event to test the readonly attribute of the current cell and set the currentcell to the next one. A problem arose using this methed in that by changing the currentcell in the event handler, I was invoking the non-reentrant changedcell method. Instead I resorted to a SendKeys.Send("{tab}") instead and this appears to work.
|
|
|
|
|
I had this same issue a while back. I did some searching and posted on forums and the SendKeys.Send("{Tab}") solution was the only one I was able to find. Let me know if you find something better.
|
|
|
|
|
This is the error which I am getting in this line-->dgDataItemgrp.DataMember = "myTable.RelLicData";
dsetView = dset.DefaultViewManager;
dgDataItemgrp.DataSource = dsetView ;
dgDataItemgrp.DataMember = "myTable.RelLicData";
DataRelation relLicData;
DataColumn colMaster1 = new DataColumn();
DataColumn colDetail1 = new DataColumn();
colMaster1 = this.dset.Tables["myTable"].Columns["LicensegroupID"];
colDetail1 = this.dset.Tables["myTable1"].Columns["LicensegroupID"];
relLicData = new DataRelation("RelLicData", colMaster1, colDetail1);
dset.Relations.Add(relLicData);
any clue what can be the reason ?
|
|
|
|
|
Hi I have one question, in my code if pasword is incorrect, when I click Ok, I want to change label like that "your password is incorrect"
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Drawing.Printing;
using System.Security;
namespace WestNotePad
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
...
public bool isModificed()
{
if (textBox1.Text==String.Empty)
{
return true;
}
else
{
return false;
}
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WestNotePad {
public partial class frnPassword : Form {
public frnPassword() {
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e){
DialogResult = DialogResult.Cancel;
}
private void button1_Click(object sender, EventArgs e){
DialogResult = DialogResult.OK;
}
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace WestNotePad
{
static class Program
{
public static bool a = true;
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if(ValidatePassword()) {
if(a) {
Application.Run(new Form1());
}
}
else
{
// MessageBox.Show("Erorr!");
<br />
here I wont my questions answer plz<br />
}
}
private static bool ValidatePassword()
{
if(string.IsNullOrEmpty(Settings1.Default.Password)) {
return true;
}
frnPassword f2 = new frnPassword();
if(f2.ShowDialog()==DialogResult.OK) {
return f2.txtPassword.Text==Settings1.Default.Password;
}
else {
a = false;
}
return true;
}
}
}
thx
C# Developer
|
|
|
|
|
label1.text = "whatever you want";
replace label1 with whatever you label is called
Bob
Ashfield Consultants Ltd
|
|
|
|
|
what you suggested me, I have already done, but It's not work...
C# Developer
|
|
|
|
|
Try adding
label1.Refresh();
after setting the text.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
frnPassword f2 = new frnPassword();
f2.label1.Text = "Error";
f2.label1.Refresh();
like that??
but It's not work again
C# Developer
|
|
|
|
|
I give up then, it works for me. Any error messages?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
hi All,
me and my friends are trying to make a Docklet application for windows and i am not sure of the things to learn to be able to start codding the application,
so if anybody can help us and tell us the things to learn to be able to make our application come true.
i know that there exist already docklets apps for windows but i want to make my own :> so if any body hava a clue of what to do please tell me.
till now all i know is i need C++ and we are good at, and OpenGL which we are going to learn.
thanks all and Best Regards.
modified on Thursday, July 10, 2008 5:35 PM
|
|
|
|
|
|
no that's not the DOCKlet in mean, what i am talking about is a windows application that look like the system tray that has shortcuts to your favorite apps like the one in the MAC OS.
i didnt mean the java doclet.
|
|
|
|
|
So are you saying you just made that up? Don't do that, don't make up your own terminology. No one will have freakin clue what you are talking about. Can you doclet that?
kimozz wrote: i am talking about is a windows application that look like the system tray that has shortcuts to your favorite apps like the one in the MAC OS.
kimozz wrote: till now all i know is i need C++ and we are good at, and OpenGL
I have no idea what the thing in the MAC OS is that you mentioned but what would OpenGL have to do with displaying shortcuts in a system tray?
And finally, this is the "Windows Forms" forum. That means System.Windows.Forms which is a namespace in the .NET Base Class Library. For questions working with Native Windows development you want to use the Visual C++/MFC forum. But be warned, if you don't use standard Windows programming terms it is unlikely anyone will figure out what you are talking about.
led mike
|
|
|
|
|
hey google it and you will find it and some apps already done that
|
|
|
|
|
Hey I see you fixed the misspelled Doclet in the subject of your first post but see how it shows up in the replies anyway? That's sort of like a Docklet hu? And that's why I did find anything but a Java reference when I googled "doclet" instead of "Docklet". Like did you notice how the C++ compiler produces an error when you omit those semicolons?
So basically you want to create a Windows Application that has similar features to this ObjectDock application? Go to the Visual C++/MFC forum and read the first post in the forum titled "How to get an answer to your question", pay attention to item #2.
See you around.
led mike
|
|
|
|
|
yes i am sorry for misspelling the word and thank you for paying my attention to the "How to get an answer to your question".
thanks
|
|
|
|
|
I am trying to use put datatable in Dataset so athat I can manuplate it .But its giving a Null Ref Exception the problem may be in lines with (-->) marked please look into it
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Configuration;
namespace Thomson.Financial.WebQA
{
public partial class frmLicenseGroups : Form
{
private SqlDataAdapter daLicGrp;
private BindingSource bsLicGrp;
private DataSet dset;
private SqlDataAdapter dLGrp1;
private SqlDataAdapter dLGrp2;
public frmLicenseGroups()
{
InitializeComponent();
this.Load += new EventHandler(frmLicenseGroups_Load);
this.btnSaveLicenseGrps.Click +=new EventHandler(btnSaveLicenseGrps_Click);
}
void LoadLicGrpDataGrid()
{
DataTable dt = new DataTable();
SqlCommand cmd = new SqlCommand("SELECT * FROM webqa_state.dbo.METADATA_LicenseGroups");
cmd.CommandType = CommandType.Text;
cmd.Connection = DBConnection.getConnection();
daLicGrp = new SqlDataAdapter(cmd);
SqlCommandBuilder cmdBuilder = new SqlCommandBuilder(daLicGrp);
daLicGrp.Fill(dt);
bsLicGrp = new BindingSource();
bsLicGrp.DataSource = dt;
dgLicenseGroups.DataSource = bsLicGrp;
dgLicenseGroups.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader);
}
void frmLicenseGroups_Load(object sender, EventArgs e)
{
--> dset = new DataSet("LicenseMap");
--> DataTable dt = getLtable();
--> DataTable dn = getDtable();
--> dset.Tables.Add(dt);
--> dset.Tables.Add(dn);
for (int i = 0; i < dset.Tables.Count; i++)
{
string myMessage = i.ToString() + " " + dset.Tables[i].ToString() + " ";
}
this.LoadLicGrpDataGrid();
this.treeLicencegrpView.AllowDrop = true;
this.treeLicencegrpView.DragEnter += new System.Windows.Forms.DragEventHandler(this.treeView_DragEnter);
this.treeLicencegrpView.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeView_DragDrop);
this.dgDataItemgrp.MultiSelect = true;
this.dgDataItemgrp.MouseDown += new System.Windows.Forms.MouseEventHandler(dgview1_MouseDown);
DataRelation relLicData;
DataColumn colMaster1;
DataColumn colDetail1;
--> colMaster1 = dset.Tables["webqa_state.dbo.METADATA_LicenseGroups"].Columns["LicensegroupID"];
--> colDetail1 = dset.Tables["webqa_state.dbo.METADATA_Data_Items_LicenseGroups"].Columns["LicensegroupID"];
--> relLicData = new DataRelation("RelLicData", colMaster1, colDetail1);
--> dset.Relations.Add(relLicData);
TreeNode rootNode = new TreeNode();
rootNode.Text = "LicenseGroups";
this.treeLicencegrpView.Nodes.Add(rootNode);
foreach (DataRow row in treeViewlicencegrpID().Rows)
{
TreeNode newnode = new TreeNode();
newnode.Text = "[" + row["LicenseGroupID"].ToString() + "] " + row["Name"].ToString();
newnode.Tag = (int)row["LicensegroupID"];
treeLicencegrpView.Nodes[0].Nodes.Add(newnode);
}
TreeNode parentNode = new TreeNode();
parentNode.Text = "LicenseGroupID";
this.LicgrpTreeView.Nodes.Add(parentNode);
foreach (DataRow row in treeViewlicencegrpID().Rows)
{
TreeNode newNode = new TreeNode();
newNode.Text = "[" + row["LicenseGroupID"].ToString() + "] " + row["Name"].ToString();
LicgrpTreeView.Nodes[0].Nodes.Add(newNode);
}
TreeNode mainNode = new TreeNode();
mainNode.Text = "Eserver";
this.eserverTreeview.Nodes.Add(mainNode);
foreach (DataRow row in getEserverEtitlementSetID().Rows)
{
TreeNode newNode = new TreeNode();
newNode.Text = row["FullDeatilsESet"].ToString();
this.eserverTreeview.Nodes[0].Nodes.Add(newNode);
}
}
--> public DataTable getLtable()
{
DataTable Ltable = new DataTable("myTable");
SqlCommand cmd = new SqlCommand("SELECT * FROM webqa_state.dbo.METADATA_LicenseGroups");
cmd.CommandType = CommandType.Text;
cmd.Connection = DBConnection.getConnection();
dLGrp1 = new SqlDataAdapter(cmd);
dLGrp1.TableMappings.Add("webqa_state.dbo.METADATA_LicenseGroups","myTable");
dLGrp1.Fill(Ltable);
return(Ltable);
}
--> public DataTable getDtable()
{
DataTable Dtable = new DataTable("myTable1");
SqlCommand cmd = new SqlCommand("select *FROM webqa_state.dbo.METADATA_Data_Items_LicenseGroups");
cmd.CommandType = CommandType.Text;
cmd.Connection = DBConnection.getConnection();
dLGrp2 = new SqlDataAdapter(cmd);
dLGrp2.TableMappings.Add("webqa_state.dbo.METADATA_Data_Items_LicenseGroups","myTable1");
dLGrp2.Fill(Dtable);
return (Dtable);
}
public DataTable getEserverEtitlementSetID()
{
string cmd = "SELECT EntitlementSetID, '['+ CAST(EntitlementSetID As varchar(20))+ ']'+Name AS FullDeatilsESet from webqa_registration.dbo.ESERVER_Entitlement";
return DBConnection.getDataTable(cmd);
}
public DataTable treeViewlicencegrpID()
{
string cmd = "SELECT Name,LicenseGroupID FROM webqa_state.dbo.METADATA_LicenseGroups";
return DBConnection.getDataTable(cmd);
}
private void treeView_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
{
e.Effect = DragDropEffects.Copy;
}
private void treeView_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{
if (e.Data.GetDataPresent("System.Windows.Forms.DataGridViewSelectedRowCollection", false))
{
Point pt = ((TreeView)sender).PointToClient(new Point(e.X, e.Y));
TreeNode DestinationNode = ((TreeView)sender).GetNodeAt(pt);
DataGridViewSelectedRowCollection rowCollection = (DataGridViewSelectedRowCollection)e.Data.GetData("System.Windows.Forms.DataGridViewSelectedRowCollection", false);
foreach (DataGridViewRow drv in rowCollection)
{
string nodeName = ((DataRowView)drv.DataBoundItem).Row[1].ToString() + " [" + ((DataRowView)drv.DataBoundItem).Row[0].ToString() + "]";
//DestinationNode.Tag = (int)
DestinationNode.Nodes.Add(new TreeNode(nodeName));
DestinationNode.Expand();
}
}
}
private void dgview1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
DataGridView.HitTestInfo info = dgDataItemgrp.HitTest(e.X, e.Y);
if (info.RowIndex >= 0)
{
DataGridViewSelectedRowCollection rowCollection = dgDataItemgrp.SelectedRows;
if (rowCollection != null)
{
dgDataItemgrp.DoDragDrop(rowCollection, DragDropEffects.Copy);
}
}
}
}
private void btnCancel_Click(object sender, EventArgs e)
{
LoadLicGrpDataGrid();
}
private void btnSaveLicenseGrps_Click(object sender, EventArgs e)
{
SaveLicenseGroups();
}
public void SaveLicenseGroups()
{
daLicGrp.Update((DataTable)bsLicGrp.DataSource);
}
}
}
|
|
|
|
|
I suggest you break point these lines then find out which one is the problem, and what is null. We can't possibly solve it for you better than that. Once you know the line, we can make suggestions, obviously.
F9 sets a breakpoint, then F5 starts debugging.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
I got the mistake Thanks anyways
|
|
|
|