|
I am experimenting with a GUI for a character based application.
The existing program has a field that accepts F1, F2, etc to go
from menu to menu. What I would like to do is create a form that
upon clicking a button would pass the corresponding function key
to the field in order to have the application progress.
I don't know if what I want is even possible so just pointing me
in the right direction would be appreciated. I guess this is more
of a general "how do I" kind of question.
Thank you in advance!
|
|
|
|
|
It seems like what you are asking for is the API sendmessage command. It allows you to emulate key presses to another application/window/process.
techydog wrote: What I would like to do is create a form that
upon clicking a button would pass the corresponding function key
to the field in order to have the application progress.
I am a bit confused with this part, otherwise I may be able to be more specific.
Regards,
Thomas Stockwell
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.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
What I would like to do is create a button in my app labeled F1 and when pressed the other app would recieve the F1 as if a user had actually pressed the key. My goal is a GUI for the orginal app if that makes sense.
When you say API sendmessage command, is there something I need from the orginal app or is this a .NET component I'm not familiar with?
|
|
|
|
|
The API sendmessage is actually a native command of Windows. I have not used sendmessage to emaulate keypresses but I know it is possible to do so. You may consider googling the subject. To help narrow your search first look for API Viewer and API Guide, these programs will help you in determining parameters and syntax for API calls.
Regards,
Thomas Stockwell
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.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Your help is greatly appreciated. I had now idea as to what to look for but you have pointed me in the right direction. I found a few examples of implenting API and sendmessage here and am now on my way.
Thank you very much for help.
Techydog
|
|
|
|
|
Hi!
i'm trying to list drives on pc. i used System.Management namespace for this purpose.
But i don't want to hear the disgusting noise while listing A: drive.
Does anyone help me?
|
|
|
|
|
If you are using .net 2.0 you can use the new driveinfo class. There is a getdrives method. That doesn't appear to make the A: drive make noise.
If you are using .net 1.1 I guess you could always disable your a: in the bios or something.
Hope that helps.
Ben
|
|
|
|
|
I'm not sure if this will help you.
string[] drives = Environment.GetLogicalDrives();
|
|
|
|
|
hello there,
i am working on a project of speech recognition in c#..
in this project the software will be able to execute some voice commond inputed through a mic. i cant generate grammar for the same
till now i dont have satisfactory progress. can anyone there help me regarding this?
thank you
alok
|
|
|
|
|
Hi ..
By next month i have to start my project, and even i am planning over Image and Speech processing.
So i dont think ill be of any help to you at the moment . But yeh you could be definately help to me. So when u get the right path then also do let me know about it and we can work on it together if you are not waiting for its completion that sooner.
Thanks
SS
|
|
|
|
|
|
Does anybody know how Microsoft is saving the rating info for e.g. images?
As far as I can discover, it is not saved in exif- or IPTC-tags.
Purpose is to use the rating info entered with Vista Photo Gallery in an other program...
|
|
|
|
|
I believe this is done with some kind of shell extension. Search this site's articles for shell-related interop, I believe there are some articles that show how to extend the shell to retrieve and save your own information per file.
I could be way off, though. Like ID3 tags, it may be stored as part of the file itself. I'm not a COM expert, nor a shell expert, so take this with a grain of salt.
|
|
|
|
|
i have four text box for different field(name,city,state,country) for searching and three different criteria of search(like member/guest/vendor)
i simply use if else statements but it is too long method
can any one tell me simplest way to impliment it
i use c# for code.
|
|
|
|
|
You can use switch statements to handle lots of if/else logic:
string s = "foo";
switch(s)
{
case "bar":
Console.WriteLine("It was bar!");
break;
case "foo":
Console.WriteLine("It was foo!");
break;
case "baz":
Console.WriteLine("It was baz!");
break;
}
|
|
|
|
|
Hi all,
I am creating an application to control the execution over the remote machines using STAF tool.
Well at the moment i can start the exe over remote machine but i want to now control it like pause, continue and all. So below piece of code is in JAVA. could any one help me out in converting it to C#.NET. Well i have recieved no help from googles for STAF(Software Testing Automation Framework). So if any one could help me out in this then it woould be gr8.
Thanks a lot
if you click on the "Pause" button, the application will Pause. If you then click on the
"Continue" button, the application will resume. Let's take a look at how this code is implemented.
STAFDemoController.java
691: fPause.addActionListener(new ActionListener() {
692: public void actionPerformed(ActionEvent event)
693: {
694: STAFResult stafResult =
695: STAFDemoController.handle.submit2(
696: fMachine, "SEM", "RESET EVENT STAFDemo/Handle/" +
697: fHandle + "/Continue");
698:
699: if (stafResult.rc != 0)
700: System.out.println("Error pausing process RC: " +
701: stafResult.rc + " Result: " + stafResult.result);
702: }
703: });
On line 695 there is a call to the Semaphore service on the machine where the application is running. This call will reset the event semaphore which is uniquely identified by the application's handle.
Now let's look at how the application uses this semaphore":
STAFProcess.java
156: String continue_semaphore = new String(
157: "wait event STAFDemo/Handle/"+h+"/Continue");
196: // block if semaphore is reset, fall through if posted (or
197: // if error!!!)
198: semaphore = handle.submit2(machine, "SEM", continue_semaphore);
In STAFProcess, on line 198 there is a call to the local Semaphore service. The variable continue_semaphore is defined
on line 156.
This call to submit2 will cause application to wait for the event semaphore uniquely identified by its handle. Thus,
whenever STAFDemoController resets the event semaphore, the application will then wait for the event semaphore,
effectively pausing the application's execution.
-- modified at 9:32 Friday 13th April, 2007
|
|
|
|
|
Your post doesn't really have a specific question, so this will be a rather general answer.
I can tell you that you don't need ActionListener class -- while Java forces you to create a class that handles some "event" (in this case, the ActionPerformed event), C# lets you do this using events and delegates. So it would be
fPause.ActionPerformed += myActionPerformedHandlerFunction;
...
void myActionPerformedHandlerFunction(...)
{
STAFResult stafResult = ...
}
For semaphores, look at System.Threading.Semaphore[^]
You can pause any thread (and thus, the whole application) by waiting on a semaphore using the WaitOne method on the Semaphore class. The Semaphore class should work much like the semaphore used in your Java code.
|
|
|
|
|
Well what about this fPause.Act..... line
well i dont think fPause is already defined in C#.NET
I know its hard to explain the whole thing here as not much people knows about STAF and even STAF at the moment doesnt support C# so its not even relevant to ask questions in there forum.
Anyway i am trying to communicate between the two exe. At the moment i can run exe from local system to remote but i want a back communication i.e. after local to remote communication, remote exe goies back to local to ask for more info to run specific task and after recievin info it gets executed.
But as i am not getting it at the moment so i am trying to add functionality of pause, resume exe frm local system using semaphor and queue.
Anyway thanks for your reply
|
|
|
|
|
What type is the fPause variable?
For communication between 2 .NET processes, search for .NET remoting.
|
|
|
|
|
Hi guys,
I am trying to go through EACH SELECTED ITEM in a listbox and move it over with certain configuration to another listbox. I can't figure it out how to go through each and unselect it and then go through the next one.
In list view there is somethign like foreach(ListViewItem item in listbox1.SelectedItems) is there something like that for a listbox where I can go through each selected item and process and unselect and again go through the next one.
Please help.
I appreciate your help in advance.
sasa
|
|
|
|
|
Hi,
look at the properties SelectedItems, and dont forget to set SelectionMode.
|
|
|
|
|
I have done this, this is not my question.
sasa
|
|
|
|
|
Please clarify the problem, show the code you have, and tell us what exactly
is going wrong.
|
|
|
|
|
Hi Luc,
thanks for your response. All that I am trying to do is load one listview and move data from one listview to another. But when I move the data, I don't want to remove it from the first listview. To avoid duplicates int he second listview in case the user moves it once and tries again, I want to check to make sure there are no duplicates.
So, when moving from one listview to another I want to first check if it exists in the second and if not then only move.
Please advice.
sasa
|
|
|
|
|
Hi,
so you want to copy, not move.
Here is what I would try (assuming the items are just strings, if not modify where
appropriate):
ListView lvw1=new ListView();
ListView lvw2=new ListView();
...
foreach (string s1 in lvw1.SelectedItems) {
bool found=false;
foreach (string s2 in lvw2.Items) {
if (s1==s2) {
found=true;
break;
}
}
if (!found) lvw2.Items.Add(s1);
}
|
|
|
|