Lỗi cad fatal error unhandled access violation reading 0x00004 năm 2024
Here I have added some bugs in AutoCAD I have run into and when possible a workaround for it as well.
There is a bug in AutoCAD 2002 (fixed in AutoCAD 2004) that don't let you save changes to the registry by code. According to an Autodesk developer: "Looking at the code, we only save these settings via the Options dialog, closing down AutoCAD, or when we close all documents and enter a "zero-doc" state." You will notice the problem by using any API command (Visual LISP or VBA) that should save the settings to the registry profile. This workaround solves the problem. Run this code below before exporting a profile or setting it current or something like that by code, otherwise many setting will not be saved.
But the above code will not work within one Lisp/VBA session since Options command can't be called transparently. The external code has to end with calling the rest of the internal code. Below is an example how to do it from within VBA code: Public Sub subExportProfile() End Sub
Public Sub subImportProfile() "r:\TestProfile.arg" "r:\TestProfile.arg", True End SubSave the following code to a vbs file named OpenAndCloseOptions.vbs or you can make an exe-file in VB of it. ' Start from AutoCAD with ' (startapp "wscript" "r:/OptionsClose.vbs") ' or from VBA with Shell "wscript R:\OptionsClose.vbs" On Error Resume Next Set AcadApp = GetObject(, "AutoCAD.Application") Set AcadDoc = AcadApp.ActiveDocument AcadApp.Visible = True Set WshShell = CreateObject("WScript.Shell") WshShell.AppActivate AcadApp.Caption WshShell.SendKeys "OPTIONS ", True WshShell.SendKeys "{Esc}", True ' Call the rest of the VBA code to continue WshShell.SendKeys "{(}vl-vbarun ""subImportProfile""{)} ", True I got a problem with the dialog boxes where AutoCAD 2002 and AutoCAD LT 2002 browses for files. It took more time than before and for folders with hundreds of files it took forever. It was so slow. I checked with File Monitor from www.systeminternals.com and found the following. Compared to a PC where this problem where nonexistent AutoCAD where not reading the file stream information like SummaryInformation on each file in the folder. 4809 0.01369895 acad.exe:1376 IRP_MJ_CREATE R:\4108\003.dwg: Raec25ph4sudbf0hAaq5ehw3Nf: $DATA FILE NOT FOUND Attributes: N Options: Open 4810 0.01348607 acad.exe:1376 IRP_MJ_CREATE R:\4108\003.dwg\: {4c8cc155-6c1e-11d1-8e41-00c04fb9386d}: $DATA FILE NOT FOUND Attributes: N Options: Open 4811 0.01341148 acad.exe:1376 IRP_MJ_CREATE R:\4108\003.dwg\: SummaryInformation:$DATA FILE NOT FOUND Attributes: N Options: Open 4812 0.01337544 acad.exe:1376 IRP_MJ_CREATE R:\4108\003.dwg\: Docf_SummaryInformation:$DATA FILE NOT FOUND Attributes: N Options: Open 4813 0.01347238 acad.exe:1376 IRP_MJ_CREATE R:\4108\003.dwg\: SummaryInformation:$DATA FILE NOT FOUND Attributes: N Options: Open 4814 0.01371934 acad.exe:1376 IRP_MJ_CREATE R:\4108\003.dwg\: Docf_SummaryInformation:$DATA FILE NOT FOUND Attributes: N Options: Open 4815 0.01354194 acad.exe:1376 IRP_MJ_CREATE R:\4108\003.dwg\: SummaryInformation:$DATA FILE NOT FOUND Attributes: N Options: Open 4816 0.01362073 acad.exe:1376 IRP_MJ_CREATE R:\4108\003.dwg\: Docf_SummaryInformation:$DATA FILE NOT FOUND Attributes: N Options: Open 4817 0.01338829 acad.exe:1376 IRP_MJ_CREATE R:\4108\003.dwg\: DocumentSummaryInformation: $DATA FILE NOT FOUND Attributes: N Options: Open 4818 0.01355787 acad.exe:1376 IRP_MJ_CREATE R:\4108\003.dwg\: Docf_DocumentSummaryInformation: $DATA FILE NOT FOUND Attributes: N Options: Open 4819 0.03258022 acad.exe:1376 IRP_MJ_CREATE R:\4108\003.dwg\: SummaryInformation:$DATA FILE NOT FOUND Attributes: N Options: Open 4820 0.01330169 acad.exe:1376 IRP_MJ_CREATE R:\4108\003.dwg\: Docf_SummaryInformation:$DATA FILE NOT FOUND Attributes: N Options: Open 4821 0.01346875 acad.exe:1376 IRP_MJ_CREATE R:\4108\003.dwg\: SummaryInformation:$DATA FILE NOT FOUND Attributes: N Options: Open 4822 0.01358357 acad.exe:1376 IRP_MJ_CREATE R:\4108\003.dwg\: Docf_SummaryInformation:$DATA FILE NOT FOUND Attributes: N Options: Open 4823 0.02074817 acad.exe:1376 IRP_MJ_CREATE R:\4108\003.dwg\: SebiesnrMkudrfcoIaamtykdDa: $DATA FILE NOT FOUND Attributes: N Options: Open 4824 0.01414593 acad.exe:1376 IRP_MJ_CREATE R:\4108\003.dwg\: Docf_SebiesnrMkudrfcoIaamtykdDa: $DATA FILE NOT FOUND Attributes: N Options: Open Solution at last! I hunted this down. I don't know what else this setting is for but by changing it everything works fine. Do you know what this byte do? Set the two-digit value in the 17:th byte to 00. Many of the other bytes are controlled by settings that is controlled via Explorer > Tools > Folder Options > View. Observe that you have to manually change this one byte in REGEDIT. You have to restart AutoCAD to have the effect. Correct key below: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer] "ShellState"=hex:24,00,00,00,20,28,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ,\ 01,00,00,00,0a,00,00,00,00,00,00,00,00,00,00,00 Erroneous key below: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer] "ShellState"=hex:24,00,00,00,73,a8,00,00,00,00,00,00,00,00,00,00,05,00,00,00 ,\ 01,00,00,00,0a,00,00,00,00,00,00,00,00,00,00,00 Update: the bug still exists in AutoCAD 2004. Latest news is that I cannot replicate it. It might been fixed in a Service Pack. I can't get the all different values extracted from the attributes. I would like to have the three values STND-N-YY-1015;STND-N-YY-1010;STND-N-YY-1011 extracted. The result below means nothing to me. How can it? I don't know in what drawing 'STND-N-YY-1010' comes from and the value 'STND-N-YY-1011' isn't showed at all, except as a number included in row 1. But that value shows 'STND-N-YY-1010'. Block Name;Count;Attribute;AttributeValue BLANKETTA4S;2;DN;STND-N-YY-1010 BLANKETTA4S~F:\try\STND-N-YY-1015-0.dwg;1;DN;STND-N-YY-1015 The result below looks more correct in my eyes then. I get the attribute DN with it's value on each drawing. But this result doesn't come from EATTEXT Block Name;Count;Attribute;AttributeValue BLANKETTA4S~F:\try\STND-N-YY-1015-0.dwg;1;DN;STND-N-YY-1015 BLANKETTA4S~F:\try\STND-N-YY-1010-0.dwg;1;DN;STND-N-YY-1010 BLANKETTA4S~F:\try\STND-N-YY-1011-0.dwg;1;DN;STND-N-YY-1011 Autodesk answer on the above bug was: "The reason why the CSV file looked something strange is because the same Block Name is existed in several files. So the same Block Name after the second file will append the filename at the end of the Block Name with a '~' in between. This is the behavior of the design for this command." Another problem I have in a Swedish environment is that XLS-file from EATTEXT creates everything in one column instead of multiple ones. Conclusion is that EATTEXT is useless for at least my needs. Update: Unfortunately this was not making it to be solved for AutoCAD 2004 or AutoCAD 2005. But for AutoCAD 2006 it's almost solved. Everything seems to work well except it's not possible to get the file path and name extracted. |