Results 1 to 2 of 2

Thread: Shell VB App From C++ Code

  1. #1

    Thread Starter
    Hyperactive Member TupacShakur's Avatar
    Join Date
    Mar 2002
    Location
    Da Land Of Da Heartless...
    Posts
    493

    Shell VB App From C++ Code

    Hello,
    I have an open source C++ command line tool of which I'm trying to manipulate the source code to modify its functionality for my personal use.
    I have very limited knowledge of C++, and I need some help on how to synchronously shell another program (a VB app for that matter) with the initial argument line that was passed to the original C++ tool. The arguments parts is as troublesome as the "shelling" part because I'm not sure how to rebuild the arg. line from the argv[] array.
    "And Now I'm Lika Major Threat, Cause I Remind U Of The Things U Were Made To Forget!" - (2PAC)

    "Now They Label Me a Lunatic, Couldn't Care Less, Death or Success is What I Quest, Cause I'm Fearless!" - (2PAC)

    " There's a light at the end of every tunnel, just pray it's not a train!! "



    I am 100% addicted to Tupac. What about you?
    I am 24% addicted to Counterstrike. What about you?
    The #1 Tupac Fans Web Site | The Official Tupac Web Site

  2. #2
    New Member AkariAkaori's Avatar
    Join Date
    Jul 2013
    Posts
    1

    Re: Shell VB App From C++ Code

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <string>
    
    int main(int argc, char **argv)
    {
    	FILE *proc;
    	std::string command = "vbapp.exe";
    	
    	for(int i=1;i<argc;i++)
    	{
    		command += " " + argv[i];
    	}
    	
    	if (proc = _popen(command.c_str(), "rt"))
    	{
    		while(fgetc(proc) != EOF);
    		
    		if (feof(proc))
    		{
    			return _pclose(proc);
    		}
    		else
    		{
    			return 1;
    		}
    	}
    	else
    	{
    		return 1;
    	}
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width