Help me please.

type Tq = class(Tobject) procedure l; private type ImageInfo = record width : integer; height:integer; srcDC,bufDC: hdc; end; var imgInf:imageinfo; function q(x,y:integer):integer; end; 

An error occurs when assigning the value of an imginf variable. Error EAccsesViolation. What to do?

Added.

Code:

 type TGagGraph = class(Tobject) type ImageInfo = record width : integer; height:integer; srcDC,bufDC: hdc; end; var imgInf:imageinfo; function GGinit(srcHDC: hwnd): pointer; procedure setPixel(x,y:integer; color:TRGBQuad; srcBMPbits: pointer); function getPixel(x,y:integer; srcBMPbits: pointer): TRGBQuad; procedure repaint_dc; constructor Create; private function XY_to_BMP_cell_number(x,y:integer):integer; end; function rgba(r,g,b,a:byte):TRGBQuad; implementation function rgba(r,g,b,a:byte):TRGBQuad; begin result.rgbBlue:=b; result.rgbGreen:=g; result.rgbRed:=r; result.rgbReserved:=a; end; constructor TGagGraph.Create; begin imginf.width:=0; // <------- Exception class EAccsesViolation with messgae 'Accses violation at adress 00435eaf in module re.exe'. end; 
  • The code above compiled and worked properly. Try to cut off all unnecessary. Or rebuild clean. Maybe linker screwed up. - Nofate

1 answer 1

And you created a class object? If yes, then try to make this variable public:

 > type Tq = class(Tobject) > procedure l; private > type ImageInfo = record > width : integer; > height:integer; > srcDC,bufDC: hdc; public // кстати, здесь был подозрительный > "end;" > var imgInf:imageinfo; > function q(x,y:integer):integer; end; 
  • I am working with a variable from an object procedure of this class. i.e .: var tobj: Tq; begin tobj.l; end; // --------------------------- here is the procedure l procedure l; begin imgInfo.width: = 199; end; What do i do? - ololo
  • The error appears in the program's run-time: error accessing the address. As I understand it, the variable is not allocated to memory. - Ololo
  • I hope you have an implementation of the "l ()" method. Try moving the method definition to one section with "imginfo" and remove the "var" before the "imginfo". - AseN
  • I tried everything, it does not work. Question updated. - Ololo