Posts: 77
Threads: 13
Joined: 28.08.2025
Yesterday, 01:02
(This post was last modified: Yesterday, 08:07 by Stanley Durham.)
Shows country location on map and weather, based on selection.
AI doesn’t remove your involvement; it explodes what you can do.
You can do things fast that you wouldn’t have attempted.
One prompt, DeepSeek. Got to have Python installed, AI main tool.
=======
Prompt:
=======
compiler: PowerBASIC
compiler documentation: C:\Temp\PB\PB_AI.md
compiler documentation: C:\Temp\PB\PBHelp.html
file: C:\Temp\WorldWeather\WorldWeather.bas
file: C:\Temp\WorldWeather\Countries.txt
---
use only PowerBASIC code, no external code.
in Countries.txt, build a list of all countries.
WorldWeather.bas is a Windows GUI app.
put Countries.txt in a listbox.
when a country is selected, using PowerBASIC graphic commands, draw a map of where that country is on a world map.
in a textbox, give the current weather.
=======
C:\Temp\PB\PBHelp.html is PB help converted to HTML.
C:\Temp\PB\PB_AI.md, I asked DS to build a AI reference file from C:\Temp\PB\PBHelp.html.
WorldWeather.bas
latest code below
Posts: 77
Threads: 13
Joined: 28.08.2025
Yesterday, 01:53
(This post was last modified: Yesterday, 08:09 by Stanley Durham.)
You can do a quick remodification.
I added a [News] button. Sometimes Bing does a redirect.
Prompt:
Modify app.
build the country list inside WorldWeather.bas
display celsius and fahrenheit.
add a [News] button at the bottom.
if user clicks News button, do a popup with links to current news if found, else "Not Found".
if user clicks a link open browser.
latest code below
Posts: 77
Threads: 13
Joined: 28.08.2025
Yesterday, 07:56
(This post was last modified: Yesterday, 17:22 by Stanley Durham.)
Bing was messing up the [News] button, so I changed to a Google search, which works great. Brings up Google AI on article, and many links.
I also added a [History] button. Brings up country history search.
What started out as a ‘see if it will do it” app, turned into useful app.
Sometimes, I look up countries I never hear anything about. Initially, there were a lot of countries I didn’t know existed.
Changed again, added YouTube search button.
OK, so why not? Changed again. Added [Geography] button. Now it’s a really useful app.
Changed again before I posted the last change. Might as well have a [Maps] button.
Changed again, added [Current Conflicts] button.
Change again. If I went that far, have to add [Economy] button.
Change font size.
Added [Climate] and [Culture] button.
Added SetProcessDPIAware and WinUser.inc, per Borje Hagsten.
If I remember right, it shouldn’t be Dialog New “Pixels” to get proper adjustment to screen.
It the screen doesn’t properly adjust, that’s on me. I didn’t give good instructions.
This was just a test to see if you can use current AI with the only documentation being the help file converted to an HTML. DeepSeek and above, looks like you can.
Code: #Compile Exe
#Dim All
'#Include Once "DDT.INC"
#Include Once "WinUser.inc"
%ID_LIST = 1001
%ID_MAP = 1002
%ID_TEXT = 1003
%ID_NEWS = 1004
%ID_HISTORY = 1005
%ID_YOUTUBE = 1006
%ID_GEOGRAPHY = 1007
%ID_MAPS = 1008
%ID_CONFLICTS = 1009
%ID_ECONOMY = 1010
%ID_CLIMATE = 1011
%ID_CULTURE = 1012
%ID_NEWS_LIST = 2001
%ID_NEWS_CLOSE = 2002
%MAX_COUNTRIES = 300
%MAX_NEWS = 8
Type PolyPoint
x As Single
y As Single
End Type
Type PolyPoints
n As Long
xy(1 To 1024) As PolyPoint
End Type
Global gN As Long
Global gName() As String
Global gCap() As String
Global gLat() As Single
Global gLon() As Single
Global gMinLat() As Single
Global gMaxLat() As Single
Global gMinLon() As Single
Global gMaxLon() As Single
Global gInfoText As String
Global gNewsN As Long
Global gNewsTitle() As String
Global gNewsLabel As String
Sub LoadCountries()
Local i As Long, rec As String, n As Long
n = DataCount
If n > %MAX_COUNTRIES Then n = %MAX_COUNTRIES
For i = 1 To n
rec = Read$(i)
gName(i) = Parse$(rec, "|", 1)
gCap(i) = Parse$(rec, "|", 2)
gLat(i) = Val(Parse$(rec, "|", 3))
gLon(i) = Val(Parse$(rec, "|", 4))
gMinLat(i) = Val(Parse$(rec, "|", 5))
gMaxLat(i) = Val(Parse$(rec, "|", 6))
gMinLon(i) = Val(Parse$(rec, "|", 7))
gMaxLon(i) = Val(Parse$(rec, "|", 8))
Next i
gN = n
Data "Afghanistan|Kabul|34.518636|69.181314|29.3186|38.4863|60.5284|75.1580|AF"
Data "Albania|Tirana|41.327541|19.818883|39.6250|42.6882|19.3045|21.0200|AL"
Data "Algeria|Algiers|36.765011|3.048607|19.0574|37.1184|-8.6844|11.9995|DZ"
Data "Andorra|Andorra|42.500001|1.516486|41.5000|43.5000|0.5165|2.5165|AD"
Data "Angola|Luanda|-8.836340|13.232481|-17.9306|-5.8642|11.6401|24.0799|AO"
Data "Antigua and Barbuda|Saint John's|17.118037|-61.850034|16.1180|18.1180|-62.8500|-60.8500|AG"
Data "Argentina|Buenos Aires|-34.600556|-58.399477|-52.3500|-21.8323|-73.4154|-53.6283|AR"
Data "Armenia|Yerevan|40.183097|44.511606|38.7412|41.2481|43.5827|46.5057|AM"
Data "Australia|Canberra|-35.283029|149.129026|-39.0358|-10.6682|113.3390|153.5695|AU"
Data "Austria|Vienna|48.201961|16.364693|46.4318|49.0391|9.4800|16.9797|AT"
Data "Azerbaijan|Baku|40.397218|49.860271|38.2704|41.8607|44.9725|50.3928|AZ"
Data "Bahamas|Nassau|25.083390|-77.350044|23.7100|25.2103|-78.4085|-77.5347|BS"
Data "Bahrain|Manama|26.236136|50.583052|25.2361|27.2361|49.5831|51.5831|BH"
Data "Bangladesh|Dhaka|23.725006|90.406634|20.6709|26.4465|88.0844|92.6727|BD"
Data "Barbados|Bridgetown|13.102003|-59.616527|12.1020|14.1020|-60.6165|-58.6165|BB"
Data "Belarus|Minsk|53.901923|27.564681|51.3195|56.1691|23.1995|32.6936|BY"
Data "Belgium|Brussels|50.835263|4.331371|49.5295|51.4750|2.5136|6.1567|BE"
Data "Belize|Belmopan|17.252034|-88.767073|15.8869|18.5000|-89.2291|-88.1068|BZ"
Data "Benin|Cotonou|6.401954|2.518045|6.1422|12.2356|0.7723|3.7971|BJ"
Data "Bhutan|Thimphu|27.472986|89.639014|26.7194|28.2964|88.8142|92.1037|BT"
Data "Bolivia|Sucre|-19.040971|-65.259516|-22.8729|-9.7620|-69.5904|-57.4984|BO"
Data "Bosnia and Herzegovina|Sarajevo|43.850022|18.383002|42.6500|45.2338|15.7500|19.5998|BA"
Data "Botswana|Gaborone|-24.646314|25.911948|-26.8285|-17.6618|19.8955|29.4322|BW"
Data "Brazil|Brasilia|-15.781394|-47.917998|-33.7684|5.2445|-73.9872|-34.7300|BR"
Data "Brunei|Bandar Seri Begawan|4.883331|114.933284|4.0076|5.4477|114.2040|115.4507|BN"
Data "Bulgaria|Sofia|42.685295|23.314708|41.2345|44.2349|22.3805|28.5581|BG"
Data "Burkina Faso|Ouagadougou|12.372262|-1.526670|9.6108|15.1162|-5.4706|2.1771|BF"
Data "Burundi|Bujumbura|-3.376087|29.360006|-4.5000|-2.3485|29.0249|30.7522|BI"
Data "Cambodia|Phnom Penh|11.551976|104.914689|10.4865|14.5706|102.3481|107.6145|KH"
Data "Cameroon|Yaounde|3.868647|11.514705|1.7277|12.8594|8.4888|16.0129|CM"
Data "Canada|Ottawa|45.418643|-75.701961|41.6751|71.9205|-140.9978|-55.6834|CA"
Data "Cape Verde|Praia|14.916698|-23.516689|13.9167|15.9167|-24.5167|-22.5167|CV"
Data "Central African Republic|Bangui|4.366644|18.558288|2.2676|11.1424|14.4594|27.3742|CF"
Data "Chad|Ndjamena|12.115042|15.047203|7.4219|23.4097|13.5404|23.8869|TD"
Data "Chile|Santiago|-33.448068|-70.668987|-53.8565|-17.5800|-75.6444|-66.9852|CL"
Data "China|Beijing|39.930838|116.386340|20.2825|53.4588|73.6754|135.0263|CN"
Data "Colombia|Bogota|4.598369|-74.085290|-4.2982|12.4373|-78.9909|-66.8763|CO"
Data "Comoros|Moroni|-11.704158|43.240244|-12.7042|-10.7042|42.2402|44.2402|KM"
Data "Congo|Brazzaville|-4.257240|15.282744|-5.0380|3.7282|11.0938|18.4531|CG"
Data "Costa Rica|San Jose|9.936958|-84.085997|8.2250|11.2171|-85.9417|-82.5462|CR"
Data "Croatia|Zagreb|45.800007|15.999995|42.4800|46.5038|13.6570|19.3905|HR"
Data "Cuba|Havana|23.133905|-82.366128|19.8555|23.1886|-84.9749|-74.1780|CU"
Data "Cyprus|Nicosia|35.166677|33.366635|34.5719|35.1731|32.2567|34.0049|CY"
Data "Czechia|Prague|50.085283|14.464034|48.5553|51.1173|12.2401|18.8531|CZ"
Data "Denmark|Kobenhavn|55.680510|12.561540|54.8309|57.7300|8.0900|10.9122|DK"
Data "Djibouti|Djibouti|11.595015|43.148002|10.9269|12.6996|41.6618|43.3179|DJ"
Data "Dominica|Roseau|15.301016|-61.387013|14.3010|16.3010|-62.3870|-60.3870|DM"
Data "Dominican Republic|Santo Domingo|18.472019|-69.902031|17.5986|19.8849|-71.9451|-68.3179|DO"
Data "DR Congo|Kinshasa|-4.327778|15.313026|-13.2572|5.2561|12.1823|31.1741|CD"
Data "Ecuador|Quito|-0.213042|-78.501997|-4.9591|1.3809|-80.9678|-75.2337|EC"
Data "Egypt|Cairo|30.051906|31.248022|22.0000|31.5857|24.7001|36.8662|EG"
Data "El Salvador|San Salvador|13.711948|-89.204987|13.1490|14.4241|-90.0956|-87.7235|SV"
Data "Equatorial Guinea|Malabo|3.750015|8.783278|1.0101|2.2839|9.3056|11.2851|GQ"
Data "Eritrea|Asmara|15.333339|38.933324|12.4554|17.9983|36.3232|43.0812|ER"
Data "Estonia|Tallinn|59.433877|24.728041|57.4745|59.6111|23.3398|28.1317|EE"
Data "Eswatini|Mbabane|-26.316651|31.133335|-27.2859|-25.6602|30.6766|32.0717|SZ"
Data "Ethiopia|Addis Ababa|9.035256|38.698059|3.4221|14.9594|32.9542|47.7894|ET"
Data "Fiji|Suva|-18.133016|178.441707|-18.2880|-17.3399|177.2850|178.7181|FJ"
Data "Finland|Helsinki|60.177509|24.932181|59.8464|70.1642|20.6456|31.5161|FI"
Data "France|Paris|48.868639|2.331390|42.3434|51.1485|-4.5923|8.0993|FR"
Data "Gabon|Libreville|0.385389|9.457965|-3.9788|2.3268|8.7980|14.4255|GA"
Data "Gambia|Banjul|13.453877|-16.591702|13.1303|13.8765|-16.8415|-13.8450|GM"
Data "Georgia|Tbilisi|41.726956|44.788850|41.0644|43.5531|39.9550|46.6379|GE"
Data "Germany|Berlin|52.523765|13.399603|47.3025|54.9831|5.9887|15.0170|DE"
Data "Ghana|Accra|5.551981|-0.218662|4.7105|11.0983|-3.2444|1.0601|GH"
Data "Greece|Athens|37.985272|23.731375|36.4100|41.8269|20.1500|26.6042|GR"
Data "Grenada|Saint George's|12.052633|-61.741643|11.0526|13.0526|-62.7416|-60.7416|GD"
Data "Guatemala|Guatemala|14.623081|-90.528911|13.7353|17.8193|-92.2292|-88.2250|GT"
Data "Guinea|Conakry|9.533469|-13.682181|7.3090|12.5862|-15.1303|-7.8321|GN"
Data "Guinea-Bissau|Bissau|11.865024|-15.598361|11.0404|12.6282|-16.6775|-13.7005|GW"
Data "Guyana|Georgetown|6.801974|-58.167029|1.2681|8.3670|-61.4103|-56.5394|GY"
Data "Haiti|Port-au-Prince|18.542971|-72.337980|18.0310|19.9157|-74.4580|-71.6249|HT"
Data "Honduras|Tegucigalpa|14.103991|-87.219475|12.9847|16.0054|-89.3533|-83.1472|HN"
Data "Hungary|Budapest|47.501952|19.081375|45.7595|48.6239|16.2023|22.7105|HU"
Data "Iceland|Reykjavik|64.150024|-21.950015|63.4964|66.5268|-24.3262|-13.6097|IS"
Data "India|New Delhi|28.600023|77.199980|7.9655|35.4940|68.1766|97.4026|IN"
Data "Indonesia|Jakarta|-6.172472|106.827492|-4.1070|4.3066|108.9527|118.9967|ID"
Data "Iran|Tehran|35.673889|51.422398|25.0782|39.7130|44.1092|63.3166|IR"
Data "Iraq|Baghdad|33.340594|44.391923|29.0990|37.3853|38.7923|48.5680|IQ"
Data "Ireland|Dublin|53.335007|-6.250852|51.6693|55.1316|-9.9771|-6.0330|IE"
Data "Israel|Jerusalem|31.778408|35.206626|29.5013|33.2774|34.2654|35.8364|IL"
Data "Italy|Rome|41.897902|12.481313|37.9088|47.1154|6.7500|18.4802|IT"
Data "Ivory Coast|Yamoussoukro|6.818381|-5.275503|4.3383|10.5241|-8.6029|-2.5622|CI"
Data "Jamaica|Kingston|17.977077|-76.767434|17.7011|18.5242|-78.3377|-76.1997|JM"
Data "Japan|Tokyo|35.686963|139.749462|31.0296|41.3786|129.4085|141.9143|JP"
Data "Jordan|Amman|31.951971|35.931354|29.1975|33.3787|34.9226|39.1955|JO"
Data "Kazakhstan|Astana|51.181125|71.427774|40.6623|55.3852|46.4664|87.3600|KZ"
Data "Kenya|Nairobi|-1.281401|36.814711|-4.6768|5.5060|33.8936|41.8551|KE"
Data "Kiribati|Tarawa|1.338188|173.017571|0.3382|2.3382|172.0176|174.0176|KI"
Data "Kuwait|Kuwait City|29.371664|47.976355|28.5261|30.0591|46.5687|48.4161|KW"
Data "Kyrgyzstan|Bishkek|42.875025|74.583258|39.2795|43.2983|69.4649|80.2600|KG"
Data "Laos|Vientiane|17.966693|102.599980|13.8811|22.4648|100.1160|107.5645|LA"
Data "Latvia|Riga|56.950024|24.099965|55.6151|57.9702|21.0558|28.1767|LV"
Data "Lebanon|Beirut|33.873921|35.507762|33.0890|34.6449|35.1261|36.6118|LB"
Data "Lesotho|Maseru|-29.316674|27.483273|-30.6451|-28.6475|26.9993|29.3252|LS"
Data "Liberia|Monrovia|6.314582|-10.799660|4.3558|8.5411|-11.4388|-7.5397|LR"
Data "Libya|Tripoli|32.892500|13.180012|19.5805|33.1370|9.3194|25.1648|LY"
Data "Liechtenstein|Vaduz|47.133724|9.516670|46.1337|48.1337|8.5167|10.5167|LI"
Data "Lithuania|Vilnius|54.683366|25.316635|53.9057|56.3725|21.0558|26.5883|LT"
Data "Luxembourg|Luxembourg|49.611660|6.130003|49.4427|50.1281|5.6741|6.2428|LU"
Data "Madagascar|Antananarivo|-18.914692|47.514678|-25.6014|-12.0406|43.2542|50.4765|MG"
Data "Malawi|Lilongwe|-13.983295|33.783302|-16.8013|-9.2306|32.6882|35.7719|MW"
Data "Malaysia|Kuala Lumpur|3.168612|101.698037|0.7731|6.9281|109.6633|119.1819|MY"
Data "Maldives|Male|4.166708|73.499948|3.1667|5.1667|72.4999|74.4999|MV"
Data "Mali|Bamako|12.651961|-8.001985|10.0964|24.9746|-12.1707|4.2702|ML"
Data "Malta|Valletta|35.899733|14.514711|34.8997|36.8997|13.5147|15.5147|MT"
Data "Marshall Islands|Majuro|7.103004|171.380000|6.1030|8.1030|170.3800|172.3800|MH"
Data "Mauritania|Nouakchott|18.086427|-15.975340|14.6168|27.3957|-17.0634|-4.9233|MR"
Data "Mauritius|Port Louis|-20.166639|57.499994|-21.1666|-19.1666|56.5000|58.5000|MU"
Data "Mexico|Mexico City|19.444388|-99.132934|14.5388|32.7208|-117.1278|-86.8120|MX"
Data "Micronesia|Palikir|6.916644|158.149974|5.9166|7.9166|157.1500|159.1500|FM"
Data "Moldova|Chisinau|47.005024|28.857711|45.4883|48.4671|26.6193|30.0247|MD"
Data "Monaco|Monaco|43.739646|7.406913|42.7396|44.7396|6.4069|8.4069|MC"
Data "Mongolia|Ulaanbaatar|47.918619|106.914670|41.5974|52.0474|87.7513|119.7728|MN"
Data "Montenegro|Podgorica|42.465973|19.266307|41.8776|43.5238|18.4500|20.3398|ME"
Data "Morocco|Rabat|34.025307|-6.836408|21.4207|35.7600|-17.0204|-1.1246|MA"
Data "Mozambique|Maputo|-25.953332|32.587217|-26.7422|-10.3171|30.1795|40.7755|MZ"
Data "Myanmar|Naypyidaw|19.768503|96.116673|9.9330|28.3359|92.3032|101.1800|MM"
Data "Namibia|Windhoek|-22.570006|17.083546|-29.0455|-16.9413|11.7342|25.0844|NA"
Data "Nauru|Yaren|-0.533333|166.916667|-1.5333|0.4667|165.9167|167.9167|NR"
Data "Nepal|Kathmandu|27.718638|85.314696|26.3979|30.4227|80.0884|88.1748|NP"
Data "Netherlands|Amsterdam|52.351915|4.914694|50.8037|53.5104|3.3150|7.0921|NL"
Data "New Zealand|Wellington|-41.299988|174.783266|-46.6412|-40.4940|166.5091|174.2485|NZ"
Data "Nicaragua|Managua|12.154962|-86.270438|10.7268|15.0163|-87.6685|-83.1472|NI"
Data "Niger|Niamey|13.518652|2.114710|11.6602|23.4717|0.2956|15.9032|NE"
Data "Nigeria|Abuja|9.085279|7.531382|4.2406|13.8659|2.6917|14.5772|NG"
Data "North Korea|Pyongyang|39.021385|125.752745|37.6691|42.9854|124.2656|130.7800|KP"
Data "North Macedonia|Skopje|42.000006|21.433462|40.8427|42.3203|20.4632|22.9524|MK"
Data "Norway|Oslo|59.918636|10.748033|58.0789|71.1855|4.9921|31.2934|NO"
Data "Oman|Muscat|23.613325|58.593312|16.6511|24.9247|52.0000|59.8081|OM"
Data "Pakistan|Islamabad|33.701942|73.164689|23.6920|37.1330|60.8742|77.8375|PK"
Data "Palau|Melekeok|7.487396|134.626549|6.4874|8.4874|133.6265|135.6265|PW"
Data "Palestine|Ramallah|31.899600|35.204200|31.3534|32.5325|34.9274|35.5457|PS"
Data "Panama|Panama City|8.969963|-79.534983|7.2205|9.6116|-82.9658|-77.2426|PA"
Data "Papua New Guinea|Port Moresby|-9.464708|147.192504|-10.6525|-2.6002|141.0002|150.8016|PG"
Data "Paraguay|Asuncion|-25.294457|-57.643451|-27.5485|-19.3427|-62.6851|-54.2930|PY"
Data "Peru|Lima|-12.046067|-77.052008|-18.3480|-0.0572|-81.4109|-68.6651|PE"
Data "Philippines|Manila|14.606105|120.980271|12.5367|18.5052|119.8838|124.1813|PH"
Data "Poland|Warsaw|52.251947|20.998054|49.0274|54.8515|14.0745|24.0300|PL"
Data "Portugal|Lisbon|38.724669|-9.146812|36.8383|42.2805|-9.5266|-6.3891|PT"
Data "Qatar|Doha|25.286556|51.532968|24.5563|26.1146|50.7439|51.6067|QA"
Data "Romania|Bucharest|44.435318|26.098001|43.6884|48.2209|20.2202|29.6265|RO"
Data "Russia|Moscow|55.754110|37.613577|41.1514|77.6979|27.2882|180.0000|RU"
Data "Rwanda|Kigali|-1.951644|30.058586|-2.9179|-1.1347|29.0249|30.8161|RW"
Data "Saint Kitts and Nevis|Basseterre|17.302031|-62.717009|16.3020|18.3020|-63.7170|-61.7170|KN"
Data "Saint Lucia|Castries|14.001974|-61.000008|13.0020|15.0020|-62.0000|-60.0000|LC"
Data "Saint Vincent and the Grenadines|Kingstown|13.148279|-61.212062|12.1483|14.1483|-62.2121|-60.2121|VC"
Data "Samoa|Apia|-13.841545|-171.738642|-14.8415|-12.8415|-172.7386|-170.7386|WS"
Data "San Marino|San Marino|43.936096|12.441770|42.9361|44.9361|11.4418|13.4418|SM"
Data "Sao Tome and Principe|Sao Tome|0.333402|6.733325|-0.6666|1.3334|5.7333|7.7333|ST"
Data "Saudi Arabia|Riyadh|24.642779|46.770796|16.3479|32.1610|34.6323|55.6667|SA"
Data "Senegal|Dakar|14.717778|-17.475076|12.3321|16.5983|-17.6250|-11.4679|SN"
Data "Serbia|Belgrade|44.820591|20.466045|42.2452|46.1717|18.8298|22.9860|RS"
Data "Seychelles|Victoria|-4.616632|55.449990|-5.6166|-3.6166|54.4500|56.4500|SC"
Data "Sierra Leone|Freetown|8.471957|-13.236162|6.7859|10.0470|-13.2465|-10.2301|SL"
Data "Singapore|Singapore|1.294979|103.853875|0.2950|2.2950|102.8539|104.8539|SG"
Data "Slovakia|Bratislava|48.150018|17.116981|47.7584|49.5716|16.8800|22.5581|SK"
Data "Slovenia|Ljubljana|46.055288|14.514969|45.4523|46.8524|13.6981|16.5648|SI"
Data "Solomon Islands|Honiara|-9.437994|159.949766|-8.5383|-7.3200|158.2112|159.9174|SB"
Data "Somalia|Mogadishu|2.068627|45.364732|-1.6832|12.0246|40.9811|51.1339|SO"
Data "South Africa|Bloemfontein|-29.119994|26.229913|-34.8192|-22.0913|16.3450|32.8301|ZA"
Data "South Korea|Seoul|37.568295|126.997785|34.3900|38.6122|126.1174|129.4683|KR"
Data "South Sudan|Juba|7.000000|30.000000|3.5092|12.2480|23.8870|35.2980|SS"
Data "Spain|Madrid|40.401972|-3.685298|35.9468|43.7483|-9.3929|3.0395|ES"
Data "Sri Lanka|Colombo|6.931966|79.857751|5.9684|9.8241|79.6952|81.7880|LK"
Data "Sudan|Khartoum|15.590024|32.532233|8.2292|22.0000|21.9368|38.4101|SD"
Data "Suriname|Paramaribo|5.835030|-55.167031|1.8177|6.0253|-58.0447|-53.9580|SR"
Data "Sweden|Stockholm|59.352706|18.095389|55.3617|69.1062|11.0274|23.9034|SE"
Data "Switzerland|Bern|46.916683|7.466976|45.7769|47.8308|6.0226|10.4427|CH"
Data "Syria|Damascus|33.501980|36.298050|32.3129|37.2299|35.7008|42.3496|SY"
Data "Tajikistan|Dushanbe|38.560035|68.773879|36.7382|40.9602|67.4422|74.9800|TJ"
Data "Tanzania|Dar es Salaam|-6.798067|39.266396|-11.7209|-0.9500|29.3400|40.3166|TZ"
Data "Thailand|Bangkok|13.751945|100.514699|5.6914|20.4179|97.3759|105.5890|TH"
Data "Timor-Leste|Dili|-8.559388|125.579456|-9.3932|-8.2733|124.9687|127.3359|TL"
Data "Togo|Lome|6.133883|1.220811|5.9288|11.0187|-0.0498|1.8652|TG"
Data "Tonga|Nukualofa|-21.138512|-175.220565|-22.1385|-20.1385|-176.2206|-174.2206|TO"
Data "Trinidad and Tobago|Port-of-Spain|10.651997|-61.517031|10.0000|10.8900|-61.9500|-60.8950|TT"
Data "Tunisia|Tunis|36.802778|10.179678|30.3076|37.3500|7.5245|11.4888|TN"
Data "Turkiye|Ankara|39.929184|32.862446|35.8215|42.0402|26.1708|44.7940|TR"
Data "Turkmenistan|Ashgabat|37.949995|58.383299|35.2707|42.7516|52.5025|66.5461|TM"
Data "Tuvalu|Funafuti|-8.516652|179.216647|-9.5167|-7.5167|178.2166|180.2166|TV"
Data "Uganda|Kampala|0.318605|32.581378|-1.4433|4.2499|29.5795|35.0360|UG"
Data "Ukraine|Kiev|50.435313|30.514682|45.2933|52.3351|22.0856|40.0808|UA"
Data "United Arab Emirates|Abu Dhabi|24.466684|54.366593|22.4969|26.0555|51.5795|56.3968|AE"
Data "United Kingdom|London|51.501941|-0.118668|49.9600|58.6350|-6.1500|1.6815|GB"
Data "United States|Washington, D.C.|38.901495|-77.011364|25.0800|49.3890|-124.6872|-66.9647|US"
Data "Uruguay|Montevideo|-34.856096|-56.172998|-34.9526|-30.1097|-58.4271|-53.2096|UY"
Data "Uzbekistan|Tashkent|41.313648|69.292987|37.1450|45.5868|55.9289|73.0554|UZ"
Data "Vanuatu|Port Vila|-17.733350|168.316641|-15.7400|-14.6265|166.6291|167.2700|VU"
Data "Vatican City|Vatican City|41.903282|12.453387|40.9033|42.9033|11.4534|13.4534|VA"
Data "Venezuela|Caracas|10.502944|-66.918983|0.7245|12.1623|-73.3050|-59.7583|VE"
Data "Vietnam|Hanoi|21.035273|105.848068|8.5998|23.3521|102.1704|109.3353|VN"
Data "Yemen|Sanaa|15.356679|44.204648|12.5860|19.0000|42.6049|53.1086|YE"
Data "Zambia|Lusaka|-15.414698|28.281382|-17.9612|-8.2383|21.8878|33.4857|ZM"
Data "Zimbabwe|Harare|-17.815844|31.042764|-22.2716|-15.5078|25.2642|32.8499|ZW"
End Sub
Function UrlEncode(s As String) As String
Local i As Long, c As Long, Res As String
For i = 1 To Len(s)
c = Asc(Mid$(s, i, 1))
If (c >= 48 And c <= 57) Or (c >= 65 And c <= 90) Or (c >= 97 And c <= 122) Or c = 45 Or c = 46 Or c = 95 Or c = 126 Then
Res = Res & Chr$(c)
ElseIf c = 32 Then
Res = Res & "+"
ElseIf c = 39 Then
Res = Res & "%27"
ElseIf c = 34 Then
Res = Res & "%22"
ElseIf c > 127 Then
Select Case c
Case 145, 146
Res = Res & "%27"
Case 147, 148
Res = Res & "%22"
Case 150, 151
Res = Res & "-"
Case Else
Res = Res & "+"
End Select
Else
Res = Res & "%" & Right$("0" & Hex$(c), 2)
End If
Next i
Function = Res
End Function
Function DecodeXml(Txt As String) As String
Local s As String
s = Txt
Replace "&" With "&" In s
Replace "<" With "<" In s
Replace ">" With ">" In s
Replace """ With Chr$(34) In s
Replace "'" With "'" In s
Replace " " With " " In s
Replace "'" With "'" In s
Replace "'" With "'" In s
Replace "’" With "'" In s
Replace "‘" With "'" In s
Replace "“" With Chr$(34) In s
Replace "”" With Chr$(34) In s
Function = s
End Function
Function TagValue(s As String, tag As String) As String
Local p1 As Long, p2 As Long, v As String
p1 = InStr(s, "<" & tag & ">")
If p1 = 0 Then Exit Function
p1 = p1 + Len(tag) + 2
p2 = InStr(p1, s, "</" & tag & ">")
If p2 = 0 Then Exit Function
v = Mid$(s, p1, p2 - p1)
If Left$(v, 9) = "<![CDATA[" Then v = Mid$(v, 10)
If Right$(v, 3) = "]]>" Then v = Left$(v, Len(v) - 3)
Function = Trim$(v)
End Function
Function JsonValue(s As String, key As String) As String
Local p As Long, q As Long, c As String, v As String
p = InStr(s, Chr$(34) & key & Chr$(34))
If p = 0 Then Exit Function
p = InStr(p, s, ":")
If p = 0 Then Exit Function
Incr p
Do While p <= Len(s)
c = Mid$(s, p, 1)
If c <> " " And c <> Chr$(9) And c <> Chr$(13) And c <> Chr$(10) Then Exit Do
Incr p
Loop
If Mid$(s, p, 1) = Chr$(34) Then
Incr p
q = InStr(p, s, Chr$(34))
If q = 0 Then q = Len(s) + 1
v = Mid$(s, p, q - p)
Else
q = p
Do While q <= Len(s)
c = Mid$(s, q, 1)
If c = "," Or c = "}" Or c = "]" Then Exit Do
Incr q
Loop
v = Trim$(Mid$(s, p, q - p))
End If
Function = v
End Function
Function GetWeather(lat As Single, lon As Single) As String
Local fnum As Long
Local req As String, resp As String, buf As String, body As String
Local p As Long
Local latstr As String, lonstr As String
Local desc As String, tc As String, tf As String, fc As String, ff As String
Local hum As String, pres As String
latstr = Format$(lat, "0.0000")
lonstr = Format$(lon, "0.0000")
req = "/" & latstr & "," & lonstr & "?format=j1"
fnum = FreeFile
Tcp Open "http" At "wttr.in" As #fnum TimeOut 10000
If Err Then
Function = "Weather service unavailable (" & Error$(Err) & "). Check the Internet connection."
Exit Function
End If
Tcp Print #fnum, "GET " & req & " HTTP/1.0"
Tcp Print #fnum, "Host: wttr.in"
Tcp Print #fnum, "User-Agent: WorldWeather/1.0"
Tcp Print #fnum, "Accept: */*"
Tcp Print #fnum, "Connection: close"
Tcp Print #fnum, ""
Do
Tcp Recv #fnum, 4096, buf$
If Len(buf$) = 0 Then Exit Do
resp$ = resp$ & buf$
If Len(resp$) > 131072 Then Exit Do
Loop
Tcp Close #fnum
If InStr(Left$(resp$, 32), " 200 ") = 0 Then
Function = "Weather service did not return valid data."
Exit Function
End If
p = InStr(resp$, Chr$(13, 10, 13, 10))
If p > 0 Then
body$ = Mid$(resp$, p + 4)
Else
p = InStr(resp$, Chr$(10, 10))
If p > 0 Then body$ = Mid$(resp$, p + 2) Else body$ = resp$
End If
body$ = Utf8ToChr$(body$)
tc$ = JsonValue(body$, "temp_C")
tf$ = JsonValue(body$, "temp_F")
fc$ = JsonValue(body$, "FeelsLikeC")
ff$ = JsonValue(body$, "FeelsLikeF")
hum$ = JsonValue(body$, "humidity")
pres$ = JsonValue(body$, "pressure")
p = InStr(body$, Chr$(34) & "weatherDesc" & Chr$(34))
If p > 0 Then desc$ = JsonValue(Mid$(body$, p), "value")
desc$ = Trim$(desc$)
If desc$ = "" Then desc$ = "Current conditions"
If tc$ = "" Then
Function = "No weather data returned."
Else
Function = desc$ & ", " & tc$ & Chr$(176) & "C / " & tf$ & Chr$(176) & "F" & _
" (feels " & fc$ & Chr$(176) & "C / " & ff$ & Chr$(176) & "F), " & _
"humidity " & hum$ & "%, pressure " & pres$ & " hPa"
End If
End Function
Function GetNews(query As String) As Long
Local fnum As Long
Local srv As String, req As String
Local resp As String, buf As String, body As String
Local p As Long, p1 As Long, p2 As Long
Local Item As String, title As String, link As String, n As Long
gNewsN = 0
srv = "www.bing.com"
req = "/news/search?q=" & UrlEncode(query) & "&format=rss"
fnum = FreeFile
Tcp Open "http" At srv As #fnum TimeOut 12000
If Err Then Function = 0 : Exit Function
Tcp Print #fnum, "GET " & req & " HTTP/1.0"
Tcp Print #fnum, "Host: " & srv
Tcp Print #fnum, "User-Agent: WorldWeather/1.0"
Tcp Print #fnum, "Accept: */*"
Tcp Print #fnum, "Connection: close"
Tcp Print #fnum, ""
Do
Tcp Recv #fnum, 4096, buf$
If Len(buf$) = 0 Then Exit Do
resp$ = resp$ & buf$
If Len(resp$) > 262144 Then Exit Do
Loop
Tcp Close #fnum
If InStr(Left$(resp$, 32), " 200 ") = 0 Then Function = 0 : Exit Function
p = InStr(resp$, Chr$(13, 10, 13, 10))
If p > 0 Then
body$ = Mid$(resp$, p + 4)
Else
p = InStr(resp$, Chr$(10, 10))
If p > 0 Then body$ = Mid$(resp$, p + 2) Else body$ = resp$
End If
body$ = Utf8ToChr$(body$)
p = 1
Do
p1 = InStr(p, body$, "<item>")
If p1 = 0 Then Exit Do
p2 = InStr(p1, body$, "</item>")
If p2 = 0 Then Exit Do
Item$ = Mid$(body$, p1, p2 - p1)
title$ = DecodeXml(TagValue(Item$, "title"))
link$ = DecodeXml(TagValue(Item$, "link"))
If Len(title$) > 0 And Len(link$) > 0 Then
Incr n
gNewsTitle(n) = title$
If n >= %MAX_NEWS Then Exit Do
End If
p = p2 + 7
Loop
gNewsN = n
Function = n
End Function
Sub OpenUrl(urlText As String)
Local cmdline As String
cmdline = "cmd.exe /c start " & Chr$(34) & Chr$(34) & " " & Chr$(34) & urlText & Chr$(34)
Shell cmdline, %SW_Hide
End Sub
Sub DrawMap(hDlg As Dword, idx As Long)
Local pp As PolyPoints
Local i As Long, p As Long, k As Long, np As Long, ix As Long
Local lon As Single, lat As Single
Local s As String
Graphic Attach hDlg, %ID_MAP, ReDraw
Graphic Scale (-180, 90) - (180, -90)
Graphic Clear RGB(232, 244, 255)
' Latitude/longitude grid
Graphic Width 1
For lon = -150 To 150 Step 30
Graphic Line (lon, 90) - (lon, -90), RGB(205, 225, 240)
Next lon
For lat = -60 To 60 Step 30
Graphic Line (-180, lat) - (180, lat), RGB(205, 225, 240)
Next lat
Graphic Line (-180, 0) - (180, 0), RGB(165, 195, 220)
Graphic Line (0, 90) - (0, -90), RGB(165, 195, 220)
' Land polygons
ix = 1
p = Val(Read$(ix)) : Incr ix
For i = 1 To p
np = Val(Read$(ix)) : Incr ix
pp.n = np
For k = 1 To np
s = Read$(ix) : Incr ix
pp.xy(k).x = Val(Parse$(s, ",", 1))
pp.xy(k).y = Val(Parse$(s, ",", 2))
Next k
Graphic Polygon pp, RGB(90, 130, 90), RGB(170, 210, 160)
Next i
' Selected country: approximate bounds, capital marker and crosshair
If idx >= 1 And idx <= gN Then
Graphic Width 2
Graphic Box (gMinLon(idx), gMaxLat(idx)) - (gMaxLon(idx), gMinLat(idx)), 0, RGB(215, 30, 30)
Graphic Width 1
Graphic Ellipse (gLon(idx) - 2.4, gLat(idx) + 2.4) - (gLon(idx) + 2.4, gLat(idx) - 2.4), RGB(215, 30, 30), RGB(255, 80, 80)
Graphic Line (gLon(idx) - 6, gLat(idx)) - (gLon(idx) + 6, gLat(idx)), RGB(215, 30, 30)
Graphic Line (gLon(idx), gLat(idx) - 6) - (gLon(idx), gLat(idx) + 6), RGB(215, 30, 30)
End If
Graphic ReDraw
Data "69"
Data "262"
Data "106.97,76.97"
Data "114.13,75.85"
Data "109.40,74.18"
Data "126.98,73.57"
Data "131.29,70.79"
Data "132.25,71.84"
Data "139.87,71.49"
Data "139.15,72.42"
Data "140.47,72.85"
Data "159.00,70.87"
Data "160.94,69.44"
Data "178.60,69.40"
Data "180.00,68.96"
Data "180.00,64.98"
Data "177.41,64.61"
Data "179.49,62.57"
Data "173.68,61.65"
Data "170.33,59.88"
Data "163.54,59.87"
Data "162.02,58.24"
Data "163.19,57.62"
Data "162.12,54.86"
Data "156.79,51.01"
Data "155.91,56.77"
Data "164.47,62.55"
Data "160.12,60.54"
Data "159.30,61.77"
Data "156.72,61.43"
Data "154.22,59.76"
Data "155.04,59.15"
Data "142.20,59.04"
Data "135.13,54.73"
Data "139.90,54.19"
Data "141.38,52.24"
Data "138.22,46.31"
Data "127.53,39.76"
Data "129.46,36.78"
Data "129.09,35.08"
Data "126.49,34.39"
Data "126.86,36.89"
Data "124.71,38.11"
Data "125.32,39.55"
Data "121.05,38.90"
Data "121.64,40.95"
Data "118.04,39.20"
Data "118.91,37.45"
Data "122.36,37.45"
Data "119.15,34.91"
Data "121.91,31.69"
Data "121.68,28.23"
Data "115.89,22.78"
Data "110.79,21.40"
Data "110.44,20.34"
Data "108.52,21.72"
Data "105.88,19.75"
Data "109.34,13.43"
Data "109.20,11.67"
Data "105.16,8.60"
Data "105.08,9.92"
Data "100.10,13.41"
Data "99.22,9.24"
Data "102.96,5.52"
Data "104.23,1.29"
Data "101.39,2.76"
Data "100.09,6.46"
Data "98.34,7.79"
Data "98.76,11.44"
Data "97.16,16.93"
Data "94.19,16.04"
Data "94.32,18.21"
Data "91.42,22.77"
Data "86.98,21.50"
Data "80.32,15.90"
Data "79.86,10.36"
Data "77.54,7.97"
Data "73.53,15.99"
Data "72.63,21.36"
Data "70.47,20.88"
Data "66.37,25.43"
Data "57.40,25.74"
Data "56.49,27.14"
Data "54.72,26.48"
Data "51.52,27.87"
Data "50.12,30.15"
Data "47.97,29.98"
Data "50.81,24.75"
Data "51.59,25.80"
Data "51.79,24.02"
Data "54.01,24.12"
Data "56.36,26.40"
Data "56.85,24.24"
Data "59.81,22.31"
Data "55.27,17.23"
Data "43.48,12.64"
Data "42.65,16.77"
Data "34.63,28.06"
Data "34.92,29.50"
Data "33.92,27.65"
Data "32.42,29.85"
Data "36.87,22.00"
Data "37.48,18.61"
Data "43.32,12.39"
Data "42.72,11.74"
Data "44.61,10.44"
Data "51.11,12.02"
Data "51.05,10.64"
Data "47.74,4.22"
Data "39.20,-4.68"
Data "40.78,-14.69"
Data "34.79,-19.78"
Data "35.61,-23.71"
Data "32.57,-25.73"
Data "32.20,-28.75"
Data "25.78,-33.94"
Data "18.38,-34.14"
Data "18.22,-31.66"
Data "15.21,-27.09"
Data "14.26,-22.11"
Data "11.79,-18.07"
Data "13.69,-10.73"
Data "11.92,-5.04"
Data "8.80,-1.11"
Data "9.40,3.73"
Data "8.50,4.77"
Data "5.90,4.26"
Data "4.33,6.27"
Data "-1.96,4.71"
Data "-9.00,4.83"
Data "-16.61,12.17"
Data "-17.62,14.73"
Data "-16.15,18.11"
Data "-16.97,21.89"
Data "-14.44,26.25"
Data "-9.56,29.93"
Data "-9.30,32.56"
Data "-5.93,35.76"
Data "-2.17,35.17"
Data "9.51,37.35"
Data "11.10,36.90"
Data "10.34,33.79"
Data "19.09,30.27"
Data "21.54,32.84"
Data "28.91,30.87"
Data "33.77,30.97"
Data "36.16,36.65"
Data "27.64,36.66"
Data "26.17,39.46"
Data "33.51,42.02"
Data "38.35,40.95"
Data "41.70,41.96"
Data "36.68,45.24"
Data "39.12,47.26"
Data "34.96,46.27"
Data "36.33,45.11"
Data "33.88,44.36"
Data "32.45,45.33"
Data "33.30,46.08"
Data "30.75,46.58"
Data "27.67,42.58"
Data "28.81,41.05"
Data "22.63,40.26"
Data "24.04,37.66"
Data "23.12,37.92"
Data "22.49,36.41"
Data "19.41,40.25"
Data "19.54,41.72"
Data "13.14,45.74"
Data "12.59,44.09"
Data "18.48,40.17"
Data "16.87,40.44"
Data "16.10,37.99"
Data "15.41,40.05"
Data "8.89,44.37"
Data "3.10,43.08"
Data "-2.15,36.67"
Data "-5.38,35.95"
Data "-8.90,36.87"
Data "-9.39,43.03"
Data "-1.38,44.02"
Data "-1.19,46.01"
Data "-4.59,48.68"
Data "-1.62,48.64"
Data "-1.93,49.78"
Data "1.34,50.13"
Data "4.71,53.09"
Data "8.12,53.53"
Data "8.54,57.11"
Data "10.58,57.73"
Data "10.91,56.46"
Data "9.65,55.47"
Data "10.94,54.01"
Data "19.66,54.43"
Data "21.27,55.19"
Data "21.58,57.41"
Data "24.12,57.03"
Data "24.43,58.38"
Data "23.34,59.19"
Data "29.12,60.03"
Data "21.32,60.72"
Data "21.54,63.19"
Data "25.40,65.11"
Data "22.18,65.72"
Data "17.85,62.75"
Data "17.12,61.34"
Data "18.79,60.08"
Data "16.83,58.72"
Data "15.88,56.10"
Data "12.94,55.36"
Data "10.36,59.47"
Data "8.38,58.31"
Data "5.67,58.59"
Data "4.99,61.97"
Data "14.76,67.81"
Data "24.55,71.03"
Data "28.17,71.19"
Data "31.29,70.45"
Data "30.01,70.19"
Data "31.10,69.56"
Data "40.29,67.93"
Data "41.13,66.79"
Data "40.02,66.27"
Data "33.18,66.63"
Data "34.81,65.90"
Data "34.94,64.41"
Data "37.01,63.85"
Data "37.18,65.14"
Data "39.59,64.52"
Data "42.09,66.48"
Data "43.95,66.07"
Data "43.45,68.57"
Data "46.25,68.25"
Data "46.82,67.69"
Data "45.56,67.01"
Data "46.35,66.67"
Data "53.72,68.86"
Data "59.94,68.28"
Data "61.08,68.94"
Data "60.55,69.85"
Data "68.51,68.09"
Data "69.18,68.62"
Data "66.93,69.45"
Data "66.69,71.03"
Data "69.20,72.84"
Data "72.59,72.78"
Data "71.85,71.41"
Data "73.67,68.41"
Data "71.28,66.32"
Data "72.42,66.17"
Data "75.05,67.76"
Data "73.60,69.63"
Data "74.40,70.63"
Data "73.10,71.45"
Data "74.66,72.83"
Data "76.36,71.15"
Data "75.90,71.87"
Data "77.58,72.27"
Data "81.50,71.75"
Data "80.51,73.65"
Data "86.82,73.94"
Data "86.01,74.46"
Data "87.17,75.12"
Data "104.35,77.70"
Data "171"
Data "-90.55,69.50"
Data "-90.55,68.48"
Data "-89.22,69.26"
Data "-87.35,67.20"
Data "-85.52,69.88"
Data "-82.62,69.66"
Data "-81.28,69.16"
Data "-81.26,67.60"
Data "-85.77,66.56"
Data "-93.16,62.02"
Data "-94.68,58.95"
Data "-93.22,58.78"
Data "-92.30,57.09"
Data "-82.27,55.15"
Data "-82.12,53.28"
Data "-79.91,51.21"
Data "-78.60,52.56"
Data "-79.83,54.67"
Data "-76.54,56.53"
Data "-78.52,58.80"
Data "-77.34,59.85"
Data "-78.11,62.32"
Data "-73.84,62.44"
Data "-69.59,61.06"
Data "-69.29,58.96"
Data "-67.65,58.21"
Data "-64.58,60.34"
Data "-61.80,56.34"
Data "-57.33,54.63"
Data "-55.68,52.15"
Data "-60.03,50.24"
Data "-66.40,50.23"
Data "-71.10,46.82"
Data "-65.06,49.23"
Data "-64.17,48.74"
Data "-65.12,48.07"
Data "-64.47,46.24"
Data "-61.52,45.88"
Data "-60.52,47.01"
Data "-59.80,45.92"
Data "-65.36,43.55"
Data "-66.16,44.47"
Data "-64.43,45.29"
Data "-67.14,45.14"
Data "-70.69,43.03"
Data "-69.97,41.64"
Data "-75.53,39.50"
Data "-75.94,37.22"
Data "-76.35,39.15"
Data "-76.96,38.23"
Data "-75.73,35.55"
Data "-81.34,31.44"
Data "-80.38,25.21"
Data "-84.10,30.09"
Data "-93.85,29.71"
Data "-96.59,28.31"
Data "-97.87,22.44"
Data "-96.29,19.32"
Data "-94.43,18.14"
Data "-92.04,18.70"
Data "-90.28,21.00"
Data "-87.05,21.54"
Data "-88.93,15.89"
Data "-83.41,15.27"
Data "-83.81,11.10"
Data "-81.44,8.79"
Data "-79.57,9.61"
Data "-76.84,8.64"
Data "-74.91,11.08"
Data "-71.75,12.44"
Data "-71.70,9.07"
Data "-69.94,12.16"
Data "-68.19,10.55"
Data "-61.88,10.72"
Data "-62.39,9.95"
Data "-57.15,5.97"
Data "-51.32,4.20"
Data "-49.97,1.74"
Data "-50.39,-0.08"
Data "-44.91,-1.55"
Data "-44.58,-2.69"
Data "-39.98,-2.87"
Data "-35.60,-5.15"
Data "-34.73,-7.34"
Data "-38.67,-13.06"
Data "-40.94,-21.94"
Data "-47.65,-24.89"
Data "-48.89,-28.67"
Data "-53.81,-34.40"
Data "-58.43,-33.91"
Data "-56.79,-36.90"
Data "-59.23,-38.72"
Data "-62.34,-38.83"
Data "-62.75,-41.03"
Data "-65.12,-41.06"
Data "-63.46,-42.56"
Data "-67.29,-45.55"
Data "-65.99,-48.13"
Data "-69.14,-50.73"
Data "-68.15,-52.35"
Data "-70.85,-52.90"
Data "-71.01,-53.83"
Data "-74.95,-52.26"
Data "-75.61,-48.67"
Data "-74.13,-46.94"
Data "-75.64,-46.65"
Data "-72.72,-42.38"
Data "-74.33,-43.22"
Data "-73.59,-37.16"
Data "-71.44,-32.42"
Data "-70.16,-19.76"
Data "-71.46,-17.36"
Data "-76.01,-14.65"
Data "-81.25,-6.14"
Data "-79.77,-2.66"
Data "-80.93,-1.06"
Data "-77.13,3.85"
Data "-78.18,8.32"
Data "-79.56,8.93"
Data "-80.89,7.22"
Data "-85.66,9.93"
Data "-87.49,13.30"
Data "-103.50,18.29"
Data "-105.49,19.95"
Data "-106.03,22.77"
Data "-113.87,31.57"
Data "-114.78,31.80"
Data "-114.67,30.16"
Data "-109.41,23.36"
Data "-110.03,22.82"
Data "-112.18,24.74"
Data "-112.30,26.01"
Data "-115.06,27.72"
Data "-114.16,28.57"
Data "-117.30,33.05"
Data "-120.62,34.61"
Data "-124.40,40.31"
Data "-124.69,48.18"
Data "-122.59,47.10"
Data "-122.84,49.00"
Data "-127.44,50.83"
Data "-134.08,58.12"
Data "-147.11,60.88"
Data "-151.72,59.16"
Data "-150.62,61.28"
Data "-158.43,55.99"
Data "-164.79,54.40"
Data "-157.72,57.57"
Data "-157.04,58.92"
Data "-161.97,58.67"
Data "-161.87,59.63"
Data "-166.12,61.50"
Data "-164.56,63.15"
Data "-160.77,63.77"
Data "-160.78,64.79"
Data "-164.96,64.45"
Data "-168.11,65.67"
Data "-161.68,66.12"
Data "-166.76,68.36"
Data "-156.58,71.36"
Data "-136.50,68.90"
Data "-128.14,70.48"
Data "-108.88,67.38"
Data "-108.17,68.65"
Data "-106.15,68.80"
Data "-101.45,67.65"
Data "-97.67,68.58"
Data "-96.13,67.29"
Data "-94.23,69.07"
Data "-96.47,70.09"
Data "-95.21,71.92"
Data "57"
Data "-58.61,-64.15"
Data "-62.02,-64.80"
Data "-62.12,-66.19"
Data "-65.67,-67.95"
Data "-61.81,-70.72"
Data "-60.83,-73.70"
Data "-70.60,-76.63"
Data "-77.24,-76.71"
Data "-73.66,-77.91"
Data "-78.02,-79.18"
Data "-58.22,-83.22"
Data "-28.55,-80.34"
Data "-29.69,-79.26"
Data "-35.64,-79.46"
Data "-35.33,-78.12"
Data "-17.52,-75.13"
Data "-15.70,-74.50"
Data "-16.47,-73.87"
Data "-15.45,-73.15"
Data "-6.87,-70.93"
Data "-0.23,-71.64"
Data "7.74,-69.89"
Data "10.82,-70.83"
Data "13.42,-69.97"
Data "27.09,-70.46"
Data "33.87,-68.50"
Data "38.65,-69.78"
Data "54.53,-65.82"
Data "61.43,-67.95"
Data "68.89,-67.93"
Data "69.67,-69.23"
Data "67.81,-70.31"
Data "69.07,-70.68"
Data "67.95,-71.85"
Data "69.87,-72.26"
Data "73.86,-69.87"
Data "87.99,-66.21"
Data "95.78,-67.39"
Data "99.72,-67.25"
Data "102.83,-65.56"
Data "106.18,-66.93"
Data "113.60,-65.88"
Data "119.83,-67.27"
Data "134.76,-66.21"
Data "135.07,-65.31"
Data "137.46,-66.95"
Data "145.49,-66.92"
Data "148.84,-68.39"
Data "171.21,-71.70"
Data "163.57,-76.24"
Data "164.74,-78.18"
Data "167.00,-78.75"
Data "161.77,-79.16"
Data "159.79,-80.95"
Data "169.40,-83.83"
Data "180.00,-84.71"
Data "180.00,-90.00"
Data "33"
Data "143.56,-13.76"
Data "145.37,-14.98"
Data "146.39,-18.96"
Data "148.85,-20.39"
Data "153.14,-26.07"
Data "152.89,-31.64"
Data "150.00,-37.43"
Data "146.32,-39.04"
Data "145.03,-37.90"
Data "143.61,-38.81"
Data "140.64,-38.02"
Data "138.12,-35.61"
Data "138.21,-34.38"
Data "136.83,-35.26"
Data "137.81,-32.90"
Data "135.99,-34.89"
Data "134.27,-32.62"
Data "131.33,-31.50"
Data "118.02,-35.06"
Data "115.03,-34.20"
Data "115.69,-31.61"
Data "113.34,-26.12"
Data "114.23,-26.30"
Data "113.39,-24.38"
Data "114.15,-21.76"
Data "120.86,-19.68"
Data "125.69,-14.23"
Data "129.62,-14.97"
Data "132.36,-11.13"
Data "136.49,-11.86"
Data "135.50,-15.00"
Data "140.22,-17.71"
Data "142.14,-11.04"
Data "42"
Data "-27.10,83.52"
Data "-20.85,82.73"
Data "-31.40,82.02"
Data "-12.21,81.29"
Data "-20.05,80.18"
Data "-17.73,80.13"
Data "-19.70,78.75"
Data "-18.47,76.99"
Data "-21.68,76.63"
Data "-19.83,76.10"
Data "-20.67,75.16"
Data "-19.37,74.30"
Data "-23.57,73.31"
Data "-22.30,72.18"
Data "-24.79,72.33"
Data "-21.75,70.66"
Data "-25.54,71.43"
Data "-26.36,70.23"
Data "-22.35,70.13"
Data "-39.81,65.46"
Data "-42.82,62.68"
Data "-43.38,60.10"
Data "-48.26,60.86"
Data "-51.63,63.63"
Data "-53.97,67.19"
Data "-50.87,69.93"
Data "-54.68,69.61"
Data "-54.36,70.82"
Data "-51.39,70.57"
Data "-55.83,71.65"
Data "-54.72,72.59"
Data "-58.59,75.52"
Data "-68.50,76.06"
Data "-71.40,77.01"
Data "-66.76,77.38"
Data "-73.30,78.04"
Data "-65.71,79.39"
Data "-68.02,80.12"
Data "-62.65,81.77"
Data "-44.52,81.66"
Data "-46.76,82.63"
Data "-43.41,83.23"
Data "24"
Data "-180.00,-90.00"
Data "-180.00,-84.71"
Data "-179.06,-84.14"
Data "-143.11,-85.04"
Data "-153.59,-83.69"
Data "-152.86,-82.04"
Data "-156.84,-81.10"
Data "-146.42,-80.34"
Data "-155.33,-79.06"
Data "-158.37,-76.89"
Data "-151.33,-77.40"
Data "-146.10,-76.48"
Data "-146.20,-75.38"
Data "-144.91,-75.20"
Data "-113.94,-73.71"
Data "-112.30,-74.71"
Data "-100.65,-75.30"
Data "-103.68,-72.62"
Data "-74.89,-73.87"
Data "-67.37,-72.48"
Data "-68.54,-69.72"
Data "-67.25,-66.88"
Data "-63.00,-64.64"
Data "-57.22,-63.53"
Data "25"
Data "-86.56,73.16"
Data "-82.32,73.75"
Data "-80.75,72.06"
Data "-77.82,72.75"
Data "-72.24,71.56"
Data "-67.91,70.12"
Data "-66.97,69.19"
Data "-68.81,68.72"
Data "-61.85,66.86"
Data "-63.92,65.00"
Data "-68.02,66.26"
Data "-64.67,63.39"
Data "-68.78,63.75"
Data "-66.17,61.93"
Data "-74.83,64.68"
Data "-77.71,64.23"
Data "-78.56,64.57"
Data "-77.90,65.31"
Data "-73.96,65.45"
Data "-72.93,67.73"
Data "-78.96,70.17"
Data "-88.68,70.41"
Data "-90.21,72.24"
Data "-88.41,73.54"
Data "-85.83,73.80"
Data "15"
Data "-68.50,83.11"
Data "-61.89,82.36"
Data "-76.91,79.32"
Data "-75.39,78.53"
Data "-80.56,76.18"
Data "-89.49,76.47"
Data "-87.77,77.18"
Data "-88.26,77.90"
Data "-84.98,77.54"
Data "-87.96,78.37"
Data "-85.09,79.35"
Data "-86.93,80.25"
Data "-81.85,80.46"
Data "-87.60,80.52"
Data "-91.59,81.89"
Data "17"
Data "134.14,-1.15"
Data "135.46,-3.37"
Data "138.33,-1.70"
Data "144.58,-3.86"
Data "147.65,-6.08"
Data "147.19,-7.39"
Data "150.69,-10.58"
Data "147.91,-10.13"
Data "144.74,-7.63"
Data "142.63,-9.33"
Data "137.61,-8.41"
Data "138.67,-7.32"
Data "137.93,-5.39"
Data "132.98,-4.11"
Data "131.99,-2.82"
Data "133.70,-2.21"
Data "130.52,-0.94"
Data "11"
Data "117.88,1.83"
Data "119.00,0.90"
Data "117.81,0.78"
Data "116.15,-4.01"
Data "110.22,-2.93"
Data "109.09,-0.46"
Data "109.66,2.01"
Data "113.00,3.10"
Data "116.73,6.92"
Data "119.18,5.41"
Data "117.31,3.23"
Data "8"
Data "50.06,-13.56"
Data "50.38,-15.71"
Data "47.10,-24.94"
Data "44.04,-24.99"
Data "43.25,-22.06"
Data "44.45,-16.22"
Data "47.71,-14.59"
Data "49.19,-12.04"
Data "14"
Data "-114.17,73.12"
Data "-109.92,72.96"
Data "-108.19,71.65"
Data "-108.40,73.09"
Data "-106.52,73.08"
Data "-101.09,69.58"
Data "-102.73,69.50"
Data "-102.43,68.75"
Data "-116.11,69.17"
Data "-117.34,69.96"
Data "-112.42,70.37"
Data "-117.90,70.54"
Data "-116.11,71.31"
Data "-119.40,71.56"
Data "7"
Data "105.82,-5.85"
Data "102.58,-4.22"
Data "95.29,5.48"
Data "97.48,5.25"
Data "103.84,0.10"
Data "103.44,-0.71"
Data "106.11,-3.06"
Data "16"
Data "140.98,37.14"
Data "140.25,35.14"
Data "135.79,33.46"
Data "135.08,34.60"
Data "130.99,33.89"
Data "132.00,33.15"
Data "131.33,31.45"
Data "130.20,31.42"
Data "129.41,33.30"
Data "132.62,35.43"
Data "135.68,35.53"
Data "136.72,37.30"
Data "139.43,38.22"
Data "140.31,41.20"
Data "141.37,41.38"
Data "141.91,39.99"
Data "14"
Data "-3.01,58.63"
Data "-4.07,57.55"
Data "-1.96,57.68"
Data "-3.12,55.97"
Data "1.68,52.74"
Data "1.45,51.29"
Data "-5.25,49.96"
Data "-3.41,51.43"
Data "-5.27,51.99"
Data "-4.22,52.30"
Data "-4.58,53.50"
Data "-2.95,53.98"
Data "-6.15,56.79"
Data "-5.01,58.63"
Data "6"
Data "57.54,70.72"
Data "51.60,71.47"
Data "55.63,75.08"
Data "68.85,76.54"
Data "58.48,74.31"
Data "55.42,72.37"
Data "6"
Data "-120.46,71.40"
Data "-125.93,71.87"
Data "-123.94,73.68"
Data "-124.92,74.29"
Data "-117.56,74.19"
Data "-115.51,73.48"
Data "8"
Data "-14.51,66.46"
Data "-13.61,65.13"
Data "-18.66,63.50"
Data "-22.76,63.96"
Data "-21.78,64.40"
Data "-23.96,64.89"
Data "-22.23,65.38"
Data "-24.33,65.61"
Data "4"
Data "18.25,79.70"
Data "21.54,78.96"
Data "15.91,76.77"
Data "10.44,79.65"
Data "7"
Data "-175.01,66.58"
Data "-169.90,65.98"
Data "-172.53,65.44"
Data "-172.96,64.25"
Data "-178.69,66.11"
Data "-180.00,64.98"
Data "-180.00,68.96"
Data "4"
Data "-45.15,-78.05"
Data "-43.33,-80.03"
Data "-54.16,-80.63"
Data "-48.66,-78.05"
Data "5"
Data "173.02,-40.92"
Data "174.25,-41.35"
Data "173.08,-43.85"
Data "169.33,-46.64"
Data "166.68,-46.22"
Data "13"
Data "125.24,1.42"
Data "123.69,0.24"
Data "120.18,0.24"
Data "120.94,-1.41"
Data "123.34,-0.62"
Data "121.51,-1.90"
Data "123.16,-5.34"
Data "121.49,-4.57"
Data "120.97,-2.63"
Data "120.43,-5.53"
Data "119.37,-5.38"
Data "118.77,-2.80"
Data "120.04,0.57"
Data "5"
Data "-94.68,77.10"
Data "-79.83,74.92"
Data "-92.42,74.84"
Data "-93.89,76.32"
Data "-97.12,76.75"
Data "4"
Data "-87.02,79.66"
Data "-90.80,78.22"
Data "-96.71,80.16"
Data "-92.41,81.26"
Data "9"
Data "-56.13,50.69"
Data "-56.80,49.81"
Data "-53.48,49.25"
Data "-53.07,46.66"
Data "-54.24,47.75"
Data "-55.40,46.88"
Data "-59.27,47.60"
Data "-57.36,50.72"
Data "-55.87,51.63"
Data "9"
Data "-108.21,76.20"
Data "-105.88,75.97"
Data "-106.31,75.01"
Data "-113.74,74.39"
Data "-111.79,75.16"
Data "-117.71,75.22"
Data "-115.40,76.48"
Data "-109.07,75.47"
Data "-110.50,76.43"
Data "7"
Data "174.61,-36.16"
Data "176.76,-37.88"
Data "178.52,-37.70"
Data "175.24,-41.69"
Data "173.82,-39.51"
Data "174.70,-37.38"
Data "172.64,-34.53"
Data "8"
Data "143.65,50.75"
Data "144.65,48.98"
Data "143.17,49.31"
Data "142.56,47.86"
Data "143.51,46.14"
Data "142.09,45.97"
Data "141.68,53.30"
Data "142.65,54.37"
Data "7"
Data "-68.45,-70.96"
Data "-68.78,-72.17"
Data "-71.08,-72.50"
Data "-75.01,-71.66"
Data "-72.07,-71.19"
Data "-71.74,-69.51"
Data "-70.25,-68.88"
Data "5"
Data "143.91,44.17"
Data "145.32,44.38"
Data "145.54,43.26"
Data "139.96,41.57"
Data "141.97,45.55"
Data "6"
Data "108.62,-6.78"
Data "110.76,-6.47"
Data "115.71,-8.37"
Data "108.28,-7.77"
Data "105.37,-6.85"
Data "106.05,-5.90"
Data "4"
Data "99.94,78.88"
Data "91.18,80.34"
Data "95.94,81.25"
Data "100.19,79.78"
Data "6"
Data "-67.75,-53.85"
Data "-65.05,-54.70"
Data "-69.23,-55.50"
Data "-74.66,-52.84"
Data "-71.11,-54.07"
Data "-69.35,-52.52"
Data "5"
Data "-6.79,52.26"
Data "-9.98,51.82"
Data "-9.69,53.88"
Data "-6.73,55.17"
Data "-5.66,54.55"
Data "6"
Data "121.32,18.50"
Data "122.52,17.09"
Data "121.73,14.33"
Data "123.95,13.78"
Data "124.08,12.54"
Data "120.07,14.97"
Data "8"
Data "-79.68,22.77"
Data "-74.18,20.28"
Data "-77.76,19.86"
Data "-77.09,20.41"
Data "-78.72,21.60"
Data "-81.80,22.64"
Data "-84.97,21.90"
Data "-82.27,23.19"
Data "3"
Data "-85.16,65.66"
Data "-80.10,63.73"
Data "-87.22,63.54"
Data "8"
Data "-100.36,73.84"
Data "-97.38,73.76"
Data "-98.05,72.99"
Data "-96.54,72.56"
Data "-96.72,71.66"
Data "-102.50,72.51"
Data "-100.44,72.71"
Data "-101.54,73.36"
Data "5"
Data "126.38,8.41"
Data "125.40,5.58"
Data "123.61,7.83"
Data "121.92,7.19"
Data "125.41,9.76"
Data "4"
Data "145.40,-40.79"
Data "148.29,-40.88"
Data "147.91,-43.21"
Data "146.05,-43.55"
Data "4"
Data "25.45,80.41"
Data "27.41,80.06"
Data "23.02,79.40"
Data "17.37,80.32"
Data "4"
Data "-98.50,76.72"
Data "-98.16,75.00"
Data "-102.50,75.56"
Data "-102.57,76.34"
Data "6"
Data "-72.58,19.87"
Data "-68.32,18.61"
Data "-73.92,18.03"
Data "-74.37,18.66"
Data "-72.33,18.67"
Data "-73.42,19.64"
Data "4"
Data "-93.20,72.77"
Data "-95.41,72.06"
Data "-96.02,73.44"
Data "-90.51,73.86"
Data "4"
Data "81.22,6.20"
Data "79.87,6.76"
Data "80.15,9.82"
Data "81.79,7.52"
Data "3"
Data "105.08,78.31"
Data "99.44,77.92"
Data "102.09,79.35"
Data "3"
Data "145.09,75.56"
Data "136.97,75.26"
Data "138.83,76.14"
Data "3"
Data "-59.57,-80.04"
Data "-60.16,-81.00"
Data "-66.29,-80.26"
Data "3"
Data "-116.20,77.65"
Data "-117.11,76.53"
Data "-122.85,76.12"
Data "3"
Data "15.52,38.23"
Data "15.10,36.62"
Data "12.43,37.61"
Data "4"
Data "9.21,41.21"
Data "9.67,39.18"
Data "8.81,38.91"
Data "8.16,40.95"
Data "4"
Data "110.34,18.68"
Data "108.66,18.51"
Data "108.63,19.37"
Data "110.79,20.08"
Data "4"
Data "124.44,-10.14"
Data "123.46,-10.24"
Data "123.98,-9.29"
Data "127.34,-8.40"
Data "4"
Data "121.18,22.79"
Data "120.75,21.97"
Data "120.11,23.56"
Data "121.50,25.30"
Data "5"
Data "123.98,10.28"
Data "123.00,9.02"
Data "122.38,9.71"
Data "122.95,10.88"
Data "124.08,11.23"
Data "4"
Data "-100.06,78.32"
Data "-105.18,78.38"
Data "-104.21,78.68"
Data "-105.49,79.30"
Data "3"
Data "-95.65,69.11"
Data "-99.80,69.40"
Data "-98.22,70.14"
Data "3"
Data "125.50,12.16"
Data "124.80,10.13"
Data "124.27,12.56"
Data "3"
Data "128.69,1.13"
Data "128.10,-0.90"
Data "127.60,1.81"
Data "3"
Data "-58.55,-51.10"
Data "-58.05,-51.90"
Data "-61.20,-51.85"
Data "4"
Data "-75.87,67.15"
Data "-77.24,67.59"
Data "-75.90,68.29"
Data "-75.10,67.58"
Data "3"
Data "130.47,-3.09"
Data "130.83,-3.86"
Data "127.90,-3.39"
Data "4"
Data "151.98,-5.48"
Data "148.32,-5.75"
Data "150.81,-5.46"
Data "151.54,-4.17"
Data "3"
Data "-132.71,54.04"
Data "-131.75,54.12"
Data "-131.18,52.18"
Data "3"
Data "70.28,-49.71"
Data "68.75,-49.77"
Data "68.94,-48.62"
Data "3"
Data "12.69,55.61"
Data "12.09,54.80"
Data "10.90,55.78"
Data "3"
Data "-153.01,57.12"
Data "-154.67,57.46"
Data "-152.56,57.90"
Data "3"
Data "-178.69,70.89"
Data "-180.00,71.52"
Data "-177.58,71.27"
End Sub
Sub ShowWeather(hDlg As Dword, idx As Long)
Local latdir As String, londir As String
Local coord As String, weather As String, msg As String
latdir = "N" : If gLat(idx) < 0 Then latdir = "S"
londir = "E" : If gLon(idx) < 0 Then londir = "W"
coord = Format$(Abs(gLat(idx)), "0.0000") & " " & latdir & ", " & _
Format$(Abs(gLon(idx)), "0.0000") & " " & londir
msg = gName(idx) & $CrLf & _
"Capital: " & gCap(idx) & " (" & coord & ")" & $CrLf & $CrLf & _
"Fetching current weather from wttr.in ..."
Control Set Text hDlg, %ID_TEXT, msg
Dialog ReDraw hDlg
weather = GetWeather(gLat(idx), gLon(idx))
msg = gName(idx) & $CrLf & _
"Capital: " & gCap(idx) & " (" & coord & ")" & $CrLf & $CrLf & _
"Current weather: " & weather & $CrLf & $CrLf & _
"Source: wttr.in - live current conditions." & $CrLf & _
"Map: red outline = approximate country bounds; red circle = capital."
gInfoText = msg
Control Set Text hDlg, %ID_TEXT, msg
Dialog ReDraw hDlg
End Sub
CallBack Function NewsProc() As Long
Local idx As Long
Local q As String, gurl As String
Select Case Cb.Msg
Case %WM_Command
If Cb.Ctl = %ID_NEWS_LIST And Cb.CtlMsg = %LBN_SelChange Then
ListBox Get Select Cb.Hndl, %ID_NEWS_LIST To idx
If idx >= 1 And idx <= gNewsN Then
q = gNewsLabel & " " & gNewsTitle(idx)
gurl = "https://www.google.com/search?q=" & UrlEncode(q)
OpenUrl gurl
ListBox Unselect Cb.Hndl, %ID_NEWS_LIST, idx
End If
ElseIf Cb.Ctl = %ID_NEWS_CLOSE And Cb.CtlMsg = %BN_Clicked Then
Dialog End Cb.Hndl, 1
End If
End Select
Function = 0
End Function
Sub ShowNewsPopup(hParent As Dword, lbl As String, n As Long)
Local hNews As Dword
Local i As Long
Dialog New Pixels, hParent, "News - " & lbl, , , 760, 480, _
%WS_Caption Or %WS_SysMenu To hNews
Control Add Label, hNews, -1, "Click a headline to search Google for the article:", 12, 10, 700, 16
Control Add ListBox, hNews, %ID_NEWS_LIST, , 12, 32, 736, 438, _
%WS_VScroll Or %WS_HScroll Or %LBS_Notify Or %WS_TabStop
For i = 1 To n
ListBox Add hNews, %ID_NEWS_LIST, gNewsTitle(i)
Next i
Control Add Button, hNews, %ID_NEWS_CLOSE, "Close", 650, 442, 90, 28, _
%BS_Default Or %WS_TabStop
Dialog Show Modal hNews, Call NewsProc
End Sub
Sub ShowNews(hParent As Dword)
Local idx As Long, n As Long
Local query As String, lbl As String
ListBox Get Select hParent, %ID_LIST To idx
If idx >= 1 And idx <= gN Then
query = gName(idx)
lbl = gName(idx)
Else
query = "world news today"
lbl = "World"
End If
gNewsLabel = lbl
Control Set Text hParent, %ID_TEXT, "Fetching current news for " & lbl & " ..."
Dialog ReDraw hParent
n = GetNews(query)
If n = 0 Then
MsgBox "Not Found", %MB_IconInformation, "News - " & lbl
Else
ShowNewsPopup hParent, lbl, n
End If
Control Set Text hParent, %ID_TEXT, gInfoText
Dialog ReDraw hParent
End Sub
Sub ShowHistory(hParent As Dword)
Local idx As Long
Local q As String, gurl As String
ListBox Get Select hParent, %ID_LIST To idx
If idx < 1 Or idx > gN Then
MsgBox "Select a country first.", %MB_IconInformation, "History"
Exit Sub
End If
q = gName(idx) & " history"
gurl = "https://www.google.com/search?q=" & UrlEncode(q)
OpenUrl gurl
End Sub
Sub ShowYouTube(hParent As Dword)
Local idx As Long
Local q As String, gurl As String
ListBox Get Select hParent, %ID_LIST To idx
If idx < 1 Or idx > gN Then
MsgBox "Select a country first.", %MB_IconInformation, "YouTube"
Exit Sub
End If
q = gName(idx)
gurl = "https://www.youtube.com/results?search_query=" & UrlEncode(q)
OpenUrl gurl
End Sub
Sub ShowGeography(hParent As Dword)
Local idx As Long
Local q As String, gurl As String
ListBox Get Select hParent, %ID_LIST To idx
If idx < 1 Or idx > gN Then
MsgBox "Select a country first.", %MB_IconInformation, "Geography"
Exit Sub
End If
q = gName(idx) & " geography"
gurl = "https://www.google.com/search?q=" & UrlEncode(q)
OpenUrl gurl
End Sub
Sub ShowMaps(hParent As Dword)
Local idx As Long
Local q As String, gurl As String
ListBox Get Select hParent, %ID_LIST To idx
If idx < 1 Or idx > gN Then
MsgBox "Select a country first.", %MB_IconInformation, "Maps"
Exit Sub
End If
q = gName(idx) & " country map"
gurl = "https://www.google.com/search?q=" & UrlEncode(q)
OpenUrl gurl
End Sub
Sub ShowEconomy(hParent As Dword)
Local idx As Long
Local q As String, gurl As String
ListBox Get Select hParent, %ID_LIST To idx
If idx < 1 Or idx > gN Then
MsgBox "Select a country first.", %MB_IconInformation, "Economy"
Exit Sub
End If
q = gName(idx) & " economy"
gurl = "https://www.google.com/search?q=" & UrlEncode(q)
OpenUrl gurl
End Sub
Sub ShowConflicts(hParent As Dword)
Local idx As Long
Local q As String, gurl As String
ListBox Get Select hParent, %ID_LIST To idx
If idx < 1 Or idx > gN Then
MsgBox "Select a country first.", %MB_IconInformation, "Current Conflicts"
Exit Sub
End If
q = gName(idx) & " current conflicts ongoing armed conflict"
gurl = "https://www.google.com/search?q=" & UrlEncode(q)
OpenUrl gurl
End Sub
Sub ShowClimate(hParent As Dword)
Local idx As Long
Local q As String, gurl As String
ListBox Get Select hParent, %ID_LIST To idx
If idx < 1 Or idx > gN Then
MsgBox "Select a country first.", %MB_IconInformation, "Climate"
Exit Sub
End If
q = "climate of " & gName(idx)
gurl = "https://www.google.com/search?q=" & UrlEncode(q)
OpenUrl gurl
End Sub
Sub ShowCulture(hParent As Dword)
Local idx As Long
Local q As String, gurl As String
ListBox Get Select hParent, %ID_LIST To idx
If idx < 1 Or idx > gN Then
MsgBox "Select a country first.", %MB_IconInformation, "Culture"
Exit Sub
End If
q = "culture of " & gName(idx)
gurl = "https://www.google.com/search?q=" & UrlEncode(q)
OpenUrl gurl
End Sub
CallBack Function DlgProc() As Long
Local idx As Long
Select Case Cb.Msg
Case %WM_Command
If Cb.Ctl = %ID_LIST And Cb.CtlMsg = %LBN_SelChange Then
ListBox Get Select Cb.Hndl, %ID_LIST To idx
If idx >= 1 And idx <= gN Then
DrawMap Cb.Hndl, idx
ShowWeather Cb.Hndl, idx
End If
ElseIf Cb.Ctl = %ID_NEWS And Cb.CtlMsg = %BN_Clicked Then
ShowNews Cb.Hndl
ElseIf Cb.Ctl = %ID_HISTORY And Cb.CtlMsg = %BN_Clicked Then
ShowHistory Cb.Hndl
ElseIf Cb.Ctl = %ID_YOUTUBE And Cb.CtlMsg = %BN_Clicked Then
ShowYouTube Cb.Hndl
ElseIf Cb.Ctl = %ID_GEOGRAPHY And Cb.CtlMsg = %BN_Clicked Then
ShowGeography Cb.Hndl
ElseIf Cb.Ctl = %ID_MAPS And Cb.CtlMsg = %BN_Clicked Then
ShowMaps Cb.Hndl
ElseIf Cb.Ctl = %ID_ECONOMY And Cb.CtlMsg = %BN_Clicked Then
ShowEconomy Cb.Hndl
ElseIf Cb.Ctl = %ID_CONFLICTS And Cb.CtlMsg = %BN_Clicked Then
ShowConflicts Cb.Hndl
ElseIf Cb.Ctl = %ID_CLIMATE And Cb.CtlMsg = %BN_Clicked Then
ShowClimate Cb.Hndl
ElseIf Cb.Ctl = %ID_CULTURE And Cb.CtlMsg = %BN_Clicked Then
ShowCulture Cb.Hndl
End If
End Select
Function = 0
End Function
Function PBMain() As Long
Local hDlg As Dword
Local i As Long
SetProcessDPIAware
Dim gName(1 To %MAX_COUNTRIES) As String
Dim gCap(1 To %MAX_COUNTRIES) As String
Dim gLat(1 To %MAX_COUNTRIES) As Single
Dim gLon(1 To %MAX_COUNTRIES) As Single
Dim gMinLat(1 To %MAX_COUNTRIES) As Single
Dim gMaxLat(1 To %MAX_COUNTRIES) As Single
Dim gMinLon(1 To %MAX_COUNTRIES) As Single
Dim gMaxLon(1 To %MAX_COUNTRIES) As Single
Dim gNewsTitle(1 To %MAX_NEWS) As String
Dialog Default Font "Segoe UI", 11
LoadCountries
If gN = 0 Then
MsgBox "Country data could not be loaded.", %MB_IconError, "World Weather"
Exit Function
End If
Dialog New Pixels, 0, "World Weather - Countries and Current Conditions", , , 1000, 742, _
%WS_Caption Or %WS_SysMenu Or %WS_MinimizeBox To hDlg
Control Add ListBox, hDlg, %ID_LIST, , 10, 10, 250, 722, _
%WS_VScroll Or %LBS_Notify Or %WS_TabStop
For i = 1 To gN
ListBox Add hDlg, %ID_LIST, gName(i)
Next i
Control Add Graphic, hDlg, %ID_MAP, "", 270, 10, 720, 360
Control Add TextBox, hDlg, %ID_TEXT, "", 270, 380, 720, 270, _
%ES_MultiLine Or %ES_AutoVScroll Or %WS_VScroll Or %ES_ReadOnly Or %WS_TabStop
Control Add Button, hDlg, %ID_NEWS, "&News", 270, 660, 138, 32, %WS_TabStop
Control Add Button, hDlg, %ID_HISTORY, "&History", 416, 660, 138, 32, %WS_TabStop
Control Add Button, hDlg, %ID_YOUTUBE, "&YouTube", 562, 660, 138, 32, %WS_TabStop
Control Add Button, hDlg, %ID_GEOGRAPHY, "&Geography", 708, 660, 138, 32, %WS_TabStop
Control Add Button, hDlg, %ID_MAPS, "&Maps", 854, 660, 138, 32, %WS_TabStop
Control Add Button, hDlg, %ID_ECONOMY, "&Economy", 270, 700, 138, 32, %WS_TabStop
Control Add Button, hDlg, %ID_CLIMATE, "&Climate", 416, 700, 138, 32, %WS_TabStop
Control Add Button, hDlg, %ID_CULTURE, "&Culture", 562, 700, 138, 32, %WS_TabStop
Control Add Button, hDlg, %ID_CONFLICTS, "&Current Conflicts", 708, 700, 138, 32, %WS_TabStop
Control Set Color hDlg, %ID_LIST, RGB(20, 30, 50), RGB(250, 250, 245)
Control Set Color hDlg, %ID_TEXT, RGB(20, 30, 50), RGB(250, 250, 245)
gInfoText = "Select a country from the list." & $CrLf & $CrLf & _
"The world map marks the country and its capital. Current weather is shown in Celsius and Fahrenheit." & $CrLf & _
"Click News for current headlines about the selected country." & $CrLf & _
"Click History for a Google search about the selected country's history." & $CrLf & _
"Click YouTube to search YouTube for the selected country." & $CrLf & _
"Click Geography for a Google search about the selected country's geography." & $CrLf & _
"Click Maps for a Google search for a map of the selected country." & $CrLf & _
"Click Economy for a Google search about the selected country's economy." & $CrLf & _
"Click Climate for a Google search about the climate of the selected country." & $CrLf & _
"Click Culture for a Google search about the culture of the selected country." & $CrLf & _
"Click Current Conflicts for a Google search on current conflicts in the selected country."
Control Set Text hDlg, %ID_TEXT, gInfoText
DrawMap hDlg, 0
Dialog Show Modal hDlg, Call DlgProc
Function = 0
End Function
|