怎么才能在MFC中直接调用winapi函数呢?
还有为什么我在mfc中导入了自己的类以后,我再打一些函数时,本来自动出现的提示就不见了呢(就是本来写在黄色的方框李德和一些类的成员)

解决方案 »

  1.   

    在函数前加::就可以直接当API用
    如 ::MessageBox(...);在windows的资源管理器里工程的.ncb删除,然后再rebulid all
    提示又会出现
      

  2.   

    关于第2点,vc经常要出问题,学习shilong1。举个例子//////////////////////CreateProcess()/////////////////////////////////
    CString str;
    STARTUPINFO si;
    PROCESS_INFORMATION pi; // 调用的应用程序名
    str = "JH_Ping";    //"JH_Ping.exe" // zero out and initialize STARTUPINFO
    memset( &si, 0, sizeof( si ) );
    si.cb = sizeof( si );
    si.dwFlags = STARTF_USESHOWWINDOW;
    si.wShowWindow = SW_SHOW;
    if(CreateProcess(
    NULL, // can be name of process unless
    // batch file, else must be
    // in command line:
    (char*)LPCSTR(str), // command line
    NULL,NULL, // security options
    FALSE, // if true will inherit all
    // inheritable handles
    // from this process
    NORMAL_PRIORITY_CLASS, // can also be HIGH_PRIORITY_CLASS
    // or IDLE_PRIORITY_CLASS
    NULL, // inherit this process's
    // environment block
    NULL, // specifies working directory
    // of created process
    &si, // STA RTUPINFO specified above
    &pi // PROCESS_INFORMATION returned
    )
    )
    {
    // HANDLE pH = pi.hProcess;
    // // wait until application is ready for input
    // if ( !WaitForInputIdle( pH,1000 ) )
    // {
    // // send messages, etc.
    // }
    // kill process with 0 exit code
    // TerminateProcess( pH, 0 );
      }
    else
    {
    AfxMessageBox( "JH_Ping.exe 文件当前目录不存在!" );
    }