|
Thank you both!
I think I've got it.
|
|
|
|
|
Hello everyone,
I've got a little problem.
In an office, there is a server running with a program and in that program is a button to switch off all the lights.
But I would like to have a phisical button. Let's say that we use a keyboard button.
The problem is that there is no source code for the serverprogram. So I would like to know if it is possible to make another program, which can get an keyboard-event and let this event click on the button in another program?
And a happy new year to all of you!
|
|
|
|
|
You can find the window handle of the button and send it a message. It's fiddly, hacky and ugly, but it will work.
The second half, you can write a system wide keyboard hook, or another program which, when it's got the focus, gets the keyboard event, then finds that window and sends it the message.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
hmmmm, I wanted to do this for a long time, is it possible if I just use the Mouse? a program that will set the position of the mouse on the screen using coordinates and then the mouse CLICKS (without user interaction) using a code.
|
|
|
|
|
haha, I like this anwser. Simple and maybe usefull, though it's tricky when the screen changes or is moved. But thanks for this insight.
|
|
|
|
|
Hire a programmer
I are troll
|
|
|
|
|
I am the programmer, still learning, but I just needed some solution-idea's to the problem.
As I have the idea's, I can try to build the app.
|
|
|
|
|
It was a rude statement, my apologies.
The server-application is running under Windows? In that scenario, FindWindow and SendKeys will do the trick, as other people already mentioned.
I are troll
|
|
|
|
|
I forgive your stupidity
Thank you very much. I guess I'll conquer this problem.
|
|
|
|
|
i have a class
public class Command
{
public int Number;
public int Parameters;
}
then 1 xml file :
<common>
<command number="0">
<response parameters="2">
<command number="1">
<response parameters="5">
i wanna assign attribute of the class to value in xml file:
Command[] Response = new Command[200];
XmlDocument Reader = new XmlDocument();
Reader.Load("Sample.xml");
XmlNodeList List = Reader.SelectNodes("/Common/Command");
foreach (XmlNode commandnode in List)
{
int i = int.Parse(commandnode.Attributes["value"].InnerText);
Response[i] = new Command();
HartResponses[i].Number = i;
XmlNodeList Child1List = commandnode.ChildNodes;
foreach (XmlNode Child1 in Child1List)
{
if (Child1.Name == "Response")
Response[i].Parameters = int.Parse(Child1.Attributes ["Parameters"].InnerText);
}}
i got error :"Object reference not set to an instance of an object" at the line
Response[i].Parameters = int.Parse(Child1.Attributes["Parameters"].InnerText);
The code can be executed with i=0,but when i increase to 1, i got this error?
How do i solve it?
Thanks
|
|
|
|
|
hung1984 wrote: Command[] Response = new Command[200];
This creates an array of 200 instances of null. Each must be created before you assign values to it.
Response[i] = new Command();
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
they are already created here:
foreach (XmlNode commandnode in List)
{
int i = int.Parse(commandnode.Attributes["value"].InnerText);
Response[i] = new Command();
HartResponses[i].Number = i;
.............
|
|
|
|
|
Any code that assumes a child node exists, is bad code. I guess this attribute is not always there.
A good way to debug this code is to break it up into as many lines as possible, and see which line blows up. The debugger is also a powerful tool.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
i use it cause my xml file surely have the node named Response. But why the error started with Response[1]?
|
|
|
|
|
I assume because that's the one that doesn't have the attribute. Hard to say, I don't see your XML, and you don't say if you did what I told you to do to work out the exact problem.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
thanks a lot. I think there's some mistake with my xml file
|
|
|
|
|
high i am learning crystal reports and have looked at some articles here to find how to create a crystalviewer, after i add a new item(Crystal Report item) i can not see the designer! i just have "myreport.rpt" and "myreport.cs" in my solution explrr. when i double click on "myreport.rpt" it shows me some hex codes and when i d-click on "myreport.cs" it tells me to drag item from toolbox!
how i can launch the designer and add tables and etc....?
|
|
|
|
|
I'm trying out remote debugging from a WinXP Pro machine to a Win 2003 Server machine (where the source code is deployed).
When I try to compile from Visual Studio 2008, the following error is displayed:
Error 1 'CaseTrak.Activities.StatusUpdater.CTSetCaseReviewStatus(string, int)' must declare a body because it is not marked abstract, extern, or partial z:\Projects\CaseTrak.Activities\CaseTrak.Activities\StatusUpdater.cs 37 21
<code>
public bool CTSetCaseReviewStatus(string sCaseID, int iStatus)
<code>
</code></code>
Resolution (http://msdn.microsoft.com/en-us/library/bb397743.aspx[^])suggests to me that get and set methods have to be set for the variable type, however, it does not seem to fit within the context.
Any ideas?
// cs0840.cs
// Compile with /target:library
using System;
class Test
{
public int myProp { get; } // CS0840
// to create a read-only property
// try the following line instead
public int myProp2 { get; private set; }
}
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
using CaseTrak.WebServices;
namespace CaseTrak.Activities
{
public partial class StatusUpdater: SequenceActivity
{
public StatusUpdater()
{
InitializeComponent();
}
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{
try
{
}
catch (Exception ex)
{
}
return ActivityExecutionStatus.Closed;
}
public bool CTSetCaseReviewStatus(string sCaseID, int iStatus);
}
}
Jon
|
|
|
|
|
Hi
As you know a class can have fields,methods,properties and events.In general ,methods are behaviors and fields are attributes of a class.(Properties are some special methods to control accessing to the fields according to the encapsulation rule) therefore if there's a behavior (method or property) it should be implemented (or as the exception says should have a body using brackets) unless it's either an abstract method in an abstract class that it's inheritor should implement it and thus it should not have a body or an external method (a placeholder for a windows API method)
The problem here is that you have a CTSetCaseReviewStatus method that has no body.You can change it like this:
public bool CTSetCaseReviewStatus(string sCaseID, int iStatus)
{
}
|
|
|
|
|
hi friends
How do i add/merge 2 hashtables into third hashtable
Tejesh
|
|
|
|
|
If there's no method for this, you can iterate over the Keys and use those to copy the values in.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
If you use .NET 3.5 then you can use the Union method:
Dictionary<int,> dicA = new Dictionary<int,>();
dicA.Add(1, 10);
dicA.Add(2, 20);
dicA.Add(3, 30);
Dictionary<int,> dicB = new Dictionary<int,>();
dicB.Add(3, 35);
dicB.Add(4, 40);
dicB.Add(5, 50);
var newDic = dicA.Union(dicB);
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
i have developed a custom control that have some property to show/hide its child controls. When i set their Visible prop to False the get Hide. But when i run it or just reopen that control they appear again. Any solution ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hi
Can you send us some code ?
|
|
|
|
|
didnt think it would need, well here is it.
public bool ShowThing
{
get { return picturebox1.Visible; }
set { picturebox1.Visible = value; }
}
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|