|
can i access mouse buffer to get mouse clicks with c#?
-or-
i want to learn mouse click on anywhere how can i do?
<br />
GetMessage(out msg, 0, WM_LBUTTONDOWN, WM_LBUTTONDOWN);<br />
but it runs only on the main window, it doesn't run on another applications.
i want to get all mouse messages.
-- modified at 20:44 Friday 7th July, 2006
|
|
|
|
|
Search for global hooks. There are some articles here on CP that cover this topic.
"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
|
|
|
|
|
Hy,
I have a problemns. I want to read data from datagrid, but i have few problemns, that i can't.
Let me explain:
Datagrid looks : <asp:datagrid id="dgcam" style="Z-INDEX: 104; LEFT: 856px; POSITION: absolute; TOP: 288px" runat="server"
="" cellpadding="0" gridlines="None" showheader="False">
Function how fill this grid is:
private void cam()
{
string conn = ConfigurationSettings.AppSettings["conn"];
SqlConnection objConnection = new SqlConnection(conn);
DataSet ds = new DataSet();
string user = "select utilizator from furnizori where id_client =" + lbluser.Text;
string listcamion = "select count(id_camion) from add_camion join furnizori on (add_camion.id_user = furnizori.id_client)where id_user=" + lbluser.Text;
SqlDataAdapter da = new SqlDataAdapter(listcamion,conn);
da.Fill(ds, "add_camion");
da.Fill(ds, "furnizori");
dgcam.DataSource = ds;
dgcam.DataMember = "add_camion";
dgcam.DataBind();
try
{
objConnection.Open();
}
finally
{
if(objConnection.State == ConnectionState.Open)
{
objConnection.Close();
}
}
In Page Load i have this code, where i had problemns:
if(dgcam.Items != null)
{
listcamionuser();
}
else
{
lblmesaj.Text = "Nu aveti adaugat nici un camion in baza de date";
}
Here i have problemns because i try to read data from grid. In grid count function works very good. In my page load i try to read grid who i fill this function cam(). This i don't knows how to put the cod(function is if(dgcam.Itemns != null) )
Pls help me.
Thanks for all
|
|
|
|
|
What I am wondering is if I can display a form within another forms field.
I have created a form that displays, updates, etc a database however I want that form to appear and be selectable from within another form.
I have created a clickable event that will show the form "outside" of my main form but what I want is for it to appear within an area of the main form.
I've searched everywhere but obviously my terminology is not yet good enough to match the experienced contributors to this fabulous vault
If there is a tutorial that specifically covers what I want to do I would appreciate a pointer to it.
TIA
Glen Harvy
|
|
|
|
|
|
Glen Harvy wrote: I've searched everywhere but obviously my terminology is not yet good enough
May be. I still don't know exactly what you want.
If you want to use your Form like it was a simple Control then just set its TopLevel property to false and add it to your other form via otherForm.Controls.Add(infoForm) . Don't forget to set Location and Size properly.
|
|
|
|
|
Thanks for the response.
I'll play around with your suggestion as it seems to be what I do/did want.
Glen Harvy
|
|
|
|
|
Hello,
well, i have been checking this over and over again, but i am still unable to catch this exception:
System.Security.Principal.IdentityNotMappedException.
This exception is thrown when i use an incorrect authorizedGroup attribute
within my application config. Surely it's right that i get an exception when i specify a group that
doesn't exist but at least i should be able to catch it, shouldnt i?
try
{
RemotingConfiguration.Configure(".\\MyApp.exe.config", false);
}
catch (Exception)
{}
app.config
<channels>
<channel ref="ipc" portName="MyAppPort" authorizedGroup="IIS_WPG">
<serverProviders>
<<formatter ref="binary" typeFilterLevel="Full" />
</serverProviders>
</channel>
</channels>
However i assume that i can't catch this excpetion because RemotingConfiguration is running
in another (application?)context. Furthermore my application is doing fine. The only thing that bothers me is that
cannot catch this exception when a nonexistent group is specified.
If someone has an idea how to catch this exception, then please let me know.
I would really really appreciate it.
best regards Tobias
|
|
|
|
|
That could reveal where the buck stops so to speak.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
hi,
Hmm, i did this a thousand times but it doesn't point specifically to my application! Obviously RemotingConfiguration.Configure is running in a different thread but how to catch the exception in it?
e voila:
Unbehandelte Ausnahme: System.Security.Principal.IdentityNotMappedException: Man
che oder alle Identitätsverweise konnten nicht übersetzt werden.
bei System.Security.Principal.NTAccount.Translate(IdentityReferenceCollection
sourceAccounts, Type targetType, Boolean forceSuccess)
bei System.Security.Principal.NTAccount.Translate(Type targetType)
bei System.Runtime.Remoting.Channels.Ipc.IpcServerChannel.Listen()
bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext,
ContextCallback callback, Object state)
bei System.Threading.ThreadHelper.ThreadStart()
Further, this exception says that the system was unable to resolve the specified account. However i am fully aware of that and did intenionally use a wrong group. I just want to know
how to catch this security exception that is raised by the CLR.
regards Tobias
|
|
|
|
|
I don't know if that is it or not
<channels>
<channel ref="ipc" portname="MyAppPort" authorizedgroup="IIS_WPG">
<serverproviders>
<<formatter ref="binary" typefilterlevel="Full">
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Ennis Ray Lynch, Jr. wrote: I don't know if that is it or not
<<formatter ref="binary" typefilterlevel="Full">
Nope, that is quite alright. As i said, there is nothing wrong neihter with the program nor with its configuration. I just need to know how i could catch a security exception that is raised during the remoting configuration. I mean my entire application works perfect, unless i specify a group that doesn't exist. It is quite logic that the remoting configuration fails when i specify a nonexistent group but why is it impossible to catch this security exception?
Anyway, thanks for your efforts.
Tobias
|
|
|
|
|
Greetings:
Just as the title says, i want to know how to change the backcolor of a toolbar, i`m guessing it`s done by overriding the onPaint method, but some code would be useful , especially for the measurement of the elements
|
|
|
|
|
I have a portal site that incorporates multiple web parts. One of the web parts is intended to pass a query string to a search application located in another area of the intranet. My problem is thus...The search application is written in standard asp and the portal site is asp.net 2.0/C#, how can I link the two up and pass the string.
Any help, suggestions, or possibly a push in the direction of a reference would be greatly appreciated.
Thanks in advance,
Cheers
Lil Turtle
|
|
|
|
|
You can pass the variable around between the two with the query string(term? I don't write asp.net)
ie: http://someWebAddress/someSite.asp?searchString=some%20really%20long%20search%20string;
or
ie: http://someWebAddress/anotherSite.aspx?searchResult=some%20really%20long%20result%20string;
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Thanks for the tip, I'd forgotten about passing data this way, I'm still rather new to this , and I was kind of stuck in a brain-dead Friday funk.
I implemented the change and it is working well now, thanks.
Cheers,
Lil Turtle
|
|
|
|
|
You can use anything that you would normally use to pass information between pages, without storing the information on the server. Query string, form data, cookies.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks for getting back at me with the help, it's always appreciated to get guidance from one's contemporaries. As one fairly new to coding I'm grateful for the tips.
Cheers,
Lil Turtle
|
|
|
|
|
Hi all,
I'm trying to write an application to deal with email forwarding (in the sense of being invisible to the end user) to a list of 100+ email accounts. I am using Indy.Sockets and a SMTP server provided by Fasthosts (standard mailbox).
I am having trouble getting the SMTP message to deliver to the addresses contained within the 'Resent-To' header ('Resent-From', 'Resent-Date' and 'Resent-Message-Id' are also being included). I'm having to add the 'Resent-To' header via the Indy.Sockets.Message.ExtraHeaders.Add() method as else the 'Resent-To' header seems to break-out into the main email, which results in an incorrectly formatted email (half of the 'Resent-To' addresses are shown in the body with the remaining headers).
Can anyone possibly offer any help? Or have successfully sent emails using a 'Resent-To' header?
Many kind regards,
Ben Whorwood
|
|
|
|
|
Hello!
I am a beginner in UI programming with C#. My problem: I have a ListBox on
a Form, that shall automatically update its content, when the data source
has changed.
I can fire the DataSourceChanged event in the data source class (which is
a derived ArrayList class) and also catch it in the Forms class. But
when I do there a ListBoxInstance.Update() or ...Refresh() ... or
Invalidate(), it has no effect at all.
Maybe someone can give me a hint on what I did wrong?
Here is the interesting part of my source code:
Form1.cs:
private System.Windows.Forms.ListBox listBox1;<br />
private System.Windows.Forms.Button button1;<br />
<br />
private ItemList itemList = null;<br />
<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
<br />
itemList = new ItemList();<br />
<br />
itemList.Add(new Item(1,"One"));<br />
itemList.Add(new Item(2,"Two"));<br />
itemList.Add(new Item(3,"Three"));<br />
<br />
listBox1.DataSource = itemList;<br />
listBox1.DisplayMember = "Desc";<br />
<br />
itemList.eventHandler<br />
+= new EventHandler(listBox1_DataSourceChanged);<br />
}<br />
<br />
private void listBox1_DataSourceChanged(<br />
object sender, System.EventArgs e)<br />
{<br />
Console.Out.WriteLine("DataSource changed 2");<br />
<br />
listBox1.Refresh();
Rectangle rect = new Rectangle(new Point(0,0),listBox1.Size);<br />
listBox1.Invalidate(rect,true);
listBox1.Update();
}
Item.cs:
public class Item<br />
{<br />
private int nr;<br />
private string name;<br />
<br />
public Item(int a, string b)<br />
{<br />
nr = a;<br />
name = b;<br />
}<br />
<br />
public string Desc { get { return "Nr:" + nr + " Name=" + name; } }<br />
}<br />
ItemList.cs:
public class ItemList : ArrayList<br />
{<br />
public EventHandler eventHandler = null;<br />
<br />
public ItemList()<br />
{<br />
}<br />
<br />
public void Remove(Item item)<br />
{<br />
Console.Out.WriteLine("Soll loeschen: " + item.Desc);<br />
base.Remove(item);<br />
FireDataChanged();<br />
}<br />
<br />
public void Add(Item item)<br />
{<br />
Console.Out.WriteLine("Soll adden: " + item.Desc);<br />
base.Add(item);<br />
FireDataChanged();<br />
}<br />
<br />
private void FireDataChanged()<br />
{<br />
<br />
if (eventHandler != null)<br />
{<br />
eventHandler(this,null);<br />
}<br />
}<br />
}
When I call the methods Add or Remove in ItemList, the event is fired,
I can see the Console.out.WriteLine-Message, but the ListBox is not
updated...
Thanks for help
|
|
|
|
|
DataSource to null and then reassigning it works.
listBox1.DataSource = null;
listBox1.DataSource = itemList;
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
It's not a Visual Studio bug, this behavior is seen at runtime. It's not a bug at all, really. ArrayList doesn't implement IBindingList, which is the interface used by the WinForms databinding infrastructure to propogate change notifications from a data source to a control. The methods that CSharper2006 was calling on the ListBox have no effect on syncing the control with the data source. If you really want automatic change noticiations to propogate, use a data source which implements IBindingList.
:josh:
My WPF Blog[^]
|
|
|
|
|
So in his case he could just implement IBindingList in his ItemList class.
On second thought, that interface has a lot of methods!
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
I'm trying to write a program (C# .NET 2003) for use in my school, and so far it works pretty good.
The biggest problem I am having is that when I call MessageBox.Show(), no text shows up anywhere in the textbox, ncluding the title and OK button. This didn't use to occur, and then only on some computers, and now on every computer it is used on (including the design computer)
My computers have all of the Microsoft Updates, so I figured uninstalling .NET Framework 2.0 might help, but it was no good.
Here's my code if that helps:
MessageBox.Show(this, "MyStorage (C) 2006 IT Academy", "About MyStorage", System.Windows.Forms.MessageBoxButtons.OK);
MessageBox.Show("This should show something");
Neither of those work. The message box shows, and is perfectly functional, there is just no text.
If anyone can help, I would greatly appreciate it. I have to have this project finished by the end of this month, and this is my only real issue.
Thanks a lot
using System.People;
Person me = new Person();
me.Certifications = null;
me.Experience = little;
me.WantsToLearn = true;
me.InSchool = true;
me.AskQuestions("C# .NET 2003");
|
|
|
|
|
Try this:
string message = "MyStorage (C) 2006 IT Academy";
string caption = "About MyStorage";
MessageBoxButtons buttons = MessageBoxButtons.OK;
MessageBox.Show(this, message, caption, bttons);
Best,
Jun
|
|
|
|
|