|
I'm new to C#, so please excuse my ignorance. I assume there must be a straighforward way to "trash" (not just temporarily ignore) messages sent to a control, such as a button, so that unintentional/random clicks do not queue up and get handled later. I have successfully filtered messages using the IMessageFilter class functions, but the messages are still queued up and get responded to as soon as I invoke RemoveMessageFilter.
Also, any strong recommendations on a C# manual would be appreciated.
I greatly appreciate any help.
Doug
|
|
|
|
|
Try overriding WndProc - declare the WM constants you want to be ignored and test for them, if you want the message to be passed on (not ignored) call the base - something like...
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_???)
{
m.Result = IntPtr.Zero;
return;
}
base.WndProc(ref m);
}
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)
|
|
|
|
|
Thanks for the input Dave.
I put the WndProc() override function in a Form class definition, with the intention of catching Left Mouse Button events (WM_LBUTTONUP, WM_LBUTTONDOWN, WM_LBUTTONDBLCLK). The effect of this was that messages from clicking on controls (buttons and text boxes) on the form were not even seen by the WndProc function, but the WndProc function did see mouse clicks from anywhere else on the form. I don't know if the mouse messages are modified somehow from the controls so that there IDs are different?
Any help here would be appreciated.
Thanks,
Doug
|
|
|
|
|
Sorry for the delay in replying, haven't been online for a couple of days.
You'll need to create your own classes and derive from whatever control it is you need to intercept for i.e. Button and override WndProc in there.
If you need to then handle it from the parent form, you could raise an events that use event args derived from CancelEventArgs based on the WM_??? and use the bool Cancel to return whether to call base.WndProc(ref Message m). I've not tried this but it should work.
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)
|
|
|
|
|
Hi.
I have created a component group consisting of a web service, windows service, database, etc. Each of these units(the component group being one unit) will be installed on a server (meaning each server will have a windows service, web service, database, etc). In order to call and use the web service I have consumed it and used it as a normal object.
Ex:
ExampleWebService myWebservice = new ExampleWebService();
myWebservice.Create();
Now my question is here. I have a part of my program which reads the webservices' URLs from a database, and needs to call each webservice in order to check if its still alive or not, a kind of heartbeat monitor if you will. From one webservice, how do I call another, knowing its URL and by consuming it ?
Any help will be greatly appreciated, thanks.
|
|
|
|
|
If you have a web method in each web service that is the same (for example each web service has method Alive() which returns boolean), use WSDL to generate a proxy and include that in your project. You don't need to add web service references to your project.Now you can control better the url and other properties. From there on it's like calling a normal web service.
Addition:
See for example: Invoking a Web Service Without Web Reference[^]
Mika
The need to optimize rises from a bad design.
My articles[ ^]
modified on Thursday, November 20, 2008 3:40 PM
|
|
|
|
|
fantastic stuff.
Thank you very much for your help
James
|
|
|
|
|
You're welcome
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Hi all,
i have two different sources.. a Dataset and a String with XML data
I was thinking of converting the Dataset into an XML document, and the string to an XML document and then comparing the two. First of all, is this a viable solution?
Secondly, I know that the data in both XML documents will not be the same (i.e. the actual attributes are not the same) but there are some overlapping attributes like for example NAME, SIZE, EXISTS etc...
How can I compare the two without using a simple shortcut like xml diff
|
|
|
|
|
Could you tell me how to use Application.ApplicationExit event? and I want my program to do somehing before my computer closes. Would you mind teeling me how I can do?
Thanks in advance.
|
|
|
|
|
|
hi evryone
is it posible to open 2 database together in win CE ?
i working in Sql CE
if (answer == 'yes')
MessageBox (the answer)......
than'k alot for any help
|
|
|
|
|
Have you tried? I would imagine using two SqlServerCeConnection objects would do the trick. It is a rather simple test.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
i'll try, and it not work
if it was work....i never ask......
|
|
|
|
|
My requirement is : I will be having billions of data records coming in per day.From those I have to filter some 1000-2000 records based on record names which are stored in a filter. Reading from that filter should continue while we should be able to update the filter for new records .
My doubt is what is the suiatble data structure to be used and can multithreading be used ??
|
|
|
|
|
|
can you please help me....
i have the following code firstly i want to know if logic is correct then secondly i want to know how do i exist the second for loop to get back into the first for loop. the reason for this is once the values in one of the columns of the two tables is different it should write to a temp table in the database and then it should go out of that row and test the next row in the datarow.
code is below
OpenDb();
SqlQuery = "select * from " + Table1 + " where " + txt_comkey_tbl1.Text + " in (select " + txt_comkey_tbl2.Text + " from " + Table2 + ")";
sqlquery = "select * from " + Table2 + " where " + txt_comkey_tbl2.Text + " in (select " + txt_comkey_tbl1.Text + " from " + Table1 + ")";
DataSet ds = new DataSet();
OleDbDataAdapter oda = new OleDbDataAdapter(SqlQuery,dbConn);
oda.Fill(ds, Table1);
int intSkip2 = 0, w = 0;
int intSkip3 = 0, k = 0;
DataSet dp = new DataSet();
OleDbDataAdapter oda1 = new OleDbDataAdapter(sqlquery,dbConn);
oda1.Fill(dp, Table2);
//check what the dataset contains
foreach (DataRow dr in ds.Tables[Table1].Rows)
{
foreach (DataRow drp in dp.Tables[Table2].Rows)
{
for (int i = 0; i < ds.Tables[Table1].Rows.Count; i++)
{
for (int p = 0; p < ds.Tables[Table1].Columns.Count; p++)
{
if (dr[p].ToString() == drp[p].ToString())
{
string tableresults3 = dr.ItemArray[p].ToString();
string tableresults4 = drp.ItemArray[p].ToString();
}
else
{
string tableresults5 = dr.ItemArray[p].ToString();
string tableresults6 = drp.ItemArray[p].ToString();
insertquery = "select * into mytable from " + Table1 + " where " + ds.Tables[Table1].Columns[i].ToString() + " = " + dr.ItemArray[i].ToString();
insertquery2 = "select * into mytable2 from " + Table2 + " where " + dp.Tables[Table2].Columns[i].ToString() + " = " + drp.ItemArray[i].ToString();
OpenDb();
dbCmd = new OleDbCommand();
dbCmd.Connection = dbConn;
dbCmd.CommandText = insertquery;
dbCmd.CommandType = CommandType.Text;
dbCmd.ExecuteNonQuery();
OpenDb();
dbCmd = new OleDbCommand();
dbCmd.Connection = dbConn;
dbCmd.CommandText = insertquery2;
dbCmd.CommandType = CommandType.Text;
dbCmd.ExecuteNonQuery();
}
}
}
}
}
|
|
|
|
|
No, it's definitely not correct.
Some major issues:
:: You are comparing every row in Table1 with every row in Table2, and you are comparing every combination of rows the number of times that there are rows in Table1. So, if you have 100 rows in Table1 and 100 rows in Table2, you are making 10000 combinations, and you compare each combination 100 times making a total of 1000000 comparisons.
:: The variable i is an index of the rows in Table1, but you are using it as an index for the columns in Table1 and Table2.
:: You are getting the values from the fields and using as field names in the insert queries.
:: You are opening a new database connection for every database query, but you are never closing any connections.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Guffa wrote: a total of 1000000 comparisons
use of a thousands separator, or scientific notation, would improve readability...
|
|
|
|
|
Plus, you've got serious issues with SQL injection as well.
Take a search in CodeProject about finding ways to resolve them.
|
|
|
|
|
I am writing an unit test for a mvc web application that checks if a returned list of anonymous variables(in a jsonresult) is correct. therefore i need to iterate through that list but i cannot seem to find a way to do so.
so i have 2 methods
1) returns a json result . In that json result there is a property called data. that property is of type object but internally it's a list of anonymous variables
2) the method calls method 1 and checks if the returned jsonresult is ok.
if i run the test and i break the debugger i can hover over the result and see the items in it. i just don't find a way to do so in code.(just using a foreach isn't possible because at the point i need it i'm not in the method that created the anonymous method)
|
|
|
|
|
Hello all! I've got an application that is setting on a server that is run my multiple users. The user's shortcuts are pointed to the .exe on the server, which can in some cases be located in a different office miles away. I have read the article dll search order article on msdn
http://msdn.microsoft.com/en-us/library/ms682586(VS.85).aspx[^]
It states that the initial search for the dll's will be done in the directory where the app was launched from. It's going to find them in this case which I would assume could be bad considering they are on a remote server(for performance reasons). If I use the SetDllDirectory() function and make sure that each user has the dlls locally, am i only changing the searh order for my specific application?
Any other info would be greatly appreciated. Thanks
|
|
|
|
|
A quick read of the documention on SetDllDirectory[^] says it's only for the application.
|
|
|
|
|
I want to do mouse gesture for draw line on desktop. Which draw without window.
Who can do it or have some advices. Please contact to me or post source code about its.
Thank You so much.
|
|
|
|
|