[MSCE C++]关于压缩文件命令

在C++代码中有个函数mdlSystem_compressDgnFile()可以压缩当前打开的文件。

我的需求是在后台代码中拿到一个dgnFile类型的对象,如何不在前台打开就调用压缩命令对其进行压缩呢?

Parents Reply Children
  • 实践证明,这个方式可以实现,只是目前无法获取用户本身的压缩设置,以便在通过Keyin改变压缩设置进行压缩后,再恢复到原来的用户压缩设置。

  • 可以用如下代码获取当前Compress Options的值。

    /*--------------------------------------------------------
    | getCompressOptions
    +-------------------------------------------------------*/
    #define RTYPE_CompOptPrefs          RTYPE( 'C','m','p','O' )
    typedef struct coPrefs
    {
    	UInt32  reserved1;
    	UInt32  reserved2;
    	WChar   cmdString[512];
    } COPrefs;
    void getCompressOptions()
    {
    	COPrefs* pPrefsRsc = nullptr;
    	RscFileHandle   userPrefsH;
    	mdlDialog_userPrefFileOpen(&userPrefsH, false);
    	if (NULL != (pPrefsRsc = (COPrefs*)mdlResource_load(userPrefsH, RTYPE_CompOptPrefs, 1)))
    	{
    		mdlDialog_dmsgsPrint(pPrefsRsc->cmdString);
    	}
    	mdlResource_closeFile(userPrefsH);
    }