用visual studio 2008写了个起动eclipse的程序,eclipse无法弹出选择工作空间的对话框

用visual studio 2008写了个启动eclipse的程序,eclipse无法弹出选择工作空间的对话框

我用visual studio 2008写了个启动eclipse的程序(eclipse作为一个进程,然后另一个进程等待该进程退出,由于eclipse第一次启动的时候需要选择工作空间,若用我写的启动程序,eclipse只能出现启动界面,无法弹出选择工作空间的对话框,无法继续往下加载插件,如何能用这个启动程序的同时运行eclipse弹出选择工作空间的对话框?
我的启动程序只能达到如图一效果,图二中选择工作空间的对话框总是弹不出来。
图一
用visual studio 2008写了个起动eclipse的程序,eclipse无法弹出选择工作空间的对话框
图二
用visual studio 2008写了个起动eclipse的程序,eclipse无法弹出选择工作空间的对话框
贴代码,跪谢大神们。
// start-simclipse-xp.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#ifndef _AFXDLL
#define _AFXDLL
#endif

// #include <dirent.h>
// #include <unistd.h>


#pragma comment (lib,"Shlwapi.lib")

//#define _AFXDLL

const int str_len = 50000;
void delete_file();



int main(int argc, _TCHAR* argv[])
{
delete_file();
FreeConsole();
//定义结构
STARTUPINFO si;  //启动进程参数
ZeroMemory(&si, sizeof(si));  //此参数必须清零
si.cb = sizeof(STARTUPINFO);
si.lpReserved = NULL;
si.lpDesktop = NULL;
si.lpTitle = NULL;
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
si.lpReserved2 = NULL;

PROCESS_INFORMATION pi;  //进程信息结构
//LPSTR FileName = "./Simclipse.exe"; //全路径
TCHAR FileName[] = L".//Simclipse.exe";
//结构清零
// ZeroMemory(&pi,sizeof(pi));
//结束结构大小
// si.cb =sizeof(si);   //结构字节数,in byte

//创建进程
BOOL flag = CreateProcess(
NULL,
FileName,  //创建的进程,
NULL,
NULL,
TRUE,
/*CREATE_NO_WINDOW*/0,
NULL,
NULL,
&si,
&pi);
if (flag == 0) {
printf("create fail,code is : %d", GetLastError());
return 0;
}
//等待 Simclipse.exe 运行完成。
//while(WaitForSingleObject(pi.hProcess,INFINITE)==WAIT_OBJECT_0) {
//    static int tmp = 0;
// tmp++;
// printf("tmp= %d\n", tmp);
//}
WaitForSingleObject(pi.hProcess, INFINITE);
printf("Simclipse.exe");
//关闭句柄
BOOL flag1 = CloseHandle(pi.hThread);
BOOL flag2 = CloseHandle(pi.hProcess);
delete_file();
return 0;
}
void delete_file() {
/ar PATH[str_len];
//sprintf_s(PATH, ".\\workspace\\.metadata\\.plugins\\org.eclipse.ui.workbench");
CFileFind tempFind;
WCHAR sTempFileFind[200]= L".//workspace//.metadata//.plugins//org.eclipse.ui.workbench";
WCHAR PATH[] = L".//workspace//.metadata//.plugins//org.eclipse.ui.workbench//*.*";
BOOL IsFinded = tempFind.FindFile(PATH);
while (IsFinded)
{
IsFinded = tempFind.FindNextFile();

if (!tempFind.IsDots())
{
CString sFoundFileName = tempFind.GetFileName();
// printf("1 %ls\n", sFoundFileName);
//strcpy(sFoundFileName, tempFind.GetFileName().GetBuffer(200));
CStringW FoundFileName = CT2CW(sFoundFileName);
WCHAR *sTempFileName = FoundFileName.GetBuffer(200);
char path[200];
WideCharToMultiByte(CP_ACP, 0, sTempFileFind, -1,
path, sizeof(path), NULL, NULL);
// printf("2 %s\n", path);
char filename[200];
WideCharToMultiByte(CP_ACP, 0, sFoundFileName, -1,
filename, sizeof(filename), NULL, NULL);
// printf("3 %s\n", filename);
char toDelFileName[200];
sprintf_s(toDelFileName, "%s//%s", path, filename);
// printf("4 %s\n", toDelFileName);
WCHAR *ToDelFileName = (wchar_t *)malloc(sizeof(wchar_t)* 200);
MultiByteToWideChar(CP_ACP, 0, toDelFileName,
strlen(toDelFileName) + 1, ToDelFileName, (sizeof(wchar_t)* 200) / sizeof(ToDelFileName[0]));
// printf("5 %ls\n", ToDelFileName);
DeleteFile(ToDelFileName);
free(ToDelFileName);

}
}
tempFind.Close();
//if (!RemoveDirectory(PATH))
//{
//return FALSE;
//}
//return TRUE;
/ar PATH[str_len];
//WCHAR PATH[] = L".//workspace//.metadata//.plugins//org.eclipse.ui.workbench";
//WCHAR PATH[] = L"D://softwareforjob//SimClipse2014-4-3//simclipse//simclipse//workspace//.metadata//.plugins//org.eclipse.ui.workbench";
//sprintf(PATH, ".\\workspace\\.metadata\\.plugins\\org.eclipse.ui.workbench");
//SHFILEOPSTRUCT FileOp; 
//ZeroMemory((void*)&FileOp,sizeof(SHFILEOPSTRUCT));

    //FileOp.fFlags = FOF_NOCONFIRMATION; 
//FileOp.hNameMappings = NULL; 
//FileOp.hwnd = NULL; 
//FileOp.lpszProgressTitle = NULL; 
//FileOp.pFrom = PATH;
//FileOp.pTo = NULL; 
//FileOp.wFunc = FO_DELETE; 
//SHFileOperation(&FileOp);
//printf("%ls\n", FileOp.pFrom);

/ar path_tmp[str_len];

//DIR * dir;
//struct dirent * ptr;
//dir = opendir(PATH);
//while ((ptr = readdir(dir)) != NULL){