全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1310
推到 Plurk!
推到 Facebook!

Access violation at address 0040442E in moudle....

答題得分者是:pedro
inglong
初階會員


發表:28
回覆:27
積分:36
註冊:2004-08-13

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-04-30 11:34:19 IP:218.160.xxx.xxx 未訂閱
之前Run的時候還ok  突然就出現這個問題   換了別台電腦試也是一樣會發生問題  請各位幫我看看哪裡寫的不好  需要改進的~  或是該怎嘛Debug  小弟是初學者  不太會使用:D  執行失敗時 指標有停在 usersession.UserAimage:=sum[0].path; 這一行 以下是我的程式碼      unit FormBaseUserSearchPic;    interface    uses   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,   Dialogs, FormBase, IWCompLabel, IWControl, IWCompButton, IWContainer,   IWRegion, DB, DBTables, IWExtCtrls, IWCompEdit, IWCompListbox,jpeg,   IWCompCheckbox, IWTypes, IWCompMemo, FormBaseUser;    type MyType = record      value : real ;      path : string ;      end; type TM = array of MyType ;    type   TformMain8 = class(TformMain7)     LabelTitle: TIWLabel;     IWbt1: TIWButton;     IWFile1: TIWFile;     IWLabel1: TIWLabel;     IWImage1: TIWImage;     ImageA: TIWImage;     ImageB: TIWImage;     ImageC: TIWImage;     ImageD: TIWImage;     ImageE: TIWImage;     ImageF: TIWImage;     ImageG: TIWImage;     ImageH: TIWImage;     ImageI: TIWImage;     ImageJ: TIWImage;     Query1: TQuery;     Database1: TDatabase;     IWLabel2: TIWLabel;     IWLabel3: TIWLabel;     IWLabel4: TIWLabel;     IWLabel5: TIWLabel;     IWLabel6: TIWLabel;     IWLabel7: TIWLabel;     IWLabel8: TIWLabel;     IWLabel9: TIWLabel;     IWLabel10: TIWLabel;     IWLabel11: TIWLabel;     IWLabel12: TIWLabel;     PicHeight: TIWEdit;     PicWidth: TIWEdit;     Query2: TQuery;     RGBCheck: TIWCheckBox;     VarCheck: TIWCheckBox;     DWTCheck: TIWCheckBox;     Query3: TQuery;     IWRegion1: TIWRegion;     IWComboBox1: TIWComboBox;     IWButton1: TIWButton;     IWEdit1: TIWEdit;     Query6: TQuery;     Query4: TQuery;     procedure IWbt1Click(Sender: TObject);     procedure ImageAClick(Sender: TObject);     procedure ImageBClick(Sender: TObject);     procedure ImageCClick(Sender: TObject);     procedure ImageDClick(Sender: TObject);     procedure ImageEClick(Sender: TObject);     procedure ImageFClick(Sender: TObject);     procedure ImageGClick(Sender: TObject);     procedure ImageHClick(Sender: TObject);     procedure ImageIClick(Sender: TObject);     procedure ImageJClick(Sender: TObject);     procedure RGBprofile(Sender:TObject);     procedure variance_ct(Sender:TObject);     procedure RGB_sp(Sender: TObject);     procedure var_sp(Sender:TObject);     procedure DWT(p:integer);     procedure DWT_sp(Sender:TObject);     procedure IWAppFormCreate(Sender: TObject);     procedure IWButton1Click(Sender: TObject);      private     { Private declarations }   public     { Public declarations }     Bprof,Gprof,Rprof: array [0..31] of integer;     variance:integer;     x_ct , y_ct :array[0..15] of real; //­pºâx,y¶bªºvariance     psum,vsum,dsum : array of real;     DT : array of real;     function qsort(a:TM;p:integer;r:integer):integer; //p<=0 , r<=¸ê®Æµ§¼Æ-1   end;    var   formMain8: TformMain8;    implementation    {$R *.dfm} uses Servercontroller; //************************************************** //±N¹Ï¤ù¥¿³W¤Æ,¦simg.bmp,¨Ã¨úRGB profile procedure TFormmain8.RGBprofile(Sender:TObject); var Tr:trect;     zm:tbitmap;     t,height_ct,width_ct:integer;     ap:pbytearray; begin    with zm do   begin      zm:=tbitmap.Create;   PixelFormat:=pf24bit;     // zm.LoadFromFile(insertfile.Filename);      Tr.Top:=0;   Tr.Left:=0;   Tr.Bottom:=255;   Tr.Right:=255;   Width:=256;   Height:=256;   Canvas.StretchDraw(Tr,iwimage1.Picture.Graphic);   SaveToFile('img.bmp');   end;         for t:= 0 to 31 do     begin       Bprof[t]:=0;       Gprof[t]:=0;       Rprof[t]:=0;     end;        for height_ct:= 0 to zm.Height-1 do     begin       ap:=zm.ScanLine[height_ct];       for width_ct:= 0 to zm.Width-1 do       begin         Case ap[3*width_ct] of             0..7     : Bprof[0]:=Bprof[0]+1;             8..15    : Bprof[1]:=Bprof[1]+1;             16..23   : Bprof[2]:=Bprof[2]+1;             24..31   : Bprof[3]:=Bprof[3]+1;             32..39   : Bprof[4]:=Bprof[4]+1;             40..47   : Bprof[5]:=Bprof[5]+1;             48..55   : Bprof[6]:=Bprof[6]+1;             56..63   : Bprof[7]:=Bprof[7]+1;             64..71   : Bprof[8]:=Bprof[8]+1;             72..79   : Bprof[9]:=Bprof[9]+1;             80..87   : Bprof[10]:=Bprof[10]+1;             88..95   : Bprof[11]:=Bprof[11]+1;             96..103  : Bprof[12]:=Bprof[12]+1;             104..111 : Bprof[13]:=Bprof[13]+1;             112..119 : Bprof[14]:=Bprof[14]+1;             120..127 : Bprof[15]:=Bprof[15]+1;             128..135 : Bprof[16]:=Bprof[16]+1;             136..143 : Bprof[17]:=Bprof[17]+1;             144..151 : Bprof[18]:=Bprof[18]+1;             152..159 : Bprof[19]:=Bprof[19]+1;             160..167 : Bprof[20]:=Bprof[20]+1;             168..175 : Bprof[21]:=Bprof[21]+1;             176..183 : Bprof[22]:=Bprof[22]+1;             184..191 : Bprof[23]:=Bprof[23]+1;             192..199 : Bprof[24]:=Bprof[24]+1;             200..207 : Bprof[25]:=Bprof[25]+1;             208..215 : Bprof[26]:=Bprof[26]+1;             216..223 : Bprof[27]:=Bprof[27]+1;             224..231 : Bprof[28]:=Bprof[28]+1;             232..239 : Bprof[29]:=Bprof[29]+1;             240..247 : Bprof[30]:=Bprof[30]+1;             248..255 : Bprof[31]:=Bprof[31]+1;           end;   //case              Case ap[3*width_ct+1] of             0..7     : Gprof[0]:=Gprof[0]+1;             8..15    : Gprof[1]:=Gprof[1]+1;             16..23   : Gprof[2]:=Gprof[2]+1;             24..31   : Gprof[3]:=Gprof[3]+1;             32..39   : Gprof[4]:=Gprof[4]+1;             40..47   : Gprof[5]:=Gprof[5]+1;             48..55   : Gprof[6]:=Gprof[6]+1;             56..63   : Gprof[7]:=Gprof[7]+1;             64..71   : Gprof[8]:=Gprof[8]+1;             72..79   : Gprof[9]:=Gprof[9]+1;             80..87   : Gprof[10]:=Gprof[10]+1;             88..95   : Gprof[11]:=Gprof[11]+1;             96..103  : Gprof[12]:=Gprof[12]+1;             104..111 : Gprof[13]:=Gprof[13]+1;             112..119 : Gprof[14]:=Gprof[14]+1;             120..127 : Gprof[15]:=Gprof[15]+1;             128..135 : Gprof[16]:=Gprof[16]+1;             136..143 : Gprof[17]:=Gprof[17]+1;             144..151 : Gprof[18]:=Gprof[18]+1;             152..159 : Gprof[19]:=Gprof[19]+1;             160..167 : Gprof[20]:=Gprof[20]+1;             168..175 : Gprof[21]:=Gprof[21]+1;             176..183 : Gprof[22]:=Gprof[22]+1;             184..191 : Gprof[23]:=Gprof[23]+1;             192..199 : Gprof[24]:=Gprof[24]+1;             200..207 : Gprof[25]:=Gprof[25]+1;             208..215 : Gprof[26]:=Gprof[26]+1;             216..223 : Gprof[27]:=Gprof[27]+1;             224..231 : Gprof[28]:=Gprof[28]+1;             232..239 : Gprof[29]:=Gprof[29]+1;             240..247 : Gprof[30]:=Gprof[30]+1;             248..255 : Gprof[31]:=Gprof[31]+1;           end;  //case              Case ap[3*width_ct+2] of             0..7     : Rprof[0]:=Rprof[0]+1;             8..15    : Rprof[1]:=Rprof[1]+1;             16..23   : Rprof[2]:=Rprof[2]+1;             24..31   : Rprof[3]:=Rprof[3]+1;             32..39   : Rprof[4]:=Rprof[4]+1;             40..47   : Rprof[5]:=Rprof[5]+1;             48..55   : Rprof[6]:=Rprof[6]+1;             56..63   : Rprof[7]:=Rprof[7]+1;             64..71   : Rprof[8]:=Rprof[8]+1;             72..79   : Rprof[9]:=Rprof[9]+1;             80..87   : Rprof[10]:=Rprof[10]+1;             88..95   : Rprof[11]:=Rprof[11]+1;             96..103  : Rprof[12]:=Rprof[12]+1;             104..111 : Rprof[13]:=Rprof[13]+1;             112..119 : Rprof[14]:=Rprof[14]+1;             120..127 : Rprof[15]:=Rprof[15]+1;             128..135 : Rprof[16]:=Rprof[16]+1;             136..143 : Rprof[17]:=Rprof[17]+1;             144..151 : Rprof[18]:=Rprof[18]+1;             152..159 : Rprof[19]:=Rprof[19]+1;             160..167 : Rprof[20]:=Rprof[20]+1;             168..175 : Rprof[21]:=Rprof[21]+1;             176..183 : Rprof[22]:=Rprof[22]+1;             184..191 : Rprof[23]:=Rprof[23]+1;             192..199 : Rprof[24]:=Rprof[24]+1;             200..207 : Rprof[25]:=Rprof[25]+1;             208..215 : Rprof[26]:=Rprof[26]+1;             216..223 : Rprof[27]:=Rprof[27]+1;             224..231 : Rprof[28]:=Rprof[28]+1;             232..239 : Rprof[29]:=Rprof[29]+1;             240..247 : Rprof[30]:=Rprof[30]+1;             248..255 : Rprof[31]:=Rprof[31]+1;           end;// case       end; // width_ct     end; // height_ct     (* for t:=0 to 31 do    begin      iwmemo1.Lines.Add(floattostr(Bprof[t]));    end;*)//debuguse    end; //±N¹Ï¤ù¥¿³W¤Æ,¦simg.bmp,¨Ã¨úRGB profile //****************************************************    procedure TFormmain8.variance_ct(Sender:TObject); var ap:pbytearray;     vbm,zm:tbitmap;     Tr:Trect;     bw,bh:integer;     bhx,bwx,i,j:integer;     bmean,bdif,vmean,vdif:extended;     bvar:array[0..15] of array [0..15] of extended; begin      zm:=tbitmap.Create;   zm.PixelFormat:=pf24bit;   Tr.Top:=0;   Tr.Left:=0;   Tr.Bottom:=255;   Tr.Right:=255;   zm.Width:=256;   zm.Height:=256;   zm.Canvas.StretchDraw(Tr,IWImage1.Picture.Graphic);   zm.SaveToFile('img.bmp');      vbm:=tbitmap.Create;   vbm.PixelFormat:=pf24bit;   vbm.LoadFromFile('img.bmp');       //*****¹Ï¤ù¶Â¥Õ¤Æ******       for i:=0 to vbm.Height-1 do       begin         ap:=vbm.ScanLine[i];         for j:=0 to vbm.Width-1 do         begin           ap[j*3]:=(ap[j*3]+ap[j*3+1]+ap[j*3+2]) div 3;           ap[j*3+1]:=ap[j*3];           ap[j*3+2]:=ap[j*3];         end;       end;       //*****¹Ï¤ù¶Â¥Õ¤Æ******          //*****­pºâvariance******         variance:=0;         //²MªÅbvar         for i:=0 to 15 do         begin         x_ct[i]:=0;         y_ct[i]:=0;           for j:=0 to 15 do           begin             bvar[j,i]:=0;           end;         end;         //²MªÅbvar            //­pºâvbmªºmean         vmean:=0;         for i:=0 to 255 do         begin         ap:=vbm.ScanLine[i];           for j:=0 to 255 do           begin             vmean:=vmean+ap[j*3];           end;         end;         vmean:=vmean / (256*256) ;         //­pºâvbmªºmean            //­pºâvbmªº¥­§¡variance         vdif:=0;         for i:=0 to 255 do         begin         ap:=vbm.ScanLine[i];           for j:=0 to 255 do           begin             vdif:=vdif+ sqr(vmean-ap[j*3]) ;           end;         end;         vdif:=vdif / (256*256);         //­pºâvbmªºvariance            //­pºâ¨C­Óblockªºmean         for bhx:= 0 to 15 do         begin           for bwx:= 0 to 15 do           begin           bmean:=0;             for bh:=bhx*16 to (bhx+1)*16 -1 do             begin               ap:=vbm.ScanLine[bh];               for bw:=bwx*16 to (bwx+1)*16-1 do               begin                 bmean:=bmean+ap[bw*3];               end;             end;           bmean:=bmean / 256 ;           bvar[bwx,bhx]:=bmean;           end;         end;         //­pºâ¨C­Óblockªºmean            //­pºâ¨C­Óblockªº¥­§¡variance         for bhx:= 0 to 15 do         begin           for bwx:= 0 to 15 do           begin           bdif:=0;             for bh:=bhx*16 to (bhx+1)*16 -1 do             begin               ap:=vbm.ScanLine[bh];               for bw:=bwx*16 to (bwx+1)*16-1 do               begin                 bdif:=bdif+ sqr(bvar[bwx,bhx]-ap[bw*3]);               end;             end;           bdif:=bdif / 256 ;           bvar[bwx,bhx]:=bdif;              if bvar[bwx,bhx]>vdif then           begin             variance:=variance+1;             y_ct[bhx]:=y_ct[bhx]+1;             x_ct[bwx]:=x_ct[bwx]+1;           end;              end;   //bwx         end;  // bhx            //­pºâ¨C­Óblockªº¥­§¡variance          //*****­pºâvariance******    end;    procedure TformMain8.RGB_sp(Sender: TObject); var sum,total : real; c,t,RecNo : integer; begin   query1.First;   RecNo:=query1.RecordCount; //¬ö¿ýtable¤¤¦³´Xµ§¸ê®Æ   setlength(psum,RecNo);   total:=0;   //*************************************************   //­pºâRGBprofile¦U®t²§­È¤ñ­«   for c:=0 to query1.RecordCount-1 do   begin     psum[c]:=0;     sum:=0;        for t:= 0 to 31 do     begin       sum:=sum+sqr(Bprof[t]-Query1.Fields[t+1].AsFloat);     end;        for t:= 0 to 31 do     begin       sum:=sum+sqr(Gprof[t]-Query1.Fields[t+33].AsFloat);     end;        for t:= 0 to 31 do     begin       sum:=sum+sqr(Rprof[t]-Query1.Fields[t+65].AsFloat);     end;            psum[c]:=sum ;        total:=total+sum;     query1.Next;   end; // C      for c:=0 to query1.RecordCount-1 do   begin     psum[c]:= psum[c]/total ;   //  iwmemo1.Lines.Add(floattostr(psum[c]));//debuguse    end;   //­pºâRGBprofile¦U®t²§­È¤ñ­«   //*************************************************    end;    procedure TformMain8.var_sp(Sender:TObject); var xtal,ytal : real; c,t,RecNo : integer; xsum,ysum : array of real ; begin   query2.First;   RecNo:=query2.RecordCount;   setlength(vsum,RecNo);   setlength(xsum,RecNo);   setlength(ysum,RecNo);   xtal:=0;   ytal:=0;   for c:=0 to query2.RecordCount-1 do   begin     xsum[c]:=0;     ysum[c]:=0;     for t:=0 to 15 do     begin       xsum[c]:=xsum[c] + sqr(x_ct[t]-query2.Fields[t+5].AsFloat);       ysum[c]:=ysum[c] + sqr(y_ct[t]-query2.Fields[t+21].AsFloat);       xtal:=xtal+xsum[c];       ytal:=ytal+ysum[c];     end;     query2.Next;   end;      for c :=0 to query2.RecordCount-1 do   begin     vsum[c]:=0;     xsum[c]:=xsum[c]/xtal;     ysum[c]:=ysum[c]/ytal;     vsum[c]:=0.5*xsum[c]*0.5*ysum[c];   end;    end;    function TFormMain8.qsort(a:TM;p:integer;r:integer):integer; var x,temp:MyType;     i,j,q:integer; begin   if psum[j 1].value then begin temp:=sum[j].value; sum[j].value:=sum[j 1].value; sum[j 1].value:=temp; s:=sum[j].path; sum[j].path:=sum[j 1].path; sum[j 1].path:=s; end; end; end; usersession.UserAimage:=''; usersession.UserBimage:=''; usersession.UserCimage:=''; usersession.UserDimage:=''; usersession.UserEimage:=''; usersession.UserFimage:=''; usersession.UserGimage:=''; usersession.UserHimage:=''; usersession.UserIimage:=''; usersession.UserJimage:=''; usersession.UserAimage:=sum[0].path; usersession.UserBimage:=sum[1].path; usersession.UserCimage:=sum[2].path; usersession.UserDimage:=sum[3].path; usersession.UserEimage:=sum[4].path; usersession.UserFimage:=sum[5].path; usersession.UserGimage:=sum[6].path; usersession.UserHimage:=sum[7].path; usersession.UserIimage:=sum[8].path; usersession.UserJimage:=sum[9].path; ImageA.Picture.LoadFromFile(sum[0].path); ImageB.Picture.LoadFromFile(sum[1].path); ImageC.Picture.LoadFromFile(sum[2].path); ImageD.Picture.LoadFromFile(sum[3].path); ImageE.Picture.LoadFromFile(sum[4].path); ImageF.Picture.LoadFromFile(sum[5].path); ImageG.Picture.LoadFromFile(sum[6].path); ImageH.Picture.LoadFromFile(sum[7].path); ImageI.Picture.LoadFromFile(sum[8].path); ImageJ.Picture.LoadFromFile(sum[9].path); end else begin webapplication.ShowMessage('½Ð¿ï¾Ü­n¨Ï¥Îªº·j´M¤èªk',smAlert); end; end; 何需Coding爭峰 千人指 萬人鋒 敢問Coding頂峰 三尺秋水塵不染 天下無雙 發表人 - inglong 於 2005/04/30 11:37:27 發表人 - inglong 於 2005/04/30 11:39:36
------
何需Coding爭峰
千人指 萬人鋒
敢問Coding頂峰
三尺秋水塵不染
天下無雙
pedro
尊榮會員


發表:152
回覆:1187
積分:892
註冊:2002-06-12

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-04-30 12:02:34 IP:61.224.xxx.xxx 未訂閱
inglong 沒看到usersession的Type及宣告? Sum[]在出問題點的前面就已經執行過,而且有配置空間及執行過 或許您可以用逐行執行程式的方式,看這兩個變數在記憶體中是否有配置, 或看看真正停在那一行出現錯誤 ................... .楛耕傷稼,楛耘失歲. ...................
inglong
初階會員


發表:28
回覆:27
積分:36
註冊:2004-08-13

發送簡訊給我
#3 引用回覆 回覆 發表時間:2005-04-30 12:12:25 IP:218.160.xxx.xxx 未訂閱
引言: inglong 沒看到usersession的Type及宣告? Sum[]在出問題點的前面就已經執行過,而且有配置空間及執行過 或許您可以用逐行執行程式的方式,看這兩個變數在記憶體中是否有配置, 或看看真正停在那一行出現錯誤 ................... .楛耕傷稼,楛耘失歲. ...................
usersession的宣告我寫在這裡 interface uses SysUtils, Classes, IWServerControllerBase, // For OnNewSession Event IWApplication, IWAppForm; type TIWServerController = class(TIWServerControllerBase) procedure IWServerControllerBaseNewSession(ASession: TIWApplication; var VMainForm: TIWAppForm); private public end; // This is a class which you can add variables to that are specific to the user. Add variables // to this class instead of creating global variables. This object can references by using: // UserSession // So if a variable named UserName of type string is added, it can be referenced by using: // UserSession.UserName // Such variables are similar to globals in a normal application, however these variables are // specific to each user. // // See the IntraWeb Manual for more details. TUserSession = class private FUserName:string; //±b¸¹session FUserAbility:string; //¨Ï¥ÎªÌÅv¤Osession FUserAimage: string; FUserBimage: string; FUserCimage: string; FUserDimage: string; FUserEimage: string; FUserFimage: string; FUserGimage: string; FUserHimage: string; FUserIimage: string; FUserJimage: string; public property UserName:string read FUserName write FUserName; property UserAbility:string read FUserAbility write FUserAbility; property UserAimage: string read FUserAimage write FUserAimage; property UserBimage: string read FUserBimage write FUserBimage; property UserCimage: string read FUserCimage write FUserCimage; property UserDimage: string read FUserDimage write FUserDimage; property UserEimage: string read FUserEimage write FUserEimage; property UserFimage: string read FUserFimage write FUserFimage; property UserGimage: string read FUserGimage write FUserGimage; property UserHimage: string read FUserHimage write FUserHimage; property UserIimage: string read FUserIimage write FUserIimage; property UserJimage: string read FUserJimage write FUserJimage; end; // Procs function UserSession: TUserSession; implementation {$R *.dfm} uses IWInit; function UserSession: TUserSession; begin Result := TUserSession(RWebApplication.Data); end; procedure TIWServerController.IWServerControllerBaseNewSession( ASession: TIWApplication; var VMainForm: TIWAppForm); begin ASession.Data := TUserSession.Create; end; end. 何需Coding爭峰 千人指 萬人鋒 敢問Coding頂峰 三尺秋水塵不染 天下無雙
------
何需Coding爭峰
千人指 萬人鋒
敢問Coding頂峰
三尺秋水塵不染
天下無雙
系統時間:2024-06-08 8:20:27
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!