delphi4arab منتديات دلفي للعرب
كيف نتجنب نعليق البرنامج في خالة for loop high counts - نسخة قابلة للطباعة

+- delphi4arab منتديات دلفي للعرب (https://delphi4arab.net/forum)
+-- قسم : منتديات دلفي للعرب التعليمية (https://delphi4arab.net/forum/forumdisplay.php?fid=3)
+--- قسم : سؤال و جواب حول دلفي (https://delphi4arab.net/forum/forumdisplay.php?fid=15)
+--- الموضوع : كيف نتجنب نعليق البرنامج في خالة for loop high counts (/showthread.php?tid=10189)

الصفحات: 1 2


RE: كيف نتجنب نعليق البرنامج في خالة for loop high counts - محمد عبد العزيز - 14-05-2019


إن كنت تقصد المكون ListBox فهناك الخاصية Sorted غيرها الى True



RE: كيف نتجنب نعليق البرنامج في خالة for loop high counts - FRXstar - 15-05-2019

نريد نعمل
connection with proxy server
PHP كود :
unit Unit1;

interface

uses
  Winapi
.Windows, Winapi.Messages, System.SysUtils, System.Variants,
 
  System.Classes, Vcl.Graphics,
 
 Vcl.Controls,winApi.wininet, Vcl.Forms, Vcl.Dialogs,
 
 Vcl.OleCtrls, SHDocVw, Vcl.StdCtrls;

type
  TForm1 
= class(TForm)
 
   Button1: TButton;
 
   WebBrowser1: TWebBrowser;
 
   procedure Button1Click(Sender: TObject);
 
 private
    
{ Private declarations }
 
 public
    
{ Public declarations }
 
 end;

var
 
 Form1: TForm1;

implementation

{$R *.dfm}
 function 
SetProxy(Server: String): Boolean;
// Server z.B. '127.0.0.1:8080' oder ''
type
  INTERNET_PER_CONN_OPTION 
= record
    dwOption
: DWORD;
 
   Value: record case Integer of 1: (dwValue: DWORD);
 
   2: (pszValue: {$IFDEF DELPHI2009_UP}PWideChar{$ELSE}PAnsiChar{$ENDIF});
 
   3: (ftValue: TFileTime);
 
 end;

end;
LPINTERNET_PER_CONN_OPTION = ^INTERNET_PER_CONN_OPTION;
INTERNET_PER_CONN_OPTION_LIST = record dwSize: DWORD;
pszConnection:
LPTSTR;
dwOptionCount:
DWORD;
dwOptionError:
DWORD;
pOptions:
LPINTERNET_PER_CONN_OPTION;
end;
LPINTERNET_PER_CONN_OPTION_LIST = ^INTERNET_PER_CONN_OPTION_LIST;

const
 
 INTERNET_PER_CONN_FLAGS = 1;
 
 INTERNET_PER_CONN_PROXY_SERVER = 2;
 
 INTERNET_PER_CONN_PROXY_BYPASS = 3;
 
 INTERNET_PER_CONN_AUTOCONFIG_URL = 4;
 
 INTERNET_PER_CONN_AUTODISCOVERY_FLAGS = 5;
 
 PROXY_TYPE_DIRECT = $00000001;
 
 PROXY_TYPE_PROXY = $00000002;
 
 PROXY_TYPE_AUTO_PROXY_URL = $00000004;
 
 PROXY_TYPE_AUTO_DETECT = $00000008;
 
 INTERNET_OPTION_REFRESH = 37;
 
 INTERNET_OPTION_PER_CONNECTION_OPTION = 75;
 
 INTERNET_OPTION_SETTINGS_CHANGED = 39;

var
 
 OptionsList: INTERNET_PER_CONN_OPTION_LIST;
 
 BufSize: DWORD;
 
 HInternet: Pointer;
 
 Agent: String;

begin
  Result 
:= False;
 
 BufSize := SizeOf(OptionsList);
 
 OptionsList.dwSize := BufSize;
 
 OptionsList.pszConnection := nil; // nil -> LAN, sonst Verbindungsname
 
 OptionsList.dwOptionCount := 3; // 3 Optionen werden gesetzt
 
 OptionsList.pOptions := AllocMem(3 * SizeOf(INTERNET_PER_CONN_OPTION));
 
 try
    if not Assigned
(OptionsList.pOptions) then
      EXIT
;
 
   OptionsList.pOptions^.dwOption := INTERNET_PER_CONN_FLAGS;
 
   OptionsList.pOptions^.Value.dwValue := PROXY_TYPE_DIRECT or
 
     PROXY_TYPE_PROXY;
 
   inc(OptionsList.pOptions);
 
   OptionsList.pOptions^.dwOption := INTERNET_PER_CONN_PROXY_SERVER;
 
   OptionsList.pOptions^.Value.pszValue := PChar(Server);
 
   inc(OptionsList.pOptions);
 
   OptionsList.pOptions^.dwOption := INTERNET_PER_CONN_PROXY_BYPASS;
 
   OptionsList.pOptions^.Value.pszValue := 'local';
 
   dec(OptionsList.pOptions, 2);
 
   Agent := ExtractFileName(Application.ExeName);
 
   HInternet := InternetOpen
      
({$IFDEF DELPHI2009_UP}PWideChar{$ELSE}PAnsiChar{$ENDIF}
 
     (Agent), INTERNET_OPEN_TYPE_DIRECT, nil, nil, 0);
 
   try // Optionen setzen
 
     Result := InternetSetOption(HInternet,
 
       INTERNET_OPTION_PER_CONNECTION_OPTION, @OptionsList, BufSize);
 
     InternetSetOption(HInternet, INTERNET_OPTION_REFRESH, nil, 0);
 
   finally
      InternetCloseHandle
(HInternet);
 
   end;
 
 finally
    FreeMem
(OptionsList.pOptions); // Speicher freigeben
 
 end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
  SetProxy
('118.172.51.84:60576'); //  'ip:port'
WebBrowser1.Navigate('www.whatismyipaddress.com');
end;

end. 
نريد نفحص البروكسي سرفر ؟
كود :
https://www.youtube.com/watch?v=R64_n8vIrvg&feature=youtu.be&ytbChannel=null

(14-05-2019, 02:20 PM)B.M.AbdelAziZ كتب :
إن كنت تقصد المكون ListBox فهناك الخاصية Sorted غيرها الى True

الخاصية ممتاز لكن وال memo

كود :
function SetProxy(Server: String): Boolean; //Server z.B. '127.0.0.1:8080' oder '' type  INTERNET_PER_CONN_OPTION = record    dwOption: DWORD;    Value: record      case Integer of        1: (dwValue: DWORD);        2: (pszValue: {$IFDEF DELPHI2009_UP}PWideChar{$ELSE}PAnsiChar{$ENDIF});        3: (ftValue: TFileTime);    end;  end;  LPINTERNET_PER_CONN_OPTION = ^INTERNET_PER_CONN_OPTION;  INTERNET_PER_CONN_OPTION_LIST = record    dwSize: DWORD;    pszConnection: LPTSTR;    dwOptionCount: DWORD;    dwOptionError: DWORD;    pOptions: LPINTERNET_PER_CONN_OPTION;  end;  LPINTERNET_PER_CONN_OPTION_LIST = ^INTERNET_PER_CONN_OPTION_LIST; const  INTERNET_PER_CONN_FLAGS = 1;  INTERNET_PER_CONN_PROXY_SERVER = 2;  INTERNET_PER_CONN_PROXY_BYPASS = 3;  INTERNET_PER_CONN_AUTOCONFIG_URL = 4;  INTERNET_PER_CONN_AUTODISCOVERY_FLAGS = 5;  PROXY_TYPE_DIRECT = $00000001;  PROXY_TYPE_PROXY = $00000002;  PROXY_TYPE_AUTO_PROXY_URL = $00000004;  PROXY_TYPE_AUTO_DETECT = $00000008;  INTERNET_OPTION_REFRESH = 37;  INTERNET_OPTION_PER_CONNECTION_OPTION = 75;  INTERNET_OPTION_SETTINGS_CHANGED = 39; var  OptionsList: INTERNET_PER_CONN_OPTION_LIST;  BufSize: DWORD;  HInternet: Pointer;  Agent: String; begin  Result:=false;  BufSize:=SizeOf(OptionsList);  OptionsList.dwSize:=BufSize;  OptionsList.pszConnection:=nil; //nil -> LAN, sonst Verbindungsname  OptionsList.dwOptionCount:=3; //3 Optionen werden gesetzt  OptionsList.pOptions:=AllocMem(3*SizeOf(INTERNET_PER_CONN_OPTION));  try    if not assigned(OptionsList.pOptions)      then Exit;    OptionsList.pOptions^.dwOption:=INTERNET_PER_CONN_FLAGS;    OptionsList.pOptions^.Value.dwValue:=PROXY_TYPE_DIRECT or PROXY_TYPE_PROXY;    inc(OptionsList.pOptions);    OptionsList.pOptions^.dwOption:=INTERNET_PER_CONN_PROXY_SERVER;    OptionsList.pOptions^.Value.pszValue:=PChar(Server);    inc(OptionsList.pOptions);    OptionsList.pOptions^.dwOption:=INTERNET_PER_CONN_PROXY_BYPASS;    OptionsList.pOptions^.Value.pszValue:='local';    dec(OptionsList.pOptions,2);    Agent:=ExtractFileName(Application.ExeName);    hInternet:=InternetOpen({$IFDEF DELPHI2009_UP}PWideChar{$ELSE}PAnsiChar{$ENDIF}                            (Agent),INTERNET_OPEN_TYPE_DIRECT,nil,nil,0);    try //Optionen setzen      Result:=InternetSetOption(hInternet,INTERNET_OPTION_PER_CONNECTION_OPTION,                                @OptionsList,BufSize);      InternetSetOption(hInternet,INTERNET_OPTION_REFRESH,nil,0);    finally      InternetCloseHandle(hInternet);    end;  finally    FreeMem(OptionsList.pOptions); //Speicher freigeben  end; end;



RE: كيف نتجنب نعليق البرنامج في خالة for loop high counts - FRXstar - 16-05-2019

the property of sorted only work for integer
and i found error in the list of proxy
i have 5 parts
ip and port
ip contents is 4 array
and part
ياشباب تنفيد لوب جسب التجربة اخد 8 ساعات و 500 جيجا من الهاردسك
يعني
wake up with out windows
نحن بحاجة الى ترتيب هده القيم ؟



8
180.31.128.151:65275
200.25.161.183:43231
109.69.182.214:16452
40.227.119.14:53305
40.4.233.116:56563
192.106.216.252:60914
56.118.222.182:42945
68.112.101.158:32084
8.22.74.152:51491
77.132.120.159:15743
27.16.235.253:28720
33.144.154.112:12766
171.77.169.61:38182
154.231.172.45:53323
31.87.110.90:63009
181.126.98.2:25446
30.225.32.210:34816
214.91.114.55:53971
121.244.241.156:50389
157.129.49.134:59563
206.184.139.223:43221
90.155.30.74:47529
28.174.175.14:62735
12.89.187.206:55104
48.144.100.219:48431
152.160.146.119:46898
70.235.51.159:56003
212.1.172.127:39157
17.50.250.156:19016
141.96.8.201:18597
176.224.188.48:40124
23.32.31.168:28245
217.225.253.119:53649
190.71.221.131:29321
187.68.154.89:37274
81.133.96.197:57335
169.236.14.65:39130
109.170.216.226:39985
8.6.151.109:61596
77.90.221.166:56076
211.152.185.132:12299
148.216.62.221:29710
34.62.71.251:64340
38.236.161.119:31861
148.177.150.218:62819
37.248.87.49:39349
86.97.192.70:24128
9.148.174.73:51660
100.244.213.246:59374
30.79.52.152:62879
180.125.109.134:15162
80.199.198.12:34524
90.183.185.100:60265
134.107.158.57:49676
193.52.19.156:16542
76.100.176.116:21406
208.198.57.219:42656
151.121.149.18:17109
194.78.147.80:57471
11.104.5.103:18199
45.238.73.16:13025
216.124.74.21:49833
37.2.233.141:43776
23.247.188.94:18133
98.9.97.100:49844
39.150.253.166:49215
123.96.188.207:48819
105.41.154.80:61724
76.120.45.254:25167
163.31.211.69:54792
18.20.217.99:51337
161.137.98.241:37283
44.243.143.113:46515
51.79.193.248:27930
198.221.254.72:61804
187.239.130.87:44836
130.238.245.132:64312
157.219.224.99:16223
21.181.90.106:54912
192.126.131.48:21859
82.101.111.167:61579
17.189.127.175:25542
94.216.178.181:17919
218.205.47.3:40048
117.242.5.239:31420
159.65.96.254:58226
132.216.224.217:12009
112.23.40.194:48528
173.117.8.192:45567
56.157.74.97:26079
41.29.88.206:62990
80.16.110.192:36100
209.11.76.129:65428
182.121.54.124:28100
150.185.57.67:36505
109.194.244.247:43430
78.134.155.59:62048
203.243.188.0:43368
211.4.63.150:61495
17.191.150.120:41413
52.177.165.78:35023
124.22.177.162:52510
169.108.224.47:21927
135.95.207.131:23867
40.21.162.85:39832
188.191.119.62:51927
206.170.244.130:12365
40.196.111.56:50690
70.134.125.145:60832
60.168.94.133:15762
204.2.154.163:16666
21.3.184.171:41066
156.184.139.169:53248
153.148.184.114:37385
157.211.193.217:54374
35.39.155.91:64369
91.199.18.168:21677
133.86.16.91:36845
61.219.56.105:35223
138.75.59.173:45815
198.36.64.40:35954
166.249.95.210:56433
9.156.217.18:34154
96.184.63.19:60908
72.175.3.181:47092
162.194.163.157:50432
19.101.178.10:44341
35.253.44.143:50310
53.241.76.157:11726
96.193.82.25:19170
210.220.16.247:12297
187.69.1.158:42530
198.106.137.215:12605
87.45.90.197:13696
153.154.134.153:26648
186.194.243.206:24481
167.120.138.36:20343
17.241.217.51:43243
54.75.88.196:22603
40.165.90.3:41984
107.180.152.112:34865
54.135.219.31:56801
144.90.147.38:41684
38.189.75.84:47721
99.122.231.39:27610
89.176.108.117:64541
7.172.16.163:20712
197.4.193.188:13146
110.234.224.189:48885
83.217.2.245:25096
213.114.12.202:30167
73.25.122.219:39063
115.119.251.117:46496
111.99.247.218:52696
115.85.226.16:57048
180.104.45.141:21794
101.47.89.180:10579
126.216.172.104:19664
218.67.19.242:34981
152.176.74.167:21297
217.68.37.153:64979
40.91.55.39:26901
13.23.206.106:11014
7.144.6.74:26892
114.118.46.23:65396
142.190.209.107:12540
160.205.246.242:55726
11.239.71.27:18376
39.81.182.109:21027
99.221.176.172:15855
207.232.218.53:15597
48.83.252.108:60811
43.44.77.73:23342
36.17.225.5:35672
168.27.75.188:22599
62.213.184.196:51236
156.126.23.102:15716
123.30.83.59:54680
176.187.241.39:25807
168.201.228.107:32446
207.162.82.44:27530
16.167.18.131:50455
170.161.168.91:41326
126.238.125.59:56080
126.23.249.172:43974
28.56.210.151:16565
134.90.24.246:63113
65.120.15.76:33322
208.71.165.99:16732
47.183.78.88:21461
179.152.92.172:36100
155.241.51.181:59359
84.14.8.62:24874
6.111.121.149:11982
19.213.232.146:37448
110.57.55.166:44940
215.84.127.63:52685
210.239.96.121:24156
88.112.195.115:36886
185.179.103.195:49849
73.144.165.21:29235
163.168.108.193:34337
142.45.244.145:16410
207.222.140.184:19271
218.92.170.129:22628
160.232.221.0:23573
122.37.246.179:46609
47.1.67.247:12297
7.155.1.47:45827
63.193.148.10:41246
116.76.159.192:18315
202.247.19.151:16293
99.133.205.139:15729
145.133.84.238:18929
130.98.150.131:12315
42.70.85.195:57909
37.125.145.188:40704
27.168.53.114:14992
159.135.122.5:19108
221.7.59.222:24929
106.207.248.177:59213
2.200.191.201:62622
143.101.184.243:44835
5.26.212.108:51965
106.104.85.106:58261
201.218.114.1:49135
174.40.245.2:48180
197.98.214.213:20848
130.135.172.70:49967
80.156.193.186:36890
3.72.20.108:20491
81.109.29.110:25949
67.205.12.242:46548
37.108.246.166:32448
219.21.252.92:28770
199.17.76.100:56626
70.71.151.85:15368
192.123.251.89:53140
132.120.212.218:46498
52.229.186.48:32752
93.118.207.130:51874
208.245.23.163:34394
79.119.53.9:17007
64.201.147.3:10319
189.60.58.85:56684
184.113.56.250:27380
202.246.198.138:33453
2.219.254.136:56357
11.150.175.3:21602
23.66.25.38:54139
155.128.208.213:51464
185.237.104.190:34735
55.211.34.232:57633
171.59.13.128:28368


RE: كيف نتجنب نعليق البرنامج في خالة for loop high counts - FRXstar - 17-05-2019

http://proxy-scraper.gsa-online.de/download/proxy_scraper.exe?__c=1

[صورة: GSA-Proxy-Scraper_2.png]

ممكن توضيح اللغة المستخدمة في هدا البرنامج

طبعا حلينا مشكلة sorted property with memo
but good with some errors
i used TSTRINGLIST

حسب تتبع SORTED FUNCTION
USE COMPARETEXT
لكن ال RESULT IS NOT CORRECT
70% OK BUT WITH WRONG

كود :
100.244.213.246:59374 101.47.89.180:10579 105.41.154.80:61724 106.104.85.106:58261 106.207.248.177:59213 107.180.152.112:34865 109.170.216.226:39985 109.194.244.247:43430 109.69.182.214:16452 110.234.224.189:48885 110.57.55.166:44940 111.99.247.218:52696 112.23.40.194:48528 114.118.46.23:65396 115.119.251.117:46496 115.85.226.16:57048 116.76.159.192:18315 117.242.5.239:31420 121.244.241.156:50389 122.37.246.179:46609 123.30.83.59:54680 123.96.188.207:48819 124.22.177.162:52510 126.216.172.104:19664 126.23.249.172:43974 126.238.125.59:56080 130.135.172.70:49967 130.238.245.132:64312 130.98.150.131:12315 132.120.212.218:46498 132.216.224.217:12009 133.86.16.91:36845 134.107.158.57:49676 134.90.24.246:63113 135.95.207.131:23867 138.75.59.173:45815 141.96.8.201:18597 142.190.209.107:12540 142.45.244.145:16410 143.101.184.243:44835 144.90.147.38:41684 145.133.84.238:18929 148.177.150.218:62819 148.216.62.221:29710 150.185.57.67:36505 151.121.149.18:17109 152.160.146.119:46898 152.176.74.167:21297 153.148.184.114:37385 153.154.134.153:26648 154.231.172.45:53323 155.128.208.213:51464 155.241.51.181:59359 156.126.23.102:15716 156.184.139.169:53248 157.129.49.134:59563 157.211.193.217:54374 157.219.224.99:16223 159.135.122.5:19108 159.65.96.254:58226 160.205.246.242:55726 160.232.221.0:23573 161.137.98.241:37283 162.194.163.157:50432 163.168.108.193:34337 163.31.211.69:54792 166.249.95.210:56433 167.120.138.36:20343 168.201.228.107:32446 168.27.75.188:22599 169.108.224.47:21927 169.236.14.65:39130 170.161.168.91:41326 171.59.13.128:28368 171.77.169.61:38182 173.117.8.192:45567 174.40.245.2:48180 176.187.241.39:25807 176.224.188.48:40124 179.152.92.172:36100 180.104.45.141:21794 180.125.109.134:15162 180.31.128.151:65275 181.126.98.2:25446 182.121.54.124:28100 184.113.56.250:27380 185.179.103.195:49849 185.237.104.190:34735 186.194.243.206:24481 187.239.130.87:44836 187.68.154.89:37274 187.69.1.158:42530 188.191.119.62:51927 189.60.58.85:56684 190.71.221.131:29321 192.106.216.252:60914 192.123.251.89:53140 192.126.131.48:21859 193.52.19.156:16542 194.78.147.80:57471 197.4.193.188:13146 197.98.214.213:20848 198.106.137.215:12605 198.221.254.72:61804 198.36.64.40:35954 199.17.76.100:56626 200.25.161.183:43231 201.218.114.1:49135 202.246.198.138:33453 202.247.19.151:16293 203.243.188.0:43368 204.2.154.163:16666 206.170.244.130:12365 206.184.139.223:43221 207.162.82.44:27530 207.222.140.184:19271 207.232.218.53:15597 208.198.57.219:42656 208.245.23.163:34394 208.71.165.99:16732 209.11.76.129:65428 210.220.16.247:12297 210.239.96.121:24156 211.152.185.132:12299 211.4.63.150:61495 212.1.172.127:39157 213.114.12.202:30167 214.91.114.55:53971 215.84.127.63:52685 216.124.74.21:49833 217.225.253.119:53649 217.68.37.153:64979 218.205.47.3:40048 218.67.19.242:34981 218.92.170.129:22628 219.21.252.92:28770 221.7.59.222:24929



RE: كيف نتجنب نعليق البرنامج في خالة for loop high counts - FRXstar - 18-05-2019

CODE FIX
كود :
// remove duplicate strings from the string list procedure RemoveDuplicates(const stringList: TStringList); var  buffer: TStringList;  cnt: Integer; begin //  stringList.Sort;  buffer := TStringList.Create;  try    buffer.Sorted := True;    buffer.Duplicates := dupIgnore;    buffer.BeginUpdate;    for cnt := 0 to stringList.Count - 1 do      buffer.Add(stringList[cnt]);    buffer.EndUpdate;    stringList.Assign(buffer);  finally    FreeandNil(buffer);  end; end;

المشكلة هي في stringList.Sort;
لايستطيع تمييز 10 و 1 و100


RE: كيف نتجنب نعليق البرنامج في خالة for loop high counts - FRXstar - 18-05-2019

هل يمكن ادخال صورة مثل علم دولة في سطر الميمو او any list box
combobox
list box
memo
others
or i need data base components


PHP كود :
<option value="AL">Albania</option>
 <
option value="DZ">Algeria</option>
 <
option value="AS">American Samoa</option>
 <
option value="AD">Andorra</option>
 <
option value="AO">Angola</option>
 <
option value="AI">Anguilla</option>
 <
option value="AQ">Antarctica</option>
 <
option value="AG">Antigua and Barbuda</option>
 <
option value="AR">Argentina</option>
 <
option value="AM">Armenia</option>
 <
option value="AW">Aruba</option>
 <
option value="AU">Australia</option>
 <
option value="AT">Austria</option>
 <
option value="AZ">Azerbaijan</option>
 <
option value="BS">Bahamas</option>
 <
option value="BH">Bahrain</option>
 <
option value="BD">Bangladesh</option>
 <
option value="BB">Barbados</option> 

طبعا نحن نبحث عن
live proxy in 179 trillions 179,444,615,625,000
???!!!!!!!

we need thread at lestt 5000 to 20000
check proxy at list 500 milions at ones
مغلومة:
ip:port
byte.byte.byte.byte:word
xxx.xxx.xxx.xxx:12345
first two part is country and city


RE: كيف نتجنب نعليق البرنامج في خالة for loop high counts - محمد عبد العزيز - 19-05-2019


السلام عليكم
بالنسبة للترتيب في Memo يمكن استخدام اي خواريزمية ترتيب وما اكثرها
ان كان العدد كبير لا تستخدم مكونات مثل Memo عليك باعادة التفكير في الأمر