|
Hi all,
I'm having trouble suppressing mouse clicks globally. There are a lot of articles about how to connect to mouse and keyboard hooks and how to suppress a keypress but how would you stop, say, a right click in Windows?
Thanks in advance.
|
|
|
|
|
Stop a right click where?
If it's your application just don't handle the event.
only two letters away from being an asset
|
|
|
|
|
to allow your application to prevent a right click being actioned in Windows by using your application as a form of mouse hook that doesn't pass on any right clicks to any other applications/windows
|
|
|
|
|
Have you tried looking here[^]?
only two letters away from being an asset
|
|
|
|
|
thanks for the reply. Yeah I have read that article but I can't work out how to prevent the mouse click event being passed on to other windows. With the keys you can just set the e.handled=true but there doesn't appear to be a similar thing for the mouse.
|
|
|
|
|
Hello, i need help in some subject i can't handle with for few days. lets say i have form that handle with some rent order (like....billiboards) after the user choose the number of the billboard and the Location and everything else, he need to choose 2 dates. one for the publish day and one for the getOFF day. i have odbc database that hold all the information about the billboards etc... how can i make some "if" or queries that will check that this billboard is not ordered in that range of days? for now i only have the insert handle. PLEASE HELP.
in abstract way = the code have to check the "signNumber" too not only the range between dates. in ABSTRACT = "take the signNumber and check if is available between that two dates if yes, insert to the database if not throw messagebox - NOT AVAILABLE"
<br />
using System;<br />
using System.Collections.Generic;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Drawing;<br />
using System.Linq;<br />
using System.Text;<br />
using System.Windows.Forms;<br />
using System.Data.Odbc;<br />
<br />
namespace forumArt<br />
{<br />
public partial class addNewCampaign : Form<br />
{<br />
public addNewCampaign()<br />
{<br />
InitializeComponent();<br />
}<br />
<br />
private void addNewCampaign_Load(object sender, EventArgs e)<br />
{<br />
this.customersTableAdapter.Fill(this.dataSet1.customers);<br />
this.signsDetailsTableAdapter.Fill(this.dataSet1.signsDetails);<br />
<br />
}<br />
<br />
private void button2_Click(object sender, EventArgs e)<br />
{<br />
Close();<br />
}<br />
<br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
if (signNumber.Text == "")<br />
{<br />
MessageBox.Show("חובה לבחור את מספר השלט");<br />
}<br />
if (companyName.Text == "")<br />
{<br />
MessageBox.Show("נא לבחור את שם החברה המזמינה");<br />
}<br />
else<br />
{<br />
try<br />
{<br />
OdbcConnection conn = new OdbcConnection("dsn=forumArtDataBase");<br />
OdbcCommand cmd = new OdbcCommand("insert into orders(signNumber,fromDate,toDate,companyName,comments) values ('" + signNumber.Text + "','" + fromDate.Text + "','" + toDate.Text + "','" + companyName.Text + "','" + comments.Text + "')", conn);<br />
conn.Open();<br />
cmd.ExecuteNonQuery();<br />
conn.Close();<br />
MessageBox.Show("ההזמנה התווספה בהצלחה");<br />
Close();<br />
}<br />
catch (OdbcException ex)<br />
{<br />
<br />
MessageBox.Show("התבצעה שגיאה בעת ניסיון ההתחברות למסד הנתונים" + ex);<br />
}<br />
}<br />
}<br />
}<br />
}<br />
|
|
|
|
|
First, stop using string concatenation to form your sql statements. There has been enough written about how poor this is, for number of reasons, that you should have seen something about it. Use a stored procedure.
SQL
IF( NOT EXISTS(SELECT signNumber FROM orders WHERE Date BETWEEN start AND end))
INSERT...
RETURN 1
ELSE
RETURN 0
Code
if( SQLCommand.ExecuteScalar() == 0 )
display mbox
only two letters away from being an asset
|
|
|
|
|
In general terms what you need to do is the following.
Get the signNumber, Start Date, End Date and Company Name (needed for insert later) from the user.
Pass the signNumber, Start Date and End Date as parameters to an SQL select statement which does the following:
<big>Select</big> whichever fields you want from the orders table <big>where</big> orders.signNumber == the one passed as a parameter
and ((the Start Date passed as a parameter is <big>between</big> orders.fromDate and orders.toDate)
or (the End Date passed as a parameter is <big>between</big> orders.fromDate and orders.toDate))
If the Select statement returns any rows the sign is already booked for at least part of the required period.
If, on the other hand no rows are returned, then the board is free to be used.
The highlighting provides some clues to things that you will need to research in order to do this.
Good Luck!
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.”
|
|
|
|
|
Is there a way to know whether windows is doing a Restart OR a Shut Down?
I mean by any means in the world?
It's easy to catch the WM_ENDSESSION message but it regroups these both modes.
Also is there a way to do the same thing but with Stand By and Hibernate??
I can't and won't believe there is no way whatsoever to do this.
It's another of these things that seems ridiculously easy but turn out to be an hardcore nightmare when you attempt it.
Thanks
Olograph
|
|
|
|
|
Why would it matter?
A restart is (effectively) just a shut down that doesn't need the user to push a button to get going again. He could easily enough turn a restart into a shutdown by turning off the power, couldn't he?
Unless you have defective hardware that needs a complete power down cycle to fix a problem, it really shouldn't matter, so I could understand Windows not giving you the information.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Hi everybody,
I'm trying to make a simple contactlist in VS2008 C#.
1) I need to display a table in a mdb db file in a datagrid.
2) Above the grid in the UI i have a searchcritera on which column i want to make the search on.
Think a dropdownbox with column names and a textbox that is the relevant searchtext.
3) When i change the searchtext char by char i want to show a subset of the datagrid(growing or shrinking), ie filter out rows that
doesn't meet the "searchtext".
Don't need complete solutions, just point me in the direction of which controls and approaches to use.
Am a bit anti against datasets, but probably in this case i would use them ?
/Daniel S
|
|
|
|
|
babbelfisken wrote: anti against datasets
Ignoring the double negative - why? Datasets are useful. They are, after all, sets of data, which is what we all deal with every day.
More often than not, it's really one of the underlying data tables we want, so bind to that instead.
If the data table represents a class, then convert to the class in your business layer (or in the background if you're not using an n-tier type structure) and bind to the class instance.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Ok now I got the User Names now I am needing help on learning how to filter the list so that I get all persons and not the junk loging such as DHCP Administrator, DNSUpdateProxy groups, etc...
I only want persons...
<code> public void ShowDomainUsers()
{
string filter = "";
//DirectoryEntry domain = new DirectoryEntry("LDAP://domain.com/CN=Users,DC=Domain,DC=com");
try
{
if (File.Exists(Environment.CurrentDirectory + "\\Debug.txt"))
{
MessageBox.Show("LDAP://" + cboDomains.Text + "/CN=Users,DC=" + Left(cboDomains.Text, (cboDomains.Text.IndexOf(".", 0))) + ",DC=" + Right(cboDomains.Text, (cboDomains.Text.Length - cboDomains.Text.IndexOf(".", 0) - 1)));
}
using (DirectoryEntry domain = new DirectoryEntry("LDAP://" + cboDomains.Text + "/CN=Users,DC=" + Left(cboDomains.Text, (cboDomains.Text.IndexOf(".", 0))) + ",DC=" + Right(cboDomains.Text, (cboDomains.Text.Length - cboDomains.Text.IndexOf(".", 0) - 1))))
//root and filter and propertiestoload I do not know what to put
//filter = "(objectCategory=person)(objectClass=user)";
//using (DirectorySearcher searcher = new DirectorySearcher(root,filter,propertiestoload))
//using (SearchResultCollection results = searcher.FindAll())
//sAMAccountName -- THIS IS WHAT I want to get the USER Login names
foreach (DirectoryEntry child in domain.Children)
{
//Console.WriteLine(child.Name);
//lbxDomainUsers.Items.Add(new ListViewItem(new string[] {Right(child.Name, (child.Name.Length - 3)), child.Username}));
lbxDomainUsers.Items.Add(Right(child.Name, (child.Name.Length - 3)) + " | " + child.Properties["sAMAccountName"].Value);// Username);
}
}
catch
{
MessageBox.Show("We are having a problem with the active directory.");
}
}
modified on Friday, July 10, 2009 5:37 PM
|
|
|
|
|
Ok this finally gives me what I am wanting but now I can not bring in multiple properties without it erroring.
public void ShowDomainUsers()
{
//string path = "LDAP://xxxx/CN=Users,DC=firm,DC=xxxx,DC=com";
string Path = "LDAP://" + cboDomains.Text + "/CN=Users,DC=" + Left(cboDomains.Text, (cboDomains.Text.IndexOf(".", 0))) + ",DC=" + Right(cboDomains.Text, (cboDomains.Text.Length - cboDomains.Text.IndexOf(".", 0) - 1));
string Filter = "(&(objectCategory=person)(objectClass=user))";//(!userAccountControl:1.2.840.113556.1.4.803:=2))";
string[] PropertiesToLoad = new string[2] { "name", "sAMAccountName" };
//DirectoryEntry domain = new DirectoryEntry("LDAP://domain.com/CN=Users,DC=Domain,DC=com");
try
{
if (File.Exists(Environment.CurrentDirectory + "\\Debug.txt"))
{
MessageBox.Show("LDAP://" + cboDomains.Text + "/CN=Users,DC=" + Left(cboDomains.Text, (cboDomains.Text.IndexOf(".", 0))) + ",DC=" + Right(cboDomains.Text, (cboDomains.Text.Length - cboDomains.Text.IndexOf(".", 0) - 1)));
}
using (DirectoryEntry domain = new DirectoryEntry("LDAP://" + cboDomains.Text + "/CN=Users,DC=" + Left(cboDomains.Text, (cboDomains.Text.IndexOf(".", 0))) + ",DC=" + Right(cboDomains.Text, (cboDomains.Text.Length - cboDomains.Text.IndexOf(".", 0) - 1))))
using (DirectorySearcher searcher = new DirectorySearcher(domain, Filter, PropertiesToLoad))
using (SearchResultCollection results = searcher.FindAll())
{
foreach (SearchResult result in results)
{
string name = (string)result.Properties["name"][0];
MessageBox.Show(name);
string name1 = (string)result.Properties["sAMAccountName"][1];
MessageBox.Show(name1);
lbxDomainUsers.Items.Add(name);
}
}
//sAMAccountName -- THIS IS WHAT I want to get the USER Login names
/*
foreach (DirectoryEntry child in domain.Children)
{
//Console.WriteLine(child.Name);
//lbxDomainUsers.Items.Add(new ListViewItem(new string[] {Right(child.Name, (child.Name.Length - 3)), child.Username}));
lbxDomainUsers.Items.Add(Right(child.Name, (child.Name.Length - 3)) + " | " + child.Properties["sAMAccountName"].Value);// Username);
}
*/
}
catch
{
MessageBox.Show("We are having a problem with the active directory.");
}
}
|
|
|
|
|
Figured it out....
public void ShowDomainUsers()
{
//string path = "LDAP://xxxx/CN=Users,DC=firm,DC=xxxx,DC=com";
string Path = "LDAP://" + cboDomains.Text + "/CN=Users,DC=" + Left(cboDomains.Text, (cboDomains.Text.IndexOf(".", 0))) + ",DC=" + Right(cboDomains.Text, (cboDomains.Text.Length - cboDomains.Text.IndexOf(".", 0) - 1));
string Filter = "(&(objectCategory=person)(objectClass=user))";//(!userAccountControl:1.2.840.113556.1.4.803:=2))";
string[] PropertiesToLoad = new string[2] { "name", "sAMAccountName" };
//DirectoryEntry domain = new DirectoryEntry("LDAP://domain.com/CN=Users,DC=Domain,DC=com");
try
{
if (File.Exists(Environment.CurrentDirectory + "\\Debug.txt"))
{
MessageBox.Show("LDAP://" + cboDomains.Text + "/CN=Users,DC=" + Left(cboDomains.Text, (cboDomains.Text.IndexOf(".", 0))) + ",DC=" + Right(cboDomains.Text, (cboDomains.Text.Length - cboDomains.Text.IndexOf(".", 0) - 1)));
}
using (DirectoryEntry domain = new DirectoryEntry("LDAP://" + cboDomains.Text + "/CN=Users,DC=" + Left(cboDomains.Text, (cboDomains.Text.IndexOf(".", 0))) + ",DC=" + Right(cboDomains.Text, (cboDomains.Text.Length - cboDomains.Text.IndexOf(".", 0) - 1))))
using (DirectorySearcher searcher = new DirectorySearcher(domain, Filter, PropertiesToLoad))
using (SearchResultCollection results = searcher.FindAll())
{
foreach (SearchResult result in results)
{
string name = (string)result.Properties["name"][0];
string winuserlogon = (string)result.Properties["sAMAccountName"][0];
//MessageBox.Show(name);
//string name1 = (string)result.Properties["sAMAccountName"][1];
//MessageBox.Show(name1);
lbxDomainUsers.Items.Add(name + " | " + winuserlogon);
}
}
//sAMAccountName -- THIS IS WHAT I want to get the USER Login names
/*
foreach (DirectoryEntry child in domain.Children)
{
//Console.WriteLine(child.Name);
//lbxDomainUsers.Items.Add(new ListViewItem(new string[] {Right(child.Name, (child.Name.Length - 3)), child.Username}));
lbxDomainUsers.Items.Add(Right(child.Name, (child.Name.Length - 3)) + " | " + child.Properties["sAMAccountName"].Value);// Username);
}
*/
}
catch
{
MessageBox.Show("We are having a problem with the active directory.");
}
}
|
|
|
|
|
Wondering if I'm missing something fundamental.
I want tabbed planes with the exact gui/functionality on each. Each will load different data.
The tabbed planes seem to be such that each pane is different.
Is there a setting for this or do I need to clone what VS does for the first tab for each added tab?
--av
|
|
|
|
|
This is an ideal candidate for a user contol.
Put all your controls and the functionality into a user control and drop one onto each tab. Any communication with the parent form or other objects that the form references can be done with events and you get good reusability of your code.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
|
Whilst your question is not absolutely clear, can I suggest that you look at TabConrol Class[^].
If that does not help, please come back, and if you could find a way to reword your question, it might make it easier for others to help you.
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.”
|
|
|
|
|
Hi Friends,
Are Methods and Functions the similar thing? I mean, are they same. I surfed the net and on some forum I found this definition, which I modified: "Methods are in-built whereas Functions are user-defined, in a programming environment". Is this definition correct to some extent? I mean, it would have been very nice of you all, if you guys could provide me an advanced definition for this. And please say, whether the same definition work out for both OOP and other non-OOP HLL language.
Thanks in advance,
Help would be appreciated,
Rajdeep
I calculate my days on earth..... approximately 55 years remaining for me to expire
|
|
|
|
|
|
In my mind, a method is a named block of code which may accept an input, usually performs an action, and may either alter the input, return output, or both. A function is a method which returns output. These are just working definitions, so may not be technically correct. They just work in most scenarios
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
Hi freak!
Well, thanks for the definition man. Actually, in C#, the concept of methods and functions are eventually different, whereas, in Java, theres no concept of functions. Only methods.
Well, suddenly I was struck with the lightening of knowledge
The stuff also can be defined like: "A method can be declared within a function, however, its not possible to declare functions within a method". How's that? Silly aint it? Does this make any sense. Do let me know!
I calculate my days on earth..... approximately 55 years remaining for me to expire
|
|
|
|
|
That doesn't make any sense. I've already said how I view methods and functions to be different, how is this inaccurate - it implies that functions and methods are different, with functions being a subtype of methods
The definition you gave is odd. If I declared some C# code like so:
public int Function()
{
private void Method()
{
}
} It wouldn't compile AFAIK (not got access to csc, so can't check). The same point applies to the second clause of your sentence.
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
Indeed, C-like languages can't do that. (Probably for good reason.)
|
|
|
|
|