// CCRC 是 IBM Rational ClearCase Remote Client 的缩写

// 编译选项:
// cl ccrc_cleardiffmrg.cpp /link user32.lib

// 使用方法:
// 复制ccrc_cleardiffmrg.exe到下面的目录(注意先备份以前的):
// D:\Program Files\CCRC7.1\CCRC\plugins\com.ibm.rational.clearcase.compare_merge.win32.x86_7.0.1.D061004

#include <stdio.h>
#include <string.h>
#include <windows.h>

int main(int argc,char* argv[])
{
    /*
    记录CCRC传递给ccrc_cleardiffmrg.exe的参数:
    -----------------------------------------
    FILE *f=fopen("ccrc.txt","w+");

    int i=0;
    for(;i<argc;i++)
    {
        fwrite(argv[i],strlen(argv[i]),1,f);
        fwrite("\n",strlen("\n"),1,f);
    }

    fclose(f);

    D:/Program Files/CCRC7.1/CCRC/plugins/com.ibm.rational.clearcase.compare_merge.win32.x86_7.0.1.D061004/ccrc_cleardiffmrg.exe
    -fname
    test.py@@/main/xxxx/7
    -fname
    test.py@@/main/xxxx/8
    test.py.compare.0
    test.py
    */

    char szCmdLine[1024];
    sprintf(szCmdLine,"\"D:\\Program Files\\WinMerge\\WinMergeU.exe\" \"%s\" \"%s\"",argv[argc-1],argv[argc-2]);

    STARTUPINFO si;
    ZeroMemory( &si, sizeof(si) );
    si.cb = sizeof(si);
   
    PROCESS_INFORMATION pi;
    ZeroMemory( &pi, sizeof(pi) );

    if( !CreateProcess(NULL,szCmdLine,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi ))
    {
        MessageBox( 0,"Create WinMergeU.exe Process failed.","Error",MB_ICONWARNING );
        return -1;
    }

    WaitForSingleObject( pi.hProcess, INFINITE );

    CloseHandle( pi.hProcess );
    CloseHandle( pi.hThread );

    return 0;
}

 


本文链接地址: 替换CCRC的对比工具为WinMerge
http://qingfengju.com/index.asp?id=354

分类:Win32/C++ 查看次数:4053 发布时间:2013-10-28 21:27:06