If one was to make a dialog editor for Dev-C++, it would probably need to call Dev-C++ and gcc from within the code. What functions, etc., do you need to open executables in code? I've got a hunch OLE has something to do with this, but I'm not sure how to implement it in a project. I would appreciate any help. Thanks!
GZ
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
why would a dialog editor call Dev-C++ and gcc? Dev-C++ should call the editor and gcc
anyway, there are several functions that you can use to call a program, in increasing order of difficulty:
system, WinExec, ShellExecute and CreateProcess (possibly others too)
note that WinExec is deprecated but still supported for compatibility with older software
> how do you implement it?
implement what?
> Are there any parameters or returns or anything like that?
yes, and that's what documentation is for
Adrian
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Adrian, I was thinking of something along the lines of VB that would call gcc to compile C++ code. I checked out MSDN, but they didn't seem to have any information on parameters to system(). Could someone give me some information on system()? I know it can take "pause" as a parameter to solve the dread flashing window problem, but I haven't heard of any other values to be passed to it. Thanks!
GZ
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I compiled and ran this on my Windows XP Pro system using Dev-C++ 4.9.8.5.
Basically, you use "system(<command>)" from C/C++ to execute an operating system command. I don't know if there's a corresponding command in VB but if there is, then you can build your command string and then call the system command with that string and the system will try to execute the string.
So, the first thing you need to do is check VB to see if it has some sort of system call. Then figure out how you're going to build your command string so that it does what you want it to.
HTH.
Watson (the pencil neck) Davis
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
> Adrian, I was thinking of something along the lines of VB that would call gcc to compile C++ code.
oh, you want to write a new IDE to replace Dev-C++, not only a dialog editor? then it makes sense
but then you would also need to get the compiler's output messages (the compile log) back to the program; you can do that using a redirection to file, or (more smartly but more difficult) using pipes
I think there's a function called popen that can save you from setting up the pipes and stuff, you might want to check it out (but I'm not sure how flexible it is)
> I checked out MSDN, but they didn't seem to have any information on parameters to system().
> Could someone give me some information on system()? I know it can take "pause" as a parameter to solve the dread flashing window problem, but I haven't heard of any other values to be passed to it.
well, I think the best explanation is that you can do system("c:\\dev-cpp\\bin\\gcc.exe") (assuming it is installed there)
Adrian
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If one was to make a dialog editor for Dev-C++, it would probably need to call Dev-C++ and gcc from within the code. What functions, etc., do you need to open executables in code? I've got a hunch OLE has something to do with this, but I'm not sure how to implement it in a project. I would appreciate any help. Thanks!
GZ
ShellExecute would work just fine.
JMan
Thanks, JMan, but how do you implement it? Are there any parameters or returns or anything like that?
You can also try
WinExec(command, SW_SHOW);
for command the program name : "devcpp.exe" or whatever you want to start. you need to include windows.h for this.
why would a dialog editor call Dev-C++ and gcc? Dev-C++ should call the editor and gcc
anyway, there are several functions that you can use to call a program, in increasing order of difficulty:
system, WinExec, ShellExecute and CreateProcess (possibly others too)
note that WinExec is deprecated but still supported for compatibility with older software
> how do you implement it?
implement what?
> Are there any parameters or returns or anything like that?
yes, and that's what documentation is for
Adrian
Thanks, Adrian. I'll take a look at MSDN and see if I can't scrounge up some information on those functions you mention.
Adrian, I was thinking of something along the lines of VB that would call gcc to compile C++ code. I checked out MSDN, but they didn't seem to have any information on parameters to system(). Could someone give me some information on system()? I know it can take "pause" as a parameter to solve the dread flashing window problem, but I haven't heard of any other values to be passed to it. Thanks!
GZ
Check this out:
#include <cstdlib>
main()
{
system("dir");
system("pause");
}
========================
I compiled and ran this on my Windows XP Pro system using Dev-C++ 4.9.8.5.
Basically, you use "system(<command>)" from C/C++ to execute an operating system command. I don't know if there's a corresponding command in VB but if there is, then you can build your command string and then call the system command with that string and the system will try to execute the string.
So, the first thing you need to do is check VB to see if it has some sort of system call. Then figure out how you're going to build your command string so that it does what you want it to.
HTH.
Watson (the pencil neck) Davis
Thanks, Watson (the pencil neck) Davis! I get it now. The system() function takes the command string and acts on it like DOS would.
GZ
> Adrian, I was thinking of something along the lines of VB that would call gcc to compile C++ code.
oh, you want to write a new IDE to replace Dev-C++, not only a dialog editor? then it makes sense
but then you would also need to get the compiler's output messages (the compile log) back to the program; you can do that using a redirection to file, or (more smartly but more difficult) using pipes
I think there's a function called popen that can save you from setting up the pipes and stuff, you might want to check it out (but I'm not sure how flexible it is)
> I checked out MSDN, but they didn't seem to have any information on parameters to system().
they have: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_system.2c_._wsystem.asp
> Could someone give me some information on system()? I know it can take "pause" as a parameter to solve the dread flashing window problem, but I haven't heard of any other values to be passed to it.
well, I think the best explanation is that you can do system("c:\\dev-cpp\\bin\\gcc.exe") (assuming it is installed there)
Adrian
Thanks, Adrian. I get it now. I'll look into the pipe thing you mentioned.
GZ