| | |
 | Gut zu wissen: Hilfreiche Tipps und Tricks aus der Praxis prägnant, und auf den Punkt gebracht für SOLIDWORKS |
| | |
 | What’s New SWOOD 2026: Alle Neuerungen im Überblick, ein Webinar am 16.06.2026
|
|
Autor
|
Thema: CopyDocument() by C++ (626 mal gelesen)
|
ZsZs Mitglied
 Beiträge: 6 Registriert: 03.09.2007
|
erstellt am: 10. Sep. 2007 12:24 <-- editieren / zitieren --> Unities abgeben:         
Hello, I like to use the CopyDocument() function in VC++ 6.0 The SW API help contain a full example. (But it is buggy...) I modified: int CopyDoc(ISldWorks* swApp) { long Err = -1; BSTR src, dst, chld_src[6], chld_dst[6]; src = SysAllocString(L"C:\\Work\\Test\\DLC000_001\\DLC000_001.SLDASM"); dst = SysAllocString(L"C:\\Work\\Test\\DLC000_002\\DLC000_002.SLDASM"); chld_src[0] = SysAllocString(L"C:\\Work\\Test\\DLC000_001\\Dc00_DLC000_1_001.SLDASM"); chld_src[1] = SysAllocString(L"C:\\Work\\Test\\DLC000_001\\Dc0001_Dc00_DLC000_1_001.SLDPRT"); chld_src[2] = SysAllocString(L"C:\\Work\\Test\\DLC000_001\\Dc0002_Dc00_DLC000_1_001.SLDPRT"); chld_src[3] = SysAllocString(L"C:\\Work\\Test\\DLC000_001\\Dc0003_Dc00_DLC000_1_001.SLDPRT"); chld_src[4] = SysAllocString(L"C:\\Work\\Test\\DLC000_001\\Dc0003_Dc00_DLC000_2_001.SLDPRT"); chld_src[5] = SysAllocString(L"C:\\Work\\Test\\DLC000_001\\modul_DLC000_001.SLDPRT"); chld_dst[0] = SysAllocString(L"C:\\Work\\Test\\DLC000_002\\Dc00_DLC000_1_002.SLDASM"); chld_dst[1] = SysAllocString(L"C:\\Work\\Test\\DLC000_002\\Dc0001_Dc00_DLC000_1_002.SLDPRT"); chld_dst[2] = SysAllocString(L"C:\\Work\\Test\\DLC000_002\\Dc0002_Dc00_DLC000_1_002.SLDPRT"); chld_dst[3] = SysAllocString(L"C:\\Work\\Test\\DLC000_002\\Dc0003_Dc00_DLC000_1_002.SLDPRT"); chld_dst[4] = SysAllocString(L"C:\\Work\\Test\\DLC000_002\\Dc0003_Dc00_DLC000_2_002.SLDPRT"); chld_dst[5] = SysAllocString(L"C:\\Work\\Test\\DLC000_002\\modul_DLC000_002.SLDPRT"); swApp->ICopyDocument(src, dst, 6, chld_src, chld_dst, swMoveCopyOptionsOverwriteExistingDocs + swMoveCopyOptionsCreateNewFolder, &Err); return Err; } This is not working... I get an error code: 2 ("Failed to create destination directories or copy operation failed possibly because you do not have proper permissions") Why? Have a idea anybody? Thanks! ZsZs. Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP |
G. Dawg Ehrenmitglied V.I.P. h.c. Teamleiter FEM Simulation

 Beiträge: 2622 Registriert: 12.07.2004 SolidWorks_2o2o SP3.o Win10_x64, Quadro_P2ooo. VisualStudio_2o19_Pro. FEM: Forge_NxT_HPC, ANSYS_WB. 3D-Printer: Ultimaker_2, Tinker_Gnome.
|
erstellt am: 10. Sep. 2007 13:47 <-- editieren / zitieren --> Unities abgeben:          Nur für ZsZs
|
ZsZs Mitglied
 Beiträge: 6 Registriert: 03.09.2007
|
erstellt am: 10. Sep. 2007 14:12 <-- editieren / zitieren --> Unities abgeben:         
|
G. Dawg Ehrenmitglied V.I.P. h.c. Teamleiter FEM Simulation

 Beiträge: 2622 Registriert: 12.07.2004 SolidWorks_2o2o SP3.o Win10_x64, Quadro_P2ooo. VisualStudio_2o19_Pro. FEM: Forge_NxT_HPC, ANSYS_WB. 3D-Printer: Ultimaker_2, Tinker_Gnome.
|
erstellt am: 10. Sep. 2007 14:21 <-- editieren / zitieren --> Unities abgeben:          Nur für ZsZs
|
mkkk Mitglied
 
 Beiträge: 105 Registriert: 04.03.2005
|
erstellt am: 10. Sep. 2007 14:49 <-- editieren / zitieren --> Unities abgeben:          Nur für ZsZs
|
ZsZs Mitglied
 Beiträge: 6 Registriert: 03.09.2007
|
erstellt am: 11. Sep. 2007 10:13 <-- editieren / zitieren --> Unities abgeben:         
Thanks Everybody! The opened file was seemed as though a good idea... but no... Don't working the CopyDocument() function, but I workaround and I use the XCopy.exe system program for the all files. Is is working in the same way as CopyDocument() SW function. I'm sorry, but I came to realize that this function not solve my problem. (Pack and Go from API function) It is seem very difficult. I find the external references. I able to change the references with the ReplaceReferencedDocument() function, but it is not enough: the mates and equations are referenced the files... This is the end... I haven't any idea how change the referenced mates and equations... ZsZs. Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP |
mkkk Mitglied
 
 Beiträge: 105 Registriert: 04.03.2005
|
erstellt am: 11. Sep. 2007 10:25 <-- editieren / zitieren --> Unities abgeben:          Nur für ZsZs
|