Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Exception 0xC0000005. Access violation
#1
Hello All,

How do I get around the following error:

Exception 0xC0000005. Access violation. Cannot access memory at 0x0. In  at 0x0 (0x0+0x0). 


I get this error when attempting to get the children of an object. It sometimes works and sometimes gives this error
#2
Please post the code.
How many child objects are expected? Maybe memory allocation fails.
#3
It's basically a loop that I run twice, first searching for a specific item, then comparing the specific item against each of the rest of the items. each item has 10 consecutive attributes, hence the iteration of 10.
 
Code:
Copy      Help
 
Macro [b]SmartLinkExams[/b] [help1][/help1]
[code]int w=win("Siemens Healthineers" "*.Window.*")
Acc a.Find(w "TABLE" "timelineGrid" "class=*.Window.*[]wfName=timelineGrid" 0x1005)
ARRAY(Acc) ac ac1
a.GetChildObjects(ac 1 "" "" "" 16) ;;flag 16: +invisible
DateTime CurrentExamDate  DateTimeDifference SearchExamDate
str CurrentExamType


out

str strStatus
str strMainStudy strAccession

for _i 0 ac.len
,Acc& r=ac[_i]
,r=ac[_i+2]
,str  name
,name=r.Name
,str value=r.Value
,CurrentExamType=value
,CurrentExamType.left(CurrentExamType, 10)
,out F"{name} {value}"

,
,
,r=ac[_i+3]
,name=r.Name
,value=r.Value
,CurrentExamDate.FromStr(value)
,out F"{name} {value}"
,
,r=ac[_i+4]
,name=r.Name
,value=r.Value
,strStatus=value
,out F"{name} {value}"
,;
,;
,r=ac[_i+9]
,name=r.Name
,value=r.Value
,strMainStudy=value
,out F"{name} {value}"
,
,if strMainStudy="True"
,,out F"{CurrentExamType} {CurrentExamDate.ToStr}"
,,break
,,
,if _i+10>ac.len-1; ret
,r=ac[_i+10]
,name=r.Name
,value=r.Value
,strAccession=value
,out F"{name} {value}"
,_i=_i+10
,
,

str   SearchExamType  

;
;;;RUN THE LOOP A SECOND TIME FOR ALL STUDIES BUT THE CURRENT ONE
for _i 0 ac.len 
,r=ac[_i+2]
,name=r.Name
,value=r.Value
,SearchExamType=value
,SearchExamType.left(SearchExamType, 10)
,out F"{name} {value}"
,
,if _i+3<ac.len; r=ac[_i+3]
,name=r.Name
,value=r.Value
,SearchExamDate.FromStr(value)
,out F"{name} {value}"
,
,r=ac[_i+4]
,name=r.Name
,value=r.Value
,strStatus=value
,out F"{name} {value}"
,;
,;
,r=ac[_i+9]
,name=r.Name
,value=r.Value
,strMainStudy=value
,out F"{name} {value}"
,
,if strMainStudy="True"
,,_i=_i+10
,,continue
,;
,if _i+10>ac.len-1; ret
,,
,r=ac[_i+10]
,name=r.Name
,value=r.Value
,strAccession=value
,out F"{name} {value}"
x
[/code]
#4
Try: at first get rows, then for each row gets columns.

Code:
Copy      Help
int w=win("Siemens Healthineers" "*.Window.*")
Acc a.Find(w "TABLE" "timelineGrid" "class=*.Window.*[]wfName=timelineGrid" 0x1005)
ARRAY(Acc) rows cols
a.GetChildObjects(rows 0) ;;get rows (level 0)
DateTime CurrentExamDate  DateTimeDifference SearchExamDate
str CurrentExamType


out

str strStatus
str strMainStudy strAccession

int row col
for row 0 rows.len ;;for each row
,rows[row].GetChildObjects(cols 0)
,Acc& r=cols[2]
,str  name
,name=r.Name
,str value=r.Value
,CurrentExamType=value
,CurrentExamType.left(CurrentExamType, 10)
,out F"{name} {value}"
,
,&r=cols[3]
,name=r.Name
,value=r.Value
,CurrentExamDate.FromStr(value)
,out F"{name} {value}"
,
,&r=cols[4]
,name=r.Name
,value=r.Value
,strStatus=value
,out F"{name} {value}"
,;
,;
,&r=cols[9]
,name=r.Name
,value=r.Value
,strMainStudy=value
,out F"{name} {value}"
,
,if strMainStudy="True"
,,out F"{CurrentExamType} {CurrentExamDate.ToStr}"
,,break
,,
,&r=cols[10]
,name=r.Name
,value=r.Value
,strAccession=value
,out F"{name} {value}"
,
,

str   SearchExamType

;
;;;RUN THE LOOP A SECOND TIME FOR ALL STUDIES BUT THE CURRENT ONE
for row 0 rows.len ;;for each row
,rows[row].GetChildObjects(cols 0)
,&r=cols[2]
,name=r.Name
,value=r.Value
,SearchExamType=value
,SearchExamType.left(SearchExamType, 10)
,out F"{name} {value}"
,
,&r=cols[3]
,name=r.Name
,value=r.Value
,SearchExamDate.FromStr(value)
,out F"{name} {value}"
,
,&r=cols[4]
,name=r.Name
,value=r.Value
,strStatus=value
,out F"{name} {value}"
,;
,;
,&r=cols[9]
,name=r.Name
,value=r.Value
,strMainStudy=value
,out F"{name} {value}"
,
,if strMainStudy="True"
,,continue
,,
,&r=cols[10]
,name=r.Name
,value=r.Value
,strAccession=value
,out F"{name} {value}"


Forum Jump:


Users browsing this thread: 1 Guest(s)