get window handle of system()?

This is a discussion on get window handle of system()? within the Linux Programming forums, part of the Platform Specific Boards category; I'm sorry if this is a stupid question; I am attempting to get the window handle of a program that's ...

  1. #1
    Registered User
    Join Date
    May 2012
    Posts
    8

    get window handle of system()?

    I'm sorry if this is a stupid question; I am attempting to get the window handle of a program that's executed using the system() command, i.e. something like:

    Code:
    int pid = fork();
    if (fork == 0) {
        system("program name")
    } else {
        ...
    }

    Is this possible? would it be possible to do so if I used one of the exec() functions instead?

    Thanks! (using Kubuntu 12 btw)



    EDIT: ehh..I think it might be better to ask this on linuxforums, now that I think about it...
    Last edited by dsab123; 06-28-2012 at 05:05 PM.

  2. #2
    Registered User
    Join Date
    May 2012
    Posts
    8
    For anyone else who has/had this problem, you can't do it with system(), because in system(3): execute shell command - Linux man page, the program is run in the shell, which (I think) makes it impossible to get the window handle, or ID

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,112
    Moved to Linux Programming forum.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How get system window handle ?
    By theclem35 in forum C Programming
    Replies: 15
    Last Post: 06-19-2011, 09:04 AM
  2. Getting window handle from HDC
    By maxorator in forum Windows Programming
    Replies: 2
    Last Post: 01-02-2007, 03:07 PM
  3. PID from window handle.
    By Brian in forum Windows Programming
    Replies: 0
    Last Post: 11-23-2004, 07:42 AM
  4. Max Window By Handle
    By DeepBlackMagic in forum Windows Programming
    Replies: 1
    Last Post: 08-29-2003, 07:05 PM
  5. Retrieving the window handle of a window a control resides in
    By -leech- in forum Windows Programming
    Replies: 7
    Last Post: 08-09-2003, 09:55 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21