thx

解决方案 »

  1.   

    ::Winexec("regsvr32 /s my.ocx");
    and 
    system("regsvr32 /s my.ocx");
    cann't works.
      

  2.   

    在程序中,你可以使用
    UINT WinExec(
      LPCSTR lpCmdLine,  // command line
      UINT uCmdShow      // window style
    );
    来调用其他应用程序和命令,例如:
    WinExec("regsvr32 your_ocx_name.ocx",SW_SHOW);
      

  3.   

    register:  regsvr32 *.ocx
    unregister:regsvr32 /u *.ocx
      

  4.   

    BOOL CSecuryEntryDlg::RegDllControl(LPCTSTR pszDllName)
    {
    HINSTANCE hLib = LoadLibrary(pszDllName);
        if (hLib <(HINSTANCE)HINSTANCE_ERROR)
        {
    AfxMessageBox(_T("dll file can't be import!"),MB_OK,NULL);
    return 0;
    }
        //get DllRegisterServer address
        FARPROC lpDllEntryPoint; 
        lpDllEntryPoint = GetProcAddress(hLib,_T("DllRegisterServer"));
        //DllRegisterServer
        if(lpDllEntryPoint!=NULL)
        {
             if(FAILED((*lpDllEntryPoint)()))
             {
                  AfxMessageBox(_T("DllRegisterServer Failed!"),MB_OK,NULL);
                  FreeLibrary(hLib);
      return 0;
             }    }
        else
        AfxMessageBox(_T("DllRegisterServer Failed!"),MB_OK,NULL);
    return 1;
    }BOOL CSecuryEntryDlg::UnRegDllControl(LPCTSTR pszDllName)
    {
    HINSTANCE hLib = LoadLibrary(pszDllName);
        if (hLib <(HINSTANCE)HINSTANCE_ERROR)
        {
    AfxMessageBox(_T("dll file can't be import!"),MB_OK,NULL);
    return 0;
    }
        //get DllUnregisterServer address
        FARPROC lpDllEntryPoint; 
        lpDllEntryPoint = GetProcAddress(hLib,_T("DllUnregisterServer"));
        //DllUnregisterServer
        if(lpDllEntryPoint!=NULL)
        {
             if(FAILED((*lpDllEntryPoint)()))
             {
                  AfxMessageBox(_T("DllUnregisterServer Failed!"),MB_OK,NULL);
                  FreeLibrary(hLib);
      return 0;
             }    }
        else
        AfxMessageBox(_T("DllUnregisterServer Failed!"),MB_OK,NULL);
    return 1;
    }
      

  5.   

    studentforever,I have tried it,it has successed in my computer,but not in others.
      

  6.   

    kingzai,I think it just for register a dll Server.
    look prompt:
    teadfaDlg.obj : error LNK2001: unresolved external symbol "public: virtual struct CRuntimeClass * __thiscall C_GifAni::GetRuntimeClass(void)const " (?GetRuntimeClass@C_GifAni@@UBEPAUCRuntimeClass@@XZ)
    Debug/teadfa.exe : fatal error LNK1120: 1 unresolved externals
      

  7.   

    My Invoke is :
       RegDllControl("pGif.ocx");//i have put pGif.ocx in program current directory.