Thread: calling an external program from within a windows GUI

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    54

    Question calling an external program from within a windows GUI

    okay heres the scenario, i have a mdi GUI and a GLUT visualisation image

    heres my problem, GLUT dont work with winMain so i have 3 solutions to my problem

    1. Rewrite GLUT into openGL or somehow get GLUT to work with winMain : Time scale may not permit this.
    (have only 2 weeks)

    2. Rewrite GUI into something GLUT understands : Forget that, definately dont have time for that

    3. Call GLUT visualisation as an external program : This i think is my best choice and I am wondering how i would accomplish this, if at all it is possible

    if anyone can offer help on these it would be much appreciated

    thanx in advance

    korbitz

  2. #2
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    New York
    Posts
    1,905
    well, i haven't worked much with GLUT, but I think that there is a way to integrate it with winmain, someone else here who has a bit more experience with that might be able to help. Otherwise, I've got some sample code that I've used before to start a separate process and it works pretty nicely:

    (taken directly from some of my OpenScript2.0 code, with some modifications so it's a bit more readable)
    Code:
    STARTUPINFO startInfo;
    PROCESS_INFORMATION procInfo;
    
    ZeroMemory(&procInfo,sizeof(PROCESS_INFORMATION));
    ZeroMemory(&startInfo,sizeof(STARTUPINFO));
    
    char Buff[2048]="C:\somePath\myprocess.exe";
    CreateProcess(NULL, Buff, NULL, NULL, NULL, NULL, NULL, NULL, &startInfo, &procInfo);
    -edit-
    note: the two structures that i used there have to be used, i tried using it with just the buffer, but it crashed when i didn't have those pointers in there

    This will create and run the process, and then immediately return from the function (so you can have it run independantly of your program, kind of like a thread, but actually a separate process)

    also, there's some msdn info on this function if you want to know what goes in for all of those NULLs if you want to actually use 'em

    *quick msdn search....*

    *found*

    http://msdn.microsoft.com/library/de...ateprocess.asp

    that's got all the info, the code I gave you is just the bare minimum to get a process running and seems to work pretty nicely.

    I'm not sure exactly what your program works like, so I don't know if you'll be able to use this code or not, but it's here for your reference and hopefully someone'll get something out of it

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Calling external program and reading its output.
    By Dragoon_42 in forum C++ Programming
    Replies: 3
    Last Post: 10-18-2007, 05:34 AM
  2. Problem with for loop calling external function
    By lordbubonicus in forum C Programming
    Replies: 2
    Last Post: 10-13-2007, 10:54 AM
  3. How many ways to program a Windows GUI?
    By thetinman in forum Windows Programming
    Replies: 12
    Last Post: 11-29-2006, 09:43 AM
  4. forcing stdout of external program to be line-buffered
    By FreakCERS in forum C Programming
    Replies: 4
    Last Post: 09-17-2006, 12:46 PM
  5. Replies: 1
    Last Post: 10-13-2004, 12:15 PM