|
Patrick Sears wrote: It should be that simple
Yes you have the gist of it.
Patrick Sears wrote: The DLL has no idea who or what is consuming it
That is a good way to put it. I should have said that to begin with
Patrick Sears wrote: Define the event in the DLL, and what in the DLL will raise it. In the exe, you simply attach an event handler to that event on that class
Thanks! I just wanted some validation to the assumption that events are a semi-decent way to go. I guess I am off to study up on C# event routing.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
Patrick Sears wrote: simple
OMG. I apologize for wasting your time. If I had only known that it was as seemingly simple as what I think it is....
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
Wes Aday wrote: OMG. I apologize for wasting your time. If I had only known that it was as seemingly simple as what I think it is....
I wouldn't call it a waste We all learn things every day, lots of them seemingly so simple we should have known it in the first place...
I regularly discover that the way I did something was so lame brained and over complicated that I want to kick myself. I've rather learned to spend time thinking about the absolute simplest way to do things before writing any code..
It has become appallingly obvious that our technology has exceeded our humanity. - Albert Einstein
|
|
|
|
|
Hay y'all,
I want to use a specific font in my app. how would I add to my resources and reference from there?
Any help much appreciated.
Mike
|
|
|
|
|
Yeah, VS2005 supplies the ability to factor public fields one at a time, but is there a way to select ALL the fields you want to refactor and create properties for them all at once?
I've got a few classes I need to do this for, each with a not-insignificant number of properties, and I'm not looking forward to the 1-2 hours of mindless tasks.
Help is appreciated!
It has become appallingly obvious that our technology has exceeded our humanity. - Albert Einstein
|
|
|
|
|
Someone.. voted me.. a 2. Ooo... k...
It has become appallingly obvious that our technology has exceeded our humanity. - Albert Einstein
|
|
|
|
|
Hi:
I would like to get a text of a button of another application that is running. If the text on the button is of some value, say "start", I would like to click it, so that it changes to "stop".
I am able to get the process title of the application, but I would like to reference the objects (buttons, text/list box) on the form. The application in question was written in VB, but I would like to use C#. Note I do not know the names of these objects (button, textbox, etc).
The main problem is that this application has to stay logged into. If the application is started, the "button" must still be pressed to get the application going.
Your immediate response (sample code) to this request would be greatly appreciated. Response in C++ is fine too, but my preference is C#
I'm using .NET 2.0
Thanks.
Gbenga
|
|
|
|
|
C# can't do it without interop, so that it calls C++ APIs. Getting the text is easy, I guess you'd use a SendMessage to click the button.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I can get the Title text, but how do I get the text of the button? Can you send a sample code? Thanks.
|
|
|
|
|
Do you have a sample code on how to get the text from the button? I sent my code earlier to Muammar in the same thread. Thanks.
|
|
|
|
|
Did you try Managed Spy++[^]
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
No. I have never used it before. Can you provide me with information on how to proceed with Managed Spy++ or provide me with a link to any documention on it?
Thanks.
Gbenga
|
|
|
|
|
|
|
Hi:
Meanwhile, do you have a sample code (without using ManagedSpy)? I would like to get the text of the button of the application that is running programmatically.
I downloaded ManageSpy and installed it accordingly. Recompile the code in VS 2005 and ran it. I was able to see the name of a running application objects (buttons, etc, and their properties).
Thanks.
Gbenga
|
|
|
|
|
Hi again:
Here is the piece of code that I am trying to use for this. This code will get the processes' names and their titles with their corresponding id. I'd like to get to the text of a button of a particular process. I don't even need to click it, I only need the value of the text, so that I can execute some message to be sent to someone or write an entry to the Windows event log (which I can do).
/***** Code starts here *****/
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
namespace ProcessTitle
{
class Program
{
static void Main(string[] args)
{
StringBuilder sb = new StringBuilder();
foreach (Process p in Process.GetProcesses()) //local machine
{
try
{
//try to get a handle on the Windows - Not doing anything with this. I'd like
//to use this to get the text of my button
IntPtr hWnd =
System.Diagnostics.Process.GetProcessById(p.Id).MainWindowHandle;
sb.Append("Windows Title: " + p.MainWindowTitle + Environment.NewLine);
sb.Append("Process Name: " + p.ProcessName + Environment.NewLine);
sb.Append("PID: " + p.Id.ToString() + Environment.NewLine);
}
catch
{
}
}
Console.Write(sb);
Console.Read();
}
}
}
/***** Code ends here ***/
Gbenga
|
|
|
|
|
I'm sorry but it seems like you'll have to use the Spy package.
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hi,
I'm trying to implement a drag'n drop from a multiselect listView to a tree. The code is as follows:
private void listView1_ItemDrag(object sender, System.Windows.Forms.ItemDragEventArgs e)
{
listView1.DoDragDrop(listView1.SelectedItems, DragDropEffects.Copy);
}
private void treeView1_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
{
if (e.Data.GetDataPresent(typeof(ListView.SelectedListViewItemCollection)))
e.Effect = DragDropEffects.Copy;
}
private void treeView1_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{
//do something here
}
Everything is fine, except that a lot of times the list thinks I'm trying to select items instead of initiating a drag'n drop. Is there a listView setting I'm missing somehow?
thanx
|
|
|
|
|
kozu wrote: except that a lot of times the list thinks I'm trying to select items instead of initiating a drag'n drop
By any chance are you using "Full Row Select" mode?
I've learned that often triggers that behavior. What I did was that when I initiate Drag Drop on the ListView, I turn off FullRowSelect.
This has the added benefit of allowing the user to select multiple items and then DE-select them by clicking a non-highlighted area (with full row select, that can be hard to do if there is no non-highlighted space). When the drag operation ends, or they de-select the items, I turn it back on.
It has become appallingly obvious that our technology has exceeded our humanity. - Albert Einstein
|
|
|
|
|
I have a VERY simple application used to access Outlook Web Access from my development box. The application runs perfect on my system, the one used to compile. However when I tried to move the app to ANY other system, I run into the following error.
I can open and login to OWA. However, when I click on anything that would open a new window, the new window is not what it should be. Instead it defaults back to the login page. The main form stays logged in.
Now, I'm completely stumped as to why this would do this, but I'm sure it's an easy fix for somebody, so please make my day and help me out here!
modified on Friday, January 04, 2008 6:01:05 PM
|
|
|
|
|
How can i drag and drop user control on double buffered panel ...
Regards
Nemanja
"Work,Work,Work ..."
|
|
|
|
|
hi
how can i get the level of battery and memory in c# code ?
for pocket pc ?
thanks
|
|
|
|
|
Hi.
I have an app that reads the DB, and then populates a panel in my program with a bunch of labels. The user is able to drag those labels anywhere on the panel (basically drag and drop, using MouseDown, MouseMove, MouseUp). Some of those labels have "links" between them which I'd like to represent with lines, connecting one label to another. I'd also like the lines to be redrawn to the new label location once a label is moved by a user. What is the easiest way to do this?
I tried maintaining a list of labels and their links, and updating the link, then just redrawing lines. However, in my MouseUp function, where the links are updated (mouse up means the user "dropped" the label and so it has a new location), the x,y coords of e are always zero:
[pre]
private void my_lbl_MouseUp(object sender, MouseEventArgs e)
{
drag = false;
Point temp;
for (int i = 0; i < Links.Count; i++ )
{
if (Links[i].p1 == old_point1 || Links[i].p1 == old_point2)
{
Links[i].p1.X += e.X;
Links[i].p1.Y += e.Y;
}
if (Links[i].p2 == old_point1 || Links[i].p2 == old_point2)
{
Links[i].p2.X += e.X;
Links[i].p2.Y += e.Y;
}
}
}
[/pre]
Can anyone tell me why e.X and e.Y are always zero when a user moves the labels? Or an easier way to do what I've described above?
Any help or advice is appreciated.
|
|
|
|
|
oops, sorry:
private void my_lbl_MouseUp(object sender, MouseEventArgs e)
{
drag = false;
Point temp;
for (int i = 0; i < Links.Count; i++)
{
if (Links[i].p1 == old_point1 || Links[i].p1 == old_point2)
{
Links[i].p1.X += e.X;
Links[i].p1.Y += e.Y;
}
if (Links[i].p2 == old_point1 || Links[i].p2 == old_point2)
{
Links[i].p2.X += e.X;
Links[i].p2.Y += e.Y;
}
}
}
|
|
|
|
|
I don't know why the arguments in the event args would be broken, but what if you just store the current position in the mouse move ?
In any case, if I am dragging something, I'd expect to update the position in the mouse move event, so I can call invalidate and have the object drawn as it's being moved.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|