|
I am in the end way of solving hooked process and related problem. I have extracted the controls some how of other managed processes and simulate those controls on the some other seperate process. Now after somehow drawn those controls on other processes exactly on those position at which they were inside the original processes, I want to send input to those actual processes , which do occur on the simulator process'es simulated controls. So that If somehow the simulator's control (e.g Button) recieve "click" , it should transfer to actual process button control's event handler
Let say I have managed process(TestProcess-A) having several controls (e.g Buttons,TextBox,TextAreas,Grids) and I have transferred all the properties associated with each controls to some other remote process (let say Simulator Process B) and drawn these controls exactly at the same position where it was in actual process after reading these properties.
I want now, if some how the click occured on these simulated controls, it must flown towards actual controls drawn on actual process. i.e if some SIMULATED Button recieve click on Simulator's process, it should occurred and on the actual process (Test Process A)'s actual Button.
So that if some functionality written in that buttons's event handler, it should be executed after there in actual process (Test Process-A).
Note:
I am developing .NET automated testing framework, for that I need to automate all managed processes those having GUIs.
|
|
|
|
|
I am facing a problem related to get out all the controls from some hooked process. My SpyDll launched into hooked process sucessfully, But when I check the statement
Control control = Control.FromHandle(MainWindowHandle), it returns null into control object where "MainWindowhandle"is just a native main window handle of that hooked process, which you always take from .NET "Process" class after launching that process.
But STRANGLY it happens that in some other hooked process which is the same C# .NET application, it returns valid object of Main "WinForm".
So why it will not work in above case? Are there any exceptions to use "MainWindowHandle" properly. In my case both are seperate .NET managed processes programmed in C#. Any process configuration needs to maintain specially while creating that process?
Regards Usman
|
|
|
|
|
I am using datagrid control to display drill down data through a dataset. it works fine i.e. displays parent records in required manner (with a plus sign) but on click of plus in place of showing child rows it shows a link with name of relation I defined in dataset.
can any one suggest me where I am missing?
With Thanks & Regards
Amit Sk Sharma
modified on Wednesday, June 29, 2011 6:56 AM
|
|
|
|
|
Considering none of the out-of-the-box datagrid in Windows Form supports drill-down like that, you're going to have to explain what you're using for a grid and/or where it came from.
It sounds as though this is some grid you threw together yourself to add drill-down support, and you've obviously got the implementation wrong.
|
|
|
|
|
Actually, you are incorrect. The DataGridView (and I think the DataGrid in .Net 1.1) does indeed support drilldown through relations, in the manner the OP describes. I have never investigated how to use it effectively, though.
EDIT: see answer below. The DataGrid does, the DataGridView does not.
modified on Wednesday, June 29, 2011 1:14 PM
|
|
|
|
|
He's correct. The Windows DataGridView doesn't support this out of the box, nor does the DataGrid. It's quite common on webpages, not in Forms.
Bastard Programmer from Hell
|
|
|
|
|
Actually, no I'm not incorrect. None of the Windows Forms grids support drilldown. I don't know what you're talking about, but I'm talking about the functionality you see in Access where you click a little "+" symbol and the grid splits, showing you the related records from another table. No, the Windows Forms DataGridxxx controls do not support that.
|
|
|
|
|
I was half right. The DataGrid (but strangely, not the DataGridView) supports drilldown through relations. Here is a test case to demonstrate:
using System.Data;
using System.Windows.Forms;
class Test {
DataSet ds;
void SetUpData(){
ds = new DataSet();
DataTable dt = new DataTable("lookupTarget");
DataColumn c = new DataColumn("id", typeof(int)); dt.Columns.Add(c);
dt.PrimaryKey = new DataColumn[]{ c };
c = new DataColumn("desc", typeof(string)); dt.Columns.Add(c);
ds.Tables.Add(dt);
dt = new DataTable("main");
c = new DataColumn("id", typeof(int)); dt.Columns.Add(c);
c.AutoIncrement = true;
dt.PrimaryKey = new DataColumn[]{ c };
c = new DataColumn("lookup", typeof(int)); dt.Columns.Add(c);
ds.Tables.Add(dt);
DataRelation dr;
dr = new DataRelation("testRelation", ds.Tables["main"].Columns["lookup"], ds.Tables["lookupTarget"].Columns["id"], false);
ds.Relations.Add(dr);
}
void PopulateData(){
DataRow row;
DataTable lookupTarget = ds.Tables["lookupTarget"];
DataTable main = ds.Tables["main"];
row = lookupTarget.NewRow();
row["id"] = 1;
row["desc"] = "Some stuff";
lookupTarget.Rows.Add(row);
row = lookupTarget.NewRow();
row["id"] = 42;
row["desc"] = "Don't panic";
lookupTarget.Rows.Add(row);
row = main.NewRow();
row["lookup"] = 1;
main.Rows.Add(row);
row = main.NewRow();
row["lookup"] = 1;
main.Rows.Add(row);
row = main.NewRow();
row["lookup"] = 42;
main.Rows.Add(row);
}
Form Form {
get {
Form f = new Form();
DataGrid dgv = new DataGrid();
dgv.Dock = DockStyle.Fill;
dgv.DataSource = ds.Tables["main"];
f.Controls.Add(dgv);
return f;
}
}
static void Main(){
Test test = new Test();
test.SetUpData();
test.PopulateData();
Application.Run(test.Form);
}
}
Change the variable 'dgv' to a DataGridView and it doesn't work any more.
I am not aware of a way to make the expansion do anything other than show a link, though.
|
|
|
|
|
I know. There's also no way to make the DataGrid show the child records. That's why I said what I did.
He either has to roll his own or use a third party datagrid to do this.
|
|
|
|
|
I have more than one tables in my dataset and I have defined relationship between them.
sqlDataAdapterClients.Fill(dataSetTimeTracker, "Client");
sqlDataAdapterProjects.Fill(dataSetTimeTracker, "Project");
dataSetTimeTracker.Relations.Add("Intake2Episode",
dataSetTimeTracker.Tables["Client"].Columns["ClientID"],
dataSetTimeTracker.Tables["Project"].Columns["ClientID"]);
dataGrid1.SetDataBinding(dataSetTimeTracker, "Client");
Now my datagrid shows me rows from Client with plus sign and when I click on that plus sign it shows name of relations "Intake2Episode" as a link there in place of respective rows from Project table. wish I could share the screen shot with you.
My issue lies here, I am not clear from where (which setting needs to be done)I can get actaul rows in place of relationship.
With Thanks & Regards
Amit Sk Sharma
|
|
|
|
|
I had to do some digging to find out which grid you were using. I said you had to say what you were using and you didn't do that. What are you using that old-ass grid for?? Nobody uses it anymore.
I see what you're getting at, and what you're seeing is the expected behavior. There is no support in the DataGrid for showing the rows instead of that link.
In order to get what you want, you'll either have to roll-your-own version of the DataGridView or use a third party data grid control. Just about every vendors grid supports the drill down functionality.
|
|
|
|
|
I am working on a proposal for am Xml Universal Message Editor (XUME).
I am considering a tree based interface for the data entry.
I cant see an example of a treeview with both a lablel and textbox per node. I am considering a twin tree approach, the left tree will have the element names as standard label nodes, the right tree will be textboxes for the elemment values. There will be no visible controls on the right side tree, it will take all its queues form the left side tree, and the user will perceive it as a single tree.
Have I a plan, or is this a one way ticket to the hall of shame?
Ger
|
|
|
|
|
If I understand your question correctly, your first tree seems to be okay, but why do you need another tree for the element values? A list view should work as long as you're using it to add/edit/update the attributes for the element selected in the tree.
|
|
|
|
|
Purely experimental. No absolute techincal need to.
Ger
|
|
|
|
|
go ahead and let me know how it goes...
|
|
|
|
|
There may well be an article in there if I can make it happen
Ger
|
|
|
|
|
KA BOOM well that one didn't work. If it does not get you into the hall of shame it will almost certainly drive you nuts.
With WPF/SL is would be a trivial matter
I have used the treeview/listview but then all your edits are in a column rather than the 2 piece treeviewitem
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Check out the several TreeListView articles here on CP, such as: Virtual Mode TreeListView by yetibrain[^].
fyi: some commercial WinForm TreeViews, like IntegralUI TreeView, from Lidor Systems, which I use, easily support WinForm controls within each Node: so it would be trivial to have both a Label and an editable TextBox within each Node.
best, Bill
"Reason is the natural order of truth; but imagination is the organ of
meaning." C.S. Lewis
|
|
|
|
|
|
how to create a text speaker program in vb.net 2008 and how much to form design.?
|
|
|
|
|
Have a look here[^]. Not the highest rated article around but should get you started.
|
|
|
|
|
Hello,
I am facing a strange problem, I have launched a seperate Win Form based process with the help of Process.Start from another process.
That process just dispatched an object which actually contains .NET controls(e.g button,textbox,label,radio button etc) as information (control information I just collected from Injecting other running managed processes). After dispatching , I need to draw these controls on that process having WinForm as main window( as its form based process).
BUT THESE CONTROLS ARE NOT RENDERING ON MAIN FORM WINDOW. Main problem is having with parent control information which is not correct to me.
Take a look at Code
===================
public partial class TestController: Form, IApplicationEventsSink
{
static bool m_ControllerLoadedFirstTime = true;
ITestControl m_TakoControlHandler = null;
public Controller()
{
if (m_ControllerLoadedFirstTime == true)
{
MessageBox.Show("TAKOController called first time");
InitializeComponent();
m_ControllerLoadedFirstTime = false;
}
else
MessageBox.Show("TAKOController called second time");
}
private void Form1_Load(object sender, EventArgs e)
{
MessageBox.Show("Form1_Load");
initEnvironment();
bool bSubscriptionCreated = createSubscription();
if (bSubscriptionCreated == false)
throw new Exception(String.Format("Controller failed to create subscription with Simulator process!!"));
}
public ITestControl CreateControl(CustomControl a_CustomControl)
{
ITestControl TakoControlHandler = Factory.CreateControl(a_CustomControl);
m_TakoControlHandler = TakoControlHandler;
return TakoControlHandler;
}
private void SetProperties(CustomControl a_CustomControl)
{
m_TakoControlHandler.setPropeties(a_CustomControl);
}
public void OnProcess(CustomControl a_CustomControl)
{
MessageBox.Show("OnProcess");
ITestControl TakoHandler = CreateControl(a_CustomControl);
if (TakoHandler != null)
{
SetProperties(a_CustomControl);
m_TakoControlHandler.SetParentHandle(base.Handle);
}
base.Refresh();
base.Update();
base.Show();
}
}
while the control that I need to create and render is :
public class TestButton : Button
{
Control m_Control;
public TestButton()
{
m_Control = new Button();
}
public void SetParentHandle(IntPtr a_ControlHandle)
{
Control ParentControl = Control.FromHandle(a_ContainerHandle);
this.m_Control.Parent = ParentControl;
}
}
any body having any idea? I would be greatly obliged.
Regards
Usman
|
|
|
|
|
See [WinForms - How do I access/call methods in UI thread from a separate thread without passing a delegate?]
Generally the simplest way to do multithreading in a WinForms application is to uses a BackgroundWorker to do the processing and uses the ReportProgress mechanism to send data to the UI.
Alternatively, Invoke could also be used for inter-thread communication.
The control itself should be on the same thread as the Form.
Most other ways to do things need a deep understanding on how things works and some trials...
Philippe Mori
|
|
|
|
|
Its inter-process communication.
Thread which actually launches the WinForm process is in seperate process and runs independently the execution of WinForm process. But it just launches it and dispatches the custom object to it that's it.
Now inside the WinForm process , when object dispatched to it, this cross process thread(the thread which just came from other process) actually tries to render the controls on its main Form( the Form which actually created by this process).
Note :
I think you are right, as the thread which actually renders the controls in other process , is the thread of another process, and I have to create seperate thread inside Form process and needs to take the data from incoming thread while making the incoming thread back to its own process immediately without doing any thing.
Regards
Usman
|
|
|
|
|
Controls contain lots of low level native stuff (window handles, fonts, images etc) which are linked to their host process. I don't think you can 'rehome' them in this way. I know I couldn't find a way to make it work when I tried to host plugins for my lobby client within the main window, and that is just cross-AppDomain, not cross-process.
|
|
|
|