www.pudn.com > javalauncher.zip > Launcher.cpp


/* 
This is an application that can be used to launch Java  
applications by just clicking on a exe file. 
 
You can rename launcher.exe to anything you want. 
*/ 
 
#define WIN32_LEAN_AND_MEAN 
#include  
#include  
#include  
#include  
#include  
 
void deletenewlines(char* buffer) 
{ 
  while(*buffer != '\0') 
  { 
    if (*buffer == '\n') 
    { 
      *buffer = '\0'; 
      return; 
    } 
    ++buffer; 
  } 
} 
 
void getExecutable(char *result, char* lpCmdLine) 
{ 
  const char* constCommandLine = ::GetCommandLine(); 
  char* commandLine = new char[strlen(constCommandLine)+1]; 
  strcpy(commandLine,constCommandLine); 
  
  // Remove lpCmdLine from back 
  int lastpos = strlen(commandLine)-strlen(lpCmdLine); 
  commandLine[lastpos] = '\0'; 
  lastpos--; 
  while(commandLine[lastpos]=='\"' || commandLine[lastpos]==' ') 
  { 
    commandLine[lastpos]='\0'; 
    lastpos--; 
  }   
  int firstpos = lastpos; 
  while(commandLine[firstpos] > 0 && commandLine[firstpos]!='\\'  
    && commandLine[firstpos]!=':' && commandLine[firstpos]!='/') 
    firstpos--; 
 
  strcpy(&result[0], &commandLine[firstpos+1]); 
  int resultlength = strlen(result); 
   
  bool containsdot = false; 
  for (int i=0; i