472,811 Members | 1,615 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,811 software developers and data experts.

How to send a key event to another process?

Hello,
I'm working on a C program under Ubuntu.
It's basd on socket.
Browser calls a client cgi (C program), and send some parameters to
server (C program).
Server runs another program (ooimpress, open office ppt), and
translate the commands from client to a key event, and send it to
child process.

For example.
first, after openning xxx.odp on server, I need to display it in "full
screen mode", so I need to send "F5" from server program to child
process "ooimpress".

Now, I need to send F5, ESC, char n, and char p. and
I open the child process by using pipe (popen), and I send (fputc) the
command key to the pipe.......

But I cannot get the correct result......The ppt doesn't respond
anything......
My question is,
1, if I can implement this under pipe, how should I do,
2, if I cannot implement this under pipe, how should I do.

My main goal is open ooimpress, and control it to show next, previous
slide, esc, and full screen (F5 is hotkey for that).

Thanks a lot!!

Patrick
May 31 '08 #1
5 4884
Mi****@gmail.com writes:
I'm working on a C program under Ubuntu.
It's basd on socket.
Browser calls a client cgi (C program), and send some parameters to
server (C program).
Server runs another program (ooimpress, open office ppt), and
translate the commands from client to a key event, and send it to
child process.
[snip]

There's no way to do this in standard C. Try comp.unix.programmer, or
perhaps a Linux or Ubuntu forum.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
May 31 '08 #2
Mi****@gmail.com wrote:
I'm working on a C program under Ubuntu.
It's basd on socket.
Sorry, but you will be in for a bad surprise, sockets (and
networking at all) aren't part of the C language, they are
deal with (often system specific libraries).
Browser calls a client cgi (C program), and send some parameters to
server (C program).
Hmm, a browser doesn't call a "client cgi". A browser may
send a request to a HTTP server which, in turn, may invoke
a CGI script/program (written in whatever language, but you
will find that it's rarely C).
Server runs another program (ooimpress, open office ppt), and
translate the commands from client to a key event, and send it to
child process.
Why should the HTTP server run such a program? Many servers
may run all day without even screen attached, so running one
of those programs will be rather futile.
For example.
first, after openning xxx.odp on server, I need to display it in "full
screen mode", so I need to send "F5" from server program to child
process "ooimpress".
Sorry, but I guess you've got a lot of things mixed up here.
Now, I need to send F5, ESC, char n, and char p. and
I open the child process by using pipe (popen), and I send (fputc) the
command key to the pipe.......
Now you seem to be talking about two processes on a UNIX-
like platform. That doesn't fit too well with the browser
(client) and HTTP server things you wrote about before.
Just note that pipes and the popen() function are POSIX
terms, they have no real meaning when it comes to the
language C.
But I cannot get the correct result......The ppt doesn't respond
anything......
I guess you're trying something with certain programs that
are installed on your machine. But from a language point of
view C doesn't support networking by any built-in functions,
it doesn't have a native popen() function (or anything for
pipes) and definitely doesn't have any special built-in support
for dealing with program like "ooimpress" or "open office".
My question is,
1, if I can implement this under pipe, how should I do,
2, if I cannot implement this under pipe, how should I do.
My main goal is open ooimpress, and control it to show next, previous
slide, esc, and full screen (F5 is hotkey for that).
I find it difficult to come up with proposals where you should
ask since you mix too many unrelated things into a single
question. So a few tentative suggestions: if you have problems
with pipes and popen() ask in comp.unix.programmer, that's where
the experts for these functions can be found. Regarding control-
ling some kind of parts from the open office suite from another
program I am a bit at a loss, but there should be quite a number
of mailing lists, web forums etc. that are suitable for these
kind of questions (but I can't tell you were they are since I
never had to have to deal with that). And about the browser/HTTP
stuff you started of with I can only recommend to relax, take a
good look at what exactly you are trying to do and formulate it
in a somewhat more clear language that takes into account how
browsers and HTTP servers interact and what is happening on
both sides. Perhaps the first step you should take is to write
a clear description of what you intend to do, not already in-
sisting of the ways to do it. That may clear up the way to a
workable solution a lot. Write down what you want to, not mixing
it up with how to do it, and you may come up with a question that
can be answered (although not completely or even in parts here
in clc).

Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
May 31 '08 #3
Hi guys, thanks a lot for all your replies.

Seems I need to move my question to unix group :)

Thanks again for the hearty reply.

Good Luck~~

Patrick
May 31 '08 #4
Mi****@gmail.com writes:
I'm working on a C program under Ubuntu.
It's basd on socket.
Browser calls a client cgi (C program), and send some parameters to
server (C program).
Server runs another program (ooimpress, open office ppt), and
translate the commands from client to a key event, and send it to
child process.
[snip]

There's no way to do this in standard C. Try comp.unix.programmer, or
perhaps a Linux or Ubuntu forum.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 27 '08 #5
Hi guys, thanks a lot for all your replies.

Seems I need to move my question to unix group :)

Thanks again for the hearty reply.

Good Luck~~

Patrick
Jun 27 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: jas | last post by:
I have a basic client/server socket situation setup....where the server accepts a connection and then waits for commands. On the client side, I create a socket, connect to the server...then I...
6
by: Usman | last post by:
Hi I have a window service written in C#. I have another application that requires a lengthy process to be performed like taking backup. How can I make this lengthy process be performed by...
13
by: Manuel Lopez | last post by:
I have a puzzling form timer problem that I didn't experience prior to Access 2003 (though I'm not sure access 2003 is to blame). Here's the situation: a computer has two access 2003 databases on...
6
by: Dan | last post by:
I've created a pocketpc app which has a startup form containing a listview. The form creates an object which in turn creates a System.Threading.Timer. It keeps track of the Timer state using a...
2
by: louise raisbeck | last post by:
hi, if i cause the onclick event to fire with an ImageButton I can send CommandArgument which I find really handy to grab some relevant value (which means i can reuse code for many buttons and...
3
by: WRH | last post by:
Hello I used the VS designer to set up Process code as follows... the problem is, although the process is executed, when it is shut down I never get the Exited event. .... private...
4
by: CLEAR-RCIC | last post by:
I want to send an email from our Intranet site to myself whenever an error happens. Our manager will not let us install SMTP on the web server. Is it possible to send email programatically...
2
by: Mesan | last post by:
Hello everyone, Thanks to many useful posts in this newsgroup and others, I've been able to come very close to something I've been wanting to do for a very long time. I've figured out how to...
6
by: Martin Priebe | last post by:
Hi, I need a possibility to fire an event in one process and react in another process. can anybody help me ? Martin
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.