我写一个程序A,用CreateProcess()打开记事本程序,我想获取记事本的edit的句柄,请问这怎么办? 谢谢若将记事本换成诸如UltraEdit等的Richedit,那又怎么办?
谢谢

解决方案 »

  1.   

    你可以参考这里的方式试试看是不是有效
    http://www.vccode.com/file_show.php?id=308
      

  2.   

    CreateProcess是用于调用EXE程序,具体的做法是:CreateProcess( 
    LPCWSTR lpszImageName, 
    LPCWSTR lpszCmdLine, 
    LPSECURITY_ATTRIBUTES lpsaProcess, 
    LPSECURITY_ATTRIBUTES lpsaThread, 
    BOOL fInheritHandles, 
    DWORD fdwCreate, 
    LPVOID lpvEnvironment, 
    LPWSTR lpszCurDir, 
    LPSTARTUPINFOW lpsiStartInfo, 
    LPPROCESS_INFORMATION lppiProcInfo); 
    CloseHandle(lppiProcInfo->hProcess);
    CloseHandle(lppiProcInfo->hThread);但CreateProcess和ShellExcute不同,它只能调用进程文件,而不能打开文件.CHM文件的格式我不是很清楚,假如它确实属于可执行文件的话是可以这样调用的.
      

  3.   

    将you.exe改为你的程序名字就可以了。
    #include "Windows.h"
    void main()
    {
        STARTUPINFO si;
        PROCESS_INFORMATION pi;    ZeroMemory( &si, sizeof(si) );
        si.cb = sizeof(si);
        ZeroMemory( &pi, sizeof(pi) );    // Start the child process. 
        if( !CreateProcess( NULL, // No module name (use command line). 
            "C:\\Program Files\\you.exe", // Command line. 
            NULL,             // Process handle not inheritable. 
            NULL,             // Thread handle not inheritable. 
            FALSE,            // Set handle inheritance to FALSE. 
            0,                // No creation flags. 
            NULL,             // Use parent's environment block. 
            NULL,             // Use parent's starting directory. 
            &si,              // Pointer to STARTUPINFO structure.
            &pi )             // Pointer to PROCESS_INFORMATION structure.
        ) 
        {
            //ErrorExit( "CreateProcess failed." );
        }    // Wait until child process exits.
        WaitForSingleObject( pi.hProcess, INFINITE );    // Close process and thread handles. 
        CloseHandle( pi.hProcess );
        CloseHandle( pi.hThread );
    }
      

  4.   

    哈哈,你用SPY+观察一下,用手动的方法找规律,再实现程序
      

  5.   

    各位大哥,我得目的是如何获取取记事本的edit的句柄若将记事本换成诸如UltraEdit等的Richedit,那又怎么办?请指教
      

  6.   

    记事本的edit指它的文本编辑区域吗