{"id":355,"date":"2022-01-21T14:10:48","date_gmt":"2022-01-21T13:10:48","guid":{"rendered":"https:\/\/wiskunst.hjgsoft.nl\/?page_id=355"},"modified":"2022-01-24T09:23:11","modified_gmt":"2022-01-24T08:23:11","slug":"resources-in-delphi","status":"publish","type":"page","link":"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/resources-in-delphi\/","title":{"rendered":"Resources in Delphi"},"content":{"rendered":"<h2>Inleiding<\/h2>\n<p>Dit hoofdstuk gaat over het gebruik van (niet standaard\/delphi) resources.<\/p>\n<p>Een resources kan van alles zijn: bitmaps, icons, cursors, avi&#8217;s, wav&#8217;s etc. etc..<\/p>\n<p>Een programma kan gebruik maken van externe resources, maar ook van interne resources, ofwel resources die in de exe-cutable zijn gelinkt.<\/p>\n<p>Hier gaan we het over die laatste categorie hebben, en noemen ze kortweg resources.<\/p>\n<p>In dit hoofdstuk leer je:<\/p>\n<ul>\n<li><a href=\"https:\/\/wiskunst.nl\/index.php\/delphi-lazarus\/resources-in-delphi\/#1\">Voor- en nadelen van resources<\/a><\/li>\n<li><a href=\"https:\/\/wiskunst.nl\/index.php\/delphi-lazarus\/resources-in-delphi\/#2\">Stappenplan:<\/a>\n<ul>\n<li><a href=\"https:\/\/wiskunst.nl\/index.php\/delphi-lazarus\/resources-in-delphi\/#3\">Verzamelen van resources<\/a><\/li>\n<li><a href=\"https:\/\/wiskunst.nl\/index.php\/delphi-lazarus\/resources-in-delphi\/#4\">Resource-script maken<\/a>\n<ul>\n<li><a href=\"https:\/\/wiskunst.nl\/index.php\/delphi-lazarus\/resources-in-delphi\/#5\">Soorten resources<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"https:\/\/wiskunst.nl\/index.php\/delphi-lazarus\/resources-in-delphi\/#6\">Resource-script compileren<\/a><\/li>\n<li><a href=\"https:\/\/wiskunst.nl\/index.php\/delphi-lazarus\/resources-in-delphi\/#7\">Resource-file linken<\/a><\/li>\n<li><a href=\"https:\/\/wiskunst.nl\/index.php\/delphi-lazarus\/resources-in-delphi\/#8\">Resources gebruiken<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><a name=\"1\"><\/a><\/p>\n<h2>Voor- en nadelen van resources<\/h2>\n<p>Het grote voordeel van het gebruik van (interne) resources is dat je je project kunt beperken tot 1 exe-cutable.<br \/>\nHet is dus niet noodzakelijk om alle resources apart te distribueren.<br \/>\nEen ander groot voordeel is, dat je met behulp van resources je applicatie taal-afhankelijk kunt maken.<\/p>\n<p>Nadelen zijn dat je exe-cutable een stuk groter wordt, het moet uiteindelijk allemaal in 1 exe-file zitten.<br \/>\nEn een ander groot nadeel is dat het gebruik van resources verre van gestandaardiseerd is.<br \/>\nEn met name over dat laatste aspect is dit hoofdstuk zeer nuttig, omdat ik de meest voorkomende resources in een voorbeeld zal behandelen.<\/p>\n<p>Kijk alvast eens naar het eindresultaat van het voorbeeld, dan krijg je hopelijk al een beeld van wat er zoal mogelijk is.<\/p>\n<p><a name=\"2\"><\/a><\/p>\n<h2>Stappenplan<\/h2>\n<p>Om met resources te kunnen werken kun je het volgende stappenplan volgen:<\/p>\n<p>&#8211; Verzamel alle resources die je nodig hebt op 1 plek, ofwel in 1 map<br \/>\n&#8211; Maak een resource-script<br \/>\n&#8211; Compileer het resource-script<br \/>\n&#8211; Link het resource-bestand<br \/>\n&#8211; Gebruik het resource-bestand<\/p>\n<p>Om alle problemen te omzeilen kan het handig zijn om het programma brcc32.exe ook in de map te plaatsen.<br \/>\nBrcc32.exe is de resource-compiler die je in de Bin-map van Delphi kunt vinden.<\/p>\n<p><a name=\"3\"><\/a><\/p>\n<h3>Verzamelen van resources<\/h3>\n<p>Maak een project-map waar je alles in verzameld wat met het project te maken heeft.<br \/>\nMaak dus copieen van bestanden die elders op je schijf staan.<br \/>\nDit voorkomt straks dat je (waar dan ook) een pad mee op moet geven, wat alleen maar tot verwarring kan leiden, of erger tot het niet goed functioneren van bijvoorbeeld de compiler.<\/p>\n<p>&#8211;\u00a0<i>Maak een map waarin je het voorbeeld kunt gaan uitwerken<\/i><br \/>\n&#8211;\u00a0<i>Download de\u00a0<a href=\"https:\/\/wiskunst.nl\/wp-content\/uploads\/2022\/01\/resources.zip\">resources<\/a>\u00a0en pak ze in de zojuist gemaakte map uit<\/i><\/p>\n<p><a name=\"4\"><\/a><\/p>\n<h3>Resource-script maken<\/h3>\n<p>Een resource-script is een tekstbestandje die je maakt voor de resource-compiler.<br \/>\nDe compiler maakt daar dan de binaire resource-file van.<br \/>\nLeer je meteen aan om alles, bahlve strings tussen &#8220;-tjes, in HOOFDLETTERS te tikken, ook dit voorkomt weer problemen met de compiler.<\/p>\n<p>De standaard extensie voor een resource-script is .rs, maar dit is niet strikt noodzakelijk.<\/p>\n<p>De inhoud van een resource-bestand is meestal als volgt opgebouwd:<\/p>\n<p>&lt;IDENTIFIER&gt; &lt;TYPE&gt; &lt;BESTAND&gt;|&#8221;&lt;bestand&gt;&#8221;<\/p>\n<p>waarbij &lt;IDENTIFIER&gt; de naam van de resource is zoals je die later in je Delphi-project aanroept, &lt;TYPE&gt; het type van de resource aangeeft, en &lt;BESTAND&gt; of &#8220;&lt;bestand&#8221;&gt; de naam van het resource-bestand is.<\/p>\n<p><a name=\"5\"><\/a><\/p>\n<h3>Soorten resources<\/h3>\n<p>De soorten of types van resources zijn:<\/p>\n<p>&#8211; ICON, voor iconen<br \/>\n&#8211; BITMAP, voor bitmaps<br \/>\n&#8211; WAVE, voor wav&#8217;s<br \/>\n&#8211; AVI, voor avi&#8217;s<br \/>\n&#8211; RCDATA, voor bv. mp3&#8217;s<br \/>\n&#8211; JPEG, voor jpg&#8217;s<br \/>\n&#8211; CURSOR, voor cursors<br \/>\n&#8211; STRINGTABLE BEGIN [nummer],[&#8220;string&#8221;] END, voor string&#8217;s<\/p>\n<p>De laatst genoemde is vooral handig als je je project meertalig wilt maken.<\/p>\n<p>&#8211;\u00a0<i>Open het kladblok of een andere tekst-editor<\/i><br \/>\n&#8211;\u00a0<i>Tik de volgende tekst:<\/i><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">STRINGTABLE<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">BEGIN<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">1000,&#8221;&amp;Bestand&#8221;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">1010,&#8221;&amp;Laden&#8221;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">1020,&#8221;-&#8220;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">1030,&#8221;&amp;Afsluiten&#8221;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">1100,&#8221;&amp;Hulp&#8221;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">1110,&#8221;&amp;CopyRight&#8221;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">2000,&#8221;&amp;File&#8221;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">2010,&#8221;&amp;Open&#8221;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">2020,&#8221;-&#8220;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">2030,&#8221;E&amp;xit&#8221;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">2100,&#8221;&amp;Help&#8221;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">2110,&#8221;&amp;CopyRight&#8221;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">END<\/span><\/p>\n<p>&#8211;\u00a0<i>Bewaar dit bestand onder de naam menu.rc in de map<\/i><\/p>\n<p>Dit is natuurlijk het script voor het menu van ons voorbeeld. Ons voorbeeld wordt zowel in het Nederlands als in het Engels uitgevoerd.<\/p>\n<p><a name=\"6\"><\/a><\/p>\n<h3>Resource-script compileren<\/h3>\n<p>Om van een resource-script een binair resource-bestand te maken moet je gebruik maken van een resource-compiler.<\/p>\n<p>In dit voorbeeld maken we gebruik van de Borland-resource-compiler brcc32.exe, die 32-bits resource-files maakt. Een resource-file heeft standaard .RES als extensie.<\/p>\n<p>&#8211;\u00a0<i>Copieer de brcc32.exe compiler uit de bin-directory van Delphi naar je eigen map<\/i><br \/>\n&#8211;\u00a0<i>Open een DOS-box (Start&#8211;&gt;Uitvoeren&#8230;: cmd) en activeer daarin je map(cd &#8230;)<\/i><br \/>\n&#8211;\u00a0<i>Tik in: brcc32 menu.rc<\/i><\/p>\n<p>Als het goed is staat er nu ook het bestand menu.RES in je map.<\/p>\n<p>(Om je nu een hoop tikwerk te besparen kun je hier alle <a href=\"https:\/\/wiskunst.nl\/wp-content\/uploads\/2022\/01\/resource_scripts.zip\">resource-scripts<\/a> downloaden.)<\/p>\n<p>&#8211;\u00a0<i>Pak ze uit en compileer ze<\/i><br \/>\n&#8211;\u00a0<i>Open de rc-files ook even in je tekst-editor &#8220;ter leering ende vermaek&#8221;<\/i><\/p>\n<p>Wat je hopelijk is opgevallen is dat je bij het ene type de bestandnaam tussen &#8220;-tjes moet zetten, en de andere keer niet. Dit is helaas niet consequent en zal vermoedelijk te maken hebben met de ontwikkeling van resource-files.<br \/>\nHet internet is natuurlijk een dankbare bron voor als je er niet uitkomt.<\/p>\n<p>Voor alle duidelijkheid zal ik hieronder bij elk type aangeven of het bestand wel of niet tussen &#8220;-tjes moet staan.<\/p>\n<table style=\"border-collapse: collapse; width: 100%;\">\n<tbody>\n<tr>\n<td style=\"width: 50%;\">TYPE<\/td>\n<td style=\"width: 50%;\">WEL\/NIET tussen &#8220;-tjes<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 50%;\">AVI<\/td>\n<td style=\"width: 50%;\">NIET<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 50%;\">BITMAP<\/td>\n<td style=\"width: 50%;\">NIET<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 50%;\">CURSOR<\/td>\n<td style=\"width: 50%;\">WEL<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 50%;\">ICON<\/td>\n<td style=\"width: 50%;\">NIET<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 50%;\">JPEG<\/td>\n<td style=\"width: 50%;\">NIET<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 50%;\">RCDATA<\/td>\n<td style=\"width: 50%;\">NIET<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 50%;\">RT_HTML DEISCARDABLE<\/td>\n<td style=\"width: 50%;\">WEL<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 50%;\">WAVE<\/td>\n<td style=\"width: 50%;\">WEL<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><a name=\"7\"><\/a><\/p>\n<h3>Resource-file linken<\/h3>\n<p>Het linken van een resource-file in Delphi is werkelijk gemakkelijk.<\/p>\n<p>In het implementation-gedeelte van je Unit staat reeds {$R *.DFM}.<\/p>\n<p>Met de compiler-directive $R link je een resource in je project.<\/p>\n<p>Dus om nu het resource-bestand menu.RES te linken gebruik je {$R menu.RES}, en deze regel kan direct onder de regel met {$R *.DFM}.<\/p>\n<p>Was alles maar zo gemakkelijk, niet waar?<\/p>\n<p><a name=\"8\"><\/a><\/p>\n<h3>Resources gebruiken<\/h3>\n<p>Tot nog toe was het allemaal nog niet zo ingewikkeld.<br \/>\nMaar dat gaat gelukkig nu veranderen.<\/p>\n<p>In Delphi kun je alle tot nog toe behandelde type resources in je project gebruiken, maar dat gaat helaas niet op een eenduidige manier.<\/p>\n<p>Soms heeft Delphi zelf routines in huis om gebruik te maken van resources, en in andere gevallen zullen we onze toevlucht moeten nemen tot Windows-API&#8217;s.<\/p>\n<p>Laten we maar eens beginnen.<\/p>\n<p>&#8211;\u00a0<i>Open Delphi met een nieuw project<\/i><br \/>\n&#8211;\u00a0<i>Bewaar het project in je resource-map<\/i><br \/>\n&#8211;\u00a0<i>Zet een MainMenu-component op je form<\/i><br \/>\n&#8211;\u00a0<i>Zorg ervoor dat het menu er als volgt uitziet:<\/i><\/p>\n<p>Hoofmenu-items: &amp;Bestand (mnuBestand), &amp;Hulp (menuHulp)<br \/>\nSubmenu-items van &amp;Bestand: &amp;Laden (mnuBestandLaden), &#8211; (mnuBestandSep1), &amp;Afsluiten (mnuBestandAfsluiten)<br \/>\nSubmenu-items van &amp;Hulp: &amp;Copyright (mnuHulpCopyright)<\/p>\n<p>Tussen haakjes staat steeds de naam van het item.<\/p>\n<p>Overigens zijn de Captions niet echt interessant, want die worden straks toch overschreven door de waarde&#8217;s die in menu.RES staan.<\/p>\n<p>&#8211;\u00a0<i>Voeg in de implementation-sectie onder de regel met {$R *.DFM} de volgende regel toe:<\/i><br \/>\n<span style=\"font-family: courier new; font-size: small;\"><b>{$R menu.RES}<\/b><\/span><br \/>\n&#8211;\u00a0<i>Definieer 2 constanten: c_NL en c_UK met respectievelijk de waarden 1000 en 2000<\/i><br \/>\n&#8211;\u00a0<i>Declareer een variabele vTaal van het type integer<\/i><br \/>\n&#8211;\u00a0<i>Zet een RadioGroup-component op je form met als Caption &#8216;Taal&#8217;, Name &#8216;rgrTaal&#8217;, en met de volgende items:<\/i><br \/>\nNL en UK<br \/>\n&#8211;\u00a0<i>Implementeer het Click-event van rgrTaal als volgt:<\/i><\/p>\n<p><span style=\"font-family: courier new; font-size: small;\"><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">procedure TForm1.rgrTaalClick(Sender: TObject);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 if rgrTaal.ItemIndex = 0 then<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 vTaal := c_NL<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 else<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 vTaal := c_UK;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 UpdateTaal;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">end;<\/span><b><br \/>\n<\/b><\/span><br \/>\nDe procedure UpdateTaal moeten we nog maken. Het is de bedoeling om alles waar maar tekst aan te pas komt, dit wordt aangepast aan de gekozen taal: dus alles in het Nederlands of in het Engels.<\/p>\n<p>Op dit moment hebben we allen menu.RES tot onze beschikking, dus dat kunnen we dan ook als enige hier aanpassen.<\/p>\n<p>&#8211;\u00a0<i>Zet in de definitie van TForm1, in de Private-clausule de volgende declaratie:<\/i><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">procedure UpdateTaal;<\/span><\/p>\n<p>&#8211;\u00a0<i>Implementeer de procedure UpdateTaal als volgt:<\/i><\/p>\n<p><span style=\"font-family: courier new; font-size: small;\"><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">procedure TForm1.UpdateTaal;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 mnuBestand.Caption := LoadStr(vTaal);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 mnuBestandLaden.Caption := LoadStr(vTaal + 10);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 mnuBestandAfsluiten.Caption := LoadStr(vTaal+30);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 mnuHulp.Caption := LoadStr(vTaal+100);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 mnuHulpCopyright.Caption := LoadStr(vTaal+110);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">end;<\/span><b><br \/>\n<\/b><\/span><br \/>\nMet de functie LoadStr() haal je een string op uit\u00a0<i>de<\/i>\u00a0stringtabel. Ik gebruik hier expres het woordje DE voor stringtabel, want Delphi kan maar met 1 stringtabel werken. Je mag best meer resource-files met stringtabel&#8217;s linken, maar Delphi maakt daar 1 groete stringtabel van.<br \/>\nHet is dus van groot belang dat ieder item uit iedere stringtabel uit ieder resource-bestand een uniek nummer heeft!<\/p>\n<p>Merk op dat door het handig kiezen van de nummers in een stringtabel je aan een numerieke expressie genoeg hebt om het juiste item uit de stingtabel te destileren.<br \/>\nZo liggen alle Nederlandse menu-items tussen de 1000 en 1999, en alle Engelse menu-items tussen de 2000 en 2999.<\/p>\n<p>&#8211;\u00a0<i>Implementeer het FormCreate-event als volgt:<\/i><\/p>\n<p><span style=\"font-family: courier new; font-size: small;\"><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">procedure TForm1.FormCreate(Sender: TObject);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 vTaal := c_NL;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 rgrTaal.ItemIndex := 0;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 UpdateTaal;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">end;<\/span><b><br \/>\n<\/b><\/span><br \/>\nNu zijn we klaar voor een eerste test.<\/p>\n<p>&#8211;\u00a0<i>Bewaar het project en run het<\/i><br \/>\n&#8211;\u00a0<i>Kies een taal en klik in het menu<\/i><br \/>\n&#8211;\u00a0<i>Kies de andere taal en klik weer in het menu<\/i><\/p>\n<p>Hopelijk werkt alles naar wens, dat wil zeggen dat de Captions van de menu-items worden aangepast aan de gekozen taal.<\/p>\n<p>De rest van het voorbeeld ga ik niet zo uitkouwen als hierboven. Aan het einde van het hoofdstuk geef ik de volledige code weer, zodat je zelf het voorbeeld kunt afmaken.<br \/>\nWel geef ik alvast hier alle componenten die op de Form staan:<\/p>\n<table style=\"border-collapse: collapse; width: 100%;\">\n<tbody>\n<tr>\n<td style=\"width: 33.3333%;\">Component<\/td>\n<td style=\"width: 33.3333%;\">Name<\/td>\n<td style=\"width: 33.3333%;\">Poperty=<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 33.3333%;\">Animate<\/td>\n<td style=\"width: 33.3333%;\">Animate1<\/td>\n<td style=\"width: 33.3333%;\">AutoSize=False, (Container=Panel1)<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 33.3333%;\">Button<\/td>\n<td style=\"width: 33.3333%;\">btnAanUit<\/td>\n<td style=\"width: 33.3333%;\">Caption=&#8217;Aan&#8217;, Width=33, (Container=Panel1)<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 33.3333%;\">Image<\/td>\n<td style=\"width: 33.3333%;\">Image1<\/td>\n<td style=\"width: 33.3333%;\">AutoSize=False, Stretch=True, Width=121, Height=153<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 33.3333%;\">Image<\/td>\n<td style=\"width: 33.3333%;\">Image2<\/td>\n<td style=\"width: 33.3333%;\">AutoSize=False, Stretch=True, Width=15, Height=15, in linker-onderhoek van Image1<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 33.3333%;\">Label<\/td>\n<td style=\"width: 33.3333%;\">Label1<\/td>\n<td style=\"width: 33.3333%;\">Staat links-boven Panel1<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 33.3333%;\">Panel<\/td>\n<td style=\"width: 33.3333%;\">Panel1<\/td>\n<td style=\"width: 33.3333%;\">Width=137, Height=129<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 33.3333%;\">Panel<\/td>\n<td style=\"width: 33.3333%;\">Panel2<\/td>\n<td style=\"width: 33.3333%;\">Width=505, Heigth=193<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 33.3333%;\">Timer<\/td>\n<td style=\"width: 33.3333%;\">Timer1<\/td>\n<td style=\"width: 33.3333%;\">Interval=500<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 33.3333%;\">WebBrowser<\/td>\n<td style=\"width: 33.3333%;\">WebBrowser1<\/td>\n<td style=\"width: 33.3333%;\">Align=alClient, (Container=Panel2)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Wat we hier moeten leren is hoe de verschillende resources in Delphi aan te roepen zijn.<\/p>\n<p>Het afspelen van een AVI is simpel met een Animate-control:<\/p>\n<p>In de property ResName komt de resource-naam (IDENTIFIER) van de AVI te staan,<br \/>\nin de property ResHandle zet je de waarde HInstance, en tot slot<br \/>\nset je de property Active op True.<\/p>\n<p>Om een Bitmap in een Image-control te zetten kun je de volgende constructie gebruiken:<\/p>\n<p><span style=\"font-family: courier new; font-size: small;\"><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">Image2.Picture.Bitmap.LoadFromResourceName(hInstance,&#8217;BULBOFF&#8217;);<\/span><b><br \/>\n<\/b><\/span><br \/>\nHier zie je dus een voorbeeld van een Delphi-oplossing. Simpel en doeltreffend.<\/p>\n<p>Iets minder voor de hand liggend is het laden van een Icon:<\/p>\n<p><span style=\"font-family: courier new; font-size: small;\"><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">Form1.Icon.Handle := LoadIcon(hInstance,&#8217;HJGSOFT&#8217;);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">Application.Icon.Handle := LoadIcon(hInstance,&#8217;HJGSOFT&#8217;);<\/span><b><br \/>\n<\/b><\/span><br \/>\nDe functie LoadIcon geeft een waarde van het type HICON, en dat is een Handle naar de Icon.<\/p>\n<p>Het laden en toekennen van cursors gaat als volgt:<\/p>\n<p>Alle cursors in Delphi worden in een Array van het object Screen gestopt. Om aan een control een nieuwe cursor toe te kennen moet je eerst deze Array uitbreiden:<\/p>\n<p><span style=\"font-family: courier new; font-size: small;\"><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">Screen.Cursors[100] := LoadCursor(hInstance,&#8217;FLAT&#8217;);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">Screen.Cursors[101] := LoadCursor(hInstance,&#8217;GRAB&#8217;);<\/span><b><br \/>\n<\/b><\/span><br \/>\nLoadCursor retourneert weer een handle naar de cursor. De index van de Array maakt niets uit, want op de achtergrond blijkt het hier niet om een gewone Array te gaan maar om een Pointer-type.<br \/>\nWel is het handig te weten dat de standaard-cursors in Delphi een negatieve index hebben.<br \/>\nOm nu aan een control een nieuwe cursor toe te kennen is het voldoende om de index aan de property Cursor toe te kennen:<\/p>\n<p><span style=\"font-family: courier new; font-size: small;\"><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">btnAanUit.Cursor := 100;<\/span><b><br \/>\n<\/b><\/span><br \/>\nDe rest van onze resources laat zich minder makkelijk gebruiken.<\/p>\n<p>Daarvoor gaan we een aantal, min of meer, generieke procedures maken.<\/p>\n<p>Voor het gebruik van jpg&#8217;s maken we:<\/p>\n<p><span style=\"font-family: courier new; font-size: small;\"><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">procedure LoadJPEGFromRes(TheJPEG : string; ThePicture : TPicture);<\/span><b><br \/>\n<\/b><\/span><br \/>\ndie een string meekrijgt van de naam van de jpg in de resource-file, en het object waar de jpg moet komen te staan.<\/p>\n<p>In ons voorbeeld gaan we het als volgt gebruiken:<\/p>\n<p><span style=\"font-family: courier new; font-size: small;\"><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">LoadJPEGFromRes(&#8216;ZOEF&#8217;,Image1.Picture);<\/span><b><br \/>\n<\/b><\/span><br \/>\nEn hier komt de implementatie:<\/p>\n<p><span style=\"font-family: courier new; font-size: small;\"><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">procedure LoadJPEGFromRes(TheJPEG : string; ThePicture : TPicture);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 var<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 ResHandle : THandle;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 MemHandle : THandle;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 MemStream : TMemoryStream;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 ResPtr\u00a0\u00a0\u00a0\u00a0: PByte;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 ResSize\u00a0\u00a0 : Longint;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 JPEGImage : TJPEGImage;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 ResHandle := FindResource(hInstance, PChar(TheJPEG), &#8216;JPEG&#8217;);\/\/retourneert handle naar resource-blok<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 MemHandle := LoadResource(hInstance, ResHandle);\/\/laadt resource-blok in geheugen<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 ResPtr\u00a0\u00a0\u00a0\u00a0:= LockResource(MemHandle);\/\/locked het resource-blok en retourneert een pointer naar eerste byte van resource-blok<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 MemStream := TMemoryStream.Create;\/\/geheugen-stroom<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 JPEGImage := TJPEGImage.Create;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 ResSize := SizeOfResource(hInstance, ResHandle);\/\/grootte in bytes van resource-blok<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 MemStream.SetSize(ResSize);\/\/zet de grootte van geheugen-stroom<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 MemStream.Write(ResPtr^, ResSize);\/\/vult de geheugen-stroom met het resource-blok<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 FreeResource(MemHandle);\/\/voor 16-bits toepassingen, obsolete voor 32-bits toepassingen<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 MemStream.Seek(0, 0);\/\/zet de wijzer aan het begin van het geheugen-blok<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 JPEGImage.LoadFromStream(MemStream);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 ThePicture.Assign(JPEGImage);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 JPEGImage.Free;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 MemStream.Free;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">end;<\/span><b><br \/>\n<\/b><\/span><br \/>\nHet commentaar spreekt hopelijk voor zich. Waar het op neerkomt is dat je de resource in een geheugenstroom zet en vandaaruit het jpeg-image vult. Een geheugenstroom kun je vergelijken met een bestand op schijf.<br \/>\nGebruik de Unit JPEG in je Uses-clausule.<\/p>\n<p>Voor het afspelen van een WAV volgen we min of meer hetzelfde als hierboven.<br \/>\nDe procedure heet:<\/p>\n<p><span style=\"font-family: courier new; font-size: small;\"><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">procedure PlayWaveFromRes(TheWave: string);<\/span><b><br \/>\n<\/b><\/span><br \/>\nen in ons voorbeeld wordt het als volgt gebruikt:<\/p>\n<p><span style=\"font-family: courier new; font-size: small;\"><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">PlayWaveFromRes(&#8216;ZOEFZOEF&#8217;);<\/span><b><br \/>\n<\/b><\/span><br \/>\nHier is de implementatie:<\/p>\n<p><span style=\"font-family: courier new; font-size: small;\"><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">procedure PlayWaveFromRes(TheWave: string);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 var<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 hFind, hRes: THandle;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 Song: PChar;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 hFind:=FindResource(HInstance, PChar(TheWave), &#8216;WAVE&#8217;);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 if hFind&lt;&gt;0 then<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 hRes:=LoadResource(HInstance, hFind);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 if hRes&lt;&gt;0 then<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 \u00a0 begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 Song:=LockResource(hRes);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 if Assigned(Song) then\/\/test voor nil, als Song is nil, dan false anders true<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 SndPlaySound(Song, snd_Sync or snd_Memory);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 UnlockResource(hRes);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 \u00a0 end;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 FreeResource(hFind);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 end;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">end;<\/span><b><br \/>\n<\/b><\/span><br \/>\nIn deze routine zitten iets meer tests om te kijken of alles in orde is, eigenlijk wel zo netjes.<br \/>\nHier hebben we geen memory-stream nodig. Dat heeft te maken met de routine SndPlaySound. Voor details over deze routine verwijs ik graag naar de Delphi-help.<\/p>\n<p>Een iets andere aanpak gaan we gebruiken voor het afspelen van een MP3.<br \/>\nDe procedure zal heten:<\/p>\n<p><span style=\"font-family: courier new; font-size: small;\"><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">procedure PlayMP3FromRes(TheMP3: string);<\/span><b><br \/>\n<\/b><\/span><br \/>\nEn we gebruiken hem als volgt:<\/p>\n<p><span style=\"font-family: courier new; font-size: small;\"><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">PlayMP3FromRes(&#8216;JOURNAAL&#8217;);<\/span><b><br \/>\n<\/b><\/span><br \/>\nDe implementatie:<\/p>\n<p><span style=\"font-family: courier new; font-size: small;\"><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">procedure PlayMP3FromRes(TheMP3: string);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 var<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 rStream: TResourceStream;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 fStream: TFileStream;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 fname: string;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 mp: TMediaPlayer;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 fname:=ExtractFileDir(Paramstr(0))+&#8217;\\&#8217;+TheMP3+&#8217;.MP3&#8242;;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 rStream := TResourceStream.Create(hInstance, TheMP3, RT_RCDATA);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 try<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 fStream := TFileStream.Create(fname, fmCreate);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 try<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 fStream.CopyFrom(rStream, 0);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 finally<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 fStream.Free;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 end;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 finally<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 rStream.Free;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 end;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 mp := TMediaPlayer.Create(Form1);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 mp.ParentWindow := Form1.Handle;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 mp.Visible := False;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 mp.Close;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 mp.FileName := fname;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 mp.Open;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 mp.Play;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">end;<\/span><b><br \/>\n<\/b><\/span><br \/>\nIn plaats van een Memory-stream gebruiken we hier een echte file-stream. Nadeel is wel dat nu het bestand JOURNAAL.MP3 wordt aangemaakt.<br \/>\nVerder maken we gebruik van een MediaPlayer omdat deze in staat is MP3&#8217;s af te spelen.<br \/>\nDe MediaPlayer wordt met het afsluiten van de applicatie vernietigd.<br \/>\nVergeet hier niet de Unit mplayer aan te roepen.<\/p>\n<p>Als laatste gaan we de html-resource gebruiken.<\/p>\n<p>De procedure heet:<\/p>\n<p><span style=\"font-family: courier new; font-size: small;\"><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">procedure LoadHTMLFromRes(TheHTML: string);<\/span><b><br \/>\n<\/b><\/span><br \/>\nEn je gebruikt hem als volgt:<\/p>\n<p><span style=\"font-family: courier new; font-size: small;\"><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">LoadHTMLFromRes(&#8216;INFONL&#8217;);<\/span><b><br \/>\n<\/b><\/span><br \/>\nDe implementatie is redelijk simpel:<\/p>\n<p><span style=\"font-family: courier new; font-size: small;\"><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">procedure LoadHTMLFromRes(TheHTML: string);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 var<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 ResURLStr: string;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 ModuleName: array[0..255] of Char;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 GetModuleFileName(hInstance, ModuleName, 255);\/\/retourneert het pad+bestandsnaam van de applicatie<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 ResURLStr:=&#8217;res:\/\/&#8217; + StrPas(ModuleName) + &#8216;\/RT_HTML\/&#8217;+TheHTML;\/\/StrPas zet een 0-terminated-string om naar een Pascal-string<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 Form1.WebBrowser1.Navigate(ResURLStr);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">end;<\/span><b><br \/>\n<\/b><\/span><br \/>\nEr zijn natuurlijk ook andere routines in Delphi om pad+bestandsnaam te achterhalen, maar deze werkt ook.<br \/>\nKijk voor het gebruik van de WebBrowser naar de help van Delphi.<\/p>\n<p>Zoals beloofd komt hier de complete source-code van het project:<\/p>\n<div>\n<span class=\"collapseomatic \" id=\"id69e2ee2518f10\"  tabindex=\"0\" title=\"Complete code\"    >Complete code<\/span><div id=\"target-id69e2ee2518f10\" class=\"collapseomatic_content \">\n<div id=\"vb\">\n<p><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">unit Unit1;<\/span><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">interface<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">uses<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">ComCtrls, ExtCtrls, StdCtrls, JPEG, mmsystem, MPlayer, Menus, OleCtrls,<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">SHDocVw;<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">type<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 TForm1 = class(TForm)<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 Panel1: TPanel;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 Animate1: TAnimate;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 btnAanUit: TButton;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 rgrTaal: TRadioGroup;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 Image1: TImage;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 Timer1: TTimer;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 Image2: TImage;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 MainMenu1: TMainMenu;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 mnuBestand: TMenuItem;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 mnuBestandLaden: TMenuItem;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 mnuBestandSep1: TMenuItem;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 mnuBestandAfsluiten: TMenuItem;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 mnuHulp: TMenuItem;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 mnuHulpCopyright: TMenuItem;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 Panel2: TPanel;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 WebBrowser1: TWebBrowser;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 Label1: TLabel;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 procedure btnAanUitClick(Sender: TObject);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 procedure FormCreate(Sender: TObject);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 procedure rgrTaalClick(Sender: TObject);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 procedure FormActivate(Sender: TObject);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 procedure Image1Click(Sender: TObject);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 procedure Timer1Timer(Sender: TObject);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 procedure mnuBestandLadenClick(Sender: TObject);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 procedure mnuHulpCopyrightClick(Sender: TObject);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 procedure mnuBestandAfsluitenClick(Sender: TObject);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 private<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 { Private declarations }<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 procedure UpdateTaal;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 public<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 { Public declarations }<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 end;<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">var<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 Form1: TForm1;<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">implementation<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">{$R *.DFM}<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">{$R menu.RES}<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">{$R smp.RES}<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">{$R captions.RES}<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">{$R htmls.RES}<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">Const<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 c_NL = 1000;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 c_UK = 2000;<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">var<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 vTaal: Integer;<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">procedure LoadJPEGFromRes(TheJPEG : string; ThePicture : TPicture);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 var<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 ResHandle : THandle;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 MemHandle : THandle;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 MemStream : TMemoryStream;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 ResPtr\u00a0\u00a0\u00a0\u00a0: PByte;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 ResSize\u00a0\u00a0 : Longint;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 JPEGImage : TJPEGImage;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 ResHandle := FindResource(hInstance, PChar(TheJPEG), &#8216;JPEG&#8217;);\/\/retourneert handle naar resource-blok<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 MemHandle := LoadResource(hInstance, ResHandle);\/\/laadt resource-blok in geheugen<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 ResPtr\u00a0\u00a0\u00a0\u00a0:= LockResource(MemHandle);\/\/locked het resource-blok en retourneert een pointer naar eerste byte van resource-blok<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 MemStream := TMemoryStream.Create;\/\/geheugen-stroom<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 JPEGImage := TJPEGImage.Create;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 ResSize := SizeOfResource(hInstance, ResHandle);\/\/grootte in bytes van resource-blok<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 MemStream.SetSize(ResSize);\/\/zet de grootte van geheugen-stroom<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 MemStream.Write(ResPtr^, ResSize);\/\/vult de geheugen-stroom met het resource-blok<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 FreeResource(MemHandle);\/\/voor 16-bits toepassingen, obsolete voor 32-bits toepassingen<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 MemStream.Seek(0, 0);\/\/zet de wijzer aan het begin van het geheugen-blok<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 JPEGImage.LoadFromStream(MemStream);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 ThePicture.Assign(JPEGImage);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 JPEGImage.Free;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 MemStream.Free;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">end;<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">procedure PlayWaveFromRes(TheWave: string);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 var<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 hFind, hRes: THandle;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 Song: PChar;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 hFind:=FindResource(HInstance, PChar(TheWave), &#8216;WAVE&#8217;);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 if hFind&lt;&gt;0 then<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 hRes:=LoadResource(HInstance, hFind);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 if hRes&lt;&gt;0 then<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 \u00a0 begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 Song:=LockResource(hRes);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 if Assigned(Song) then<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 SndPlaySound(Song, snd_Sync or snd_Memory);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 UnlockResource(hRes);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 \u00a0 end;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 FreeResource(hFind);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 end;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">end;<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">procedure PlayMP3FromRes(TheMP3: string);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 var<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 rStream: TResourceStream;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 fStream: TFileStream;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 fname: string;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 mp: TMediaPlayer;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 fname:=ExtractFileDir(Paramstr(0))+&#8217;\\&#8217;+TheMP3+&#8217;.MP3&#8242;;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 rStream := TResourceStream.Create(hInstance, TheMP3, RT_RCDATA);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 try<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 fStream := TFileStream.Create(fname, fmCreate);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 try<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 \u00a0 fStream.CopyFrom(rStream, 0);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 finally<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 \u00a0 fStream.Free;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 end;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 finally<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 rStream.Free;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 end;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 mp := TMediaPlayer.Create(Form1);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 mp.ParentWindow := Form1.Handle;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0mp.Visible := False;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 mp.Close;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 mp.FileName := fname;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 mp.Open;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 mp.Play;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">end;<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">procedure LoadHTMLFromRes(TheHTML: string);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 var<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 ResURLStr: string;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 ModuleName: array[0..255] of Char;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 GetModuleFileName(hInstance, ModuleName, 255);\/\/retourneert het pad+bestandsnaam van de applicatie<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 ResURLStr:=&#8217;res:\/\/&#8217; + StrPas(ModuleName) + &#8216;\/RT_HTML\/&#8217;+TheHTML;\/\/StrPas zet een 0-terminated-string om naar een Pascal-string<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 Form1.WebBrowser1.Navigate(ResURLStr);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">end;<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">procedure TForm1.btnAanUitClick(Sender: TObject);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 if btnAanUit.Tag = 0 then<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 Animate1.ResName := &#8216;COUNT8R&#8217;;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 Animate1.ResHandle := hInstance;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 Animate1.Active := True;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 btnAanUit.Caption := LoadStr(10*vTaal+10);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 btnAanUit.Tag := 1;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 end<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 else<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 Animate1.Active := False;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 Animate1.ResHandle := 0;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 btnAanUit.Caption := LoadStr(10*vTaal);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 btnAanUit.Tag := 0;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 end;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">end;<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">procedure TForm1.FormCreate(Sender: TObject);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 vTaal := c_NL;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 rgrTaal.ItemIndex := 0;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 LoadJPEGFromRes(&#8216;ZOEF&#8217;,Image1.Picture);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 Screen.Cursors[100] := LoadCursor(hInstance,&#8217;FLAT&#8217;);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 Screen.Cursors[101] := LoadCursor(hInstance,&#8217;GRAB&#8217;);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 btnAanUit.Cursor := 100;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 Form1.Icon.Handle := LoadIcon(hInstance,&#8217;HJGSOFT&#8217;);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 Application.Icon.Handle := LoadIcon(hInstance,&#8217;HJGSOFT&#8217;);<br \/>\n<\/span><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 Image2.Picture.Bitmap.LoadFromResourceName(hInstance,&#8217;BULBOFF&#8217;);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 UpdateTaal;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">end;<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">procedure TForm1.rgrTaalClick(Sender: TObject);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 if rgrTaal.ItemIndex = 0 then<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 vTaal := c_NL<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 else<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 vTaal := c_UK;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 UpdateTaal;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">end;<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">procedure TForm1.UpdateTaal;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 mnuBestand.Caption := LoadStr(vTaal);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 mnuBestandLaden.Caption := LoadStr(vTaal + 10);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 mnuBestandAfsluiten.Caption := LoadStr(vTaal+30);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 mnuHulp.Caption := LoadStr(vTaal+100);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 mnuHulpCopyright.Caption := LoadStr(vTaal+110);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 btnAanUit.Caption := LoadStr(10*vTaal+10*btnAanUit.Tag);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 rgrTaal.Caption := LoadStr(10*vTaal+20);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 rgrTaal.Items[0] := LoadStr(10*vTaal+30);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 rgrTaal.Items[1] := LoadStr(10*vTaal+40);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 Form1.Caption := LoadStr(10*vTaal+50);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 Image1.Hint := LoadStr(10*vTaal+80);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 Image2.Hint := Image1.Hint;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 Label1.Caption := LoadStr(10*vTaal+90);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 if vTaal = c_NL then<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 LoadHTMLFromRes(&#8216;INFONL&#8217;)<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 else<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 LoadHTMLFromRes(&#8216;INFOUK&#8217;);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">end;<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">procedure TForm1.FormActivate(Sender: TObject);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 PlayMP3FromRes(&#8216;JOURNAAL&#8217;);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">end;<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">procedure TForm1.Image1Click(Sender: TObject);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 PlayWaveFromRes(&#8216;ZOEFZOEF&#8217;);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">end;<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">procedure TForm1.Timer1Timer(Sender: TObject);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 if Image2.Tag = 0 then<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 Image2.Picture.Bitmap.LoadFromResourceName(hInstance,&#8217;BULBOFF&#8217;);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 Image2.Tag := 1;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 end<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 else<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 Image2.Picture.Bitmap.LoadFromResourceName(hInstance,&#8217;BULBON&#8217;);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 \u00a0 Image2.Tag := 0;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 end;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 if btnAanUit.Cursor = 100 then<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 btnAanUit.Cursor := 101<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 else<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 \u00a0 btnAanUit.Cursor := 100;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">end;<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">procedure TForm1.mnuBestandLadenClick(Sender: TObject);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 var s: string;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 s := LoadStr(vTaal*10+60);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 ShowMessage(s);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">end;<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">procedure TForm1.mnuHulpCopyrightClick(Sender: TObject);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 var s: string;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 s := LoadStr(vTaal*10+70);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 ShowMessage(s);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">end;<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">procedure TForm1.mnuBestandAfsluitenClick(Sender: TObject);<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">begin<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">\u00a0 close;<\/span><br \/>\n<span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">end;<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace; font-size: 12pt;\">end.<\/span><\/p>\n<\/div>\n<\/div>\n<\/div>\n<h2>Ten slotte<\/h2>\n<p>Zoals je hebt gezien moet er hier en daar wel wat worden geprogrammeerd om van alle soorten resources gebruik te kunnen maken.<br \/>\nIk heb geprobeerd wat licht in de duisternis te scheppen en een aantal verschillende oplossingen voor de problemen te geven.<\/p>\n<p>Ik hoop dat je je voordeel hiermee kunt doen.<\/p>\n<p><span style=\"font-size: 8pt;\">[<a href=\"https:\/\/wiskunst.nl\/index.php\/raadseltjes\/oplossing-raadsel-1\/\" target=\"_blank\" rel=\"noopener\">Oplossing raadsel 1<\/a>]<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Inleiding Dit hoofdstuk gaat over het gebruik van (niet standaard\/delphi) resources. Een resources kan van alles zijn: bitmaps, icons, cursors, avi&#8217;s, wav&#8217;s etc. etc.. Een programma kan gebruik maken van externe resources, maar ook van interne resources, ofwel resources die in de exe-cutable zijn gelinkt. Hier gaan we het over die laatste categorie hebben, en [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":309,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"templates\/template-full-width.php","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"class_list":["post-355","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Resources in Delphi - Wiskunst<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/resources-in-delphi\/\" \/>\n<meta property=\"og:locale\" content=\"nl_NL\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Resources in Delphi - Wiskunst\" \/>\n<meta property=\"og:description\" content=\"Inleiding Dit hoofdstuk gaat over het gebruik van (niet standaard\/delphi) resources. Een resources kan van alles zijn: bitmaps, icons, cursors, avi&#8217;s, wav&#8217;s etc. etc.. Een programma kan gebruik maken van externe resources, maar ook van interne resources, ofwel resources die in de exe-cutable zijn gelinkt. Hier gaan we het over die laatste categorie hebben, en [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/resources-in-delphi\/\" \/>\n<meta property=\"og:site_name\" content=\"Wiskunst\" \/>\n<meta property=\"article:modified_time\" content=\"2022-01-24T08:23:11+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Geschatte leestijd\" \/>\n\t<meta name=\"twitter:data1\" content=\"15 minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/wiskunst.nl\\\/index.php\\\/programmeren1\\\/delphi-lazarus\\\/resources-in-delphi\\\/\",\"url\":\"https:\\\/\\\/wiskunst.nl\\\/index.php\\\/programmeren1\\\/delphi-lazarus\\\/resources-in-delphi\\\/\",\"name\":\"Resources in Delphi - Wiskunst\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wiskunst.nl\\\/#website\"},\"datePublished\":\"2022-01-21T13:10:48+00:00\",\"dateModified\":\"2022-01-24T08:23:11+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/wiskunst.nl\\\/index.php\\\/programmeren1\\\/delphi-lazarus\\\/resources-in-delphi\\\/#breadcrumb\"},\"inLanguage\":\"nl-NL\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/wiskunst.nl\\\/index.php\\\/programmeren1\\\/delphi-lazarus\\\/resources-in-delphi\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/wiskunst.nl\\\/index.php\\\/programmeren1\\\/delphi-lazarus\\\/resources-in-delphi\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/wiskunst.nl\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Programmeren\",\"item\":\"https:\\\/\\\/wiskunst.nl\\\/index.php\\\/programmeren1\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Delphi\\\/Lazarus\",\"item\":\"https:\\\/\\\/wiskunst.nl\\\/index.php\\\/programmeren1\\\/delphi-lazarus\\\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Resources in Delphi\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/wiskunst.nl\\\/#website\",\"url\":\"https:\\\/\\\/wiskunst.nl\\\/\",\"name\":\"Wiskunst\",\"description\":\"2\u221e\u2227&gt;\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/wiskunst.nl\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"nl-NL\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Resources in Delphi - Wiskunst","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/resources-in-delphi\/","og_locale":"nl_NL","og_type":"article","og_title":"Resources in Delphi - Wiskunst","og_description":"Inleiding Dit hoofdstuk gaat over het gebruik van (niet standaard\/delphi) resources. Een resources kan van alles zijn: bitmaps, icons, cursors, avi&#8217;s, wav&#8217;s etc. etc.. Een programma kan gebruik maken van externe resources, maar ook van interne resources, ofwel resources die in de exe-cutable zijn gelinkt. Hier gaan we het over die laatste categorie hebben, en [&hellip;]","og_url":"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/resources-in-delphi\/","og_site_name":"Wiskunst","article_modified_time":"2022-01-24T08:23:11+00:00","twitter_card":"summary_large_image","twitter_misc":{"Geschatte leestijd":"15 minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/resources-in-delphi\/","url":"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/resources-in-delphi\/","name":"Resources in Delphi - Wiskunst","isPartOf":{"@id":"https:\/\/wiskunst.nl\/#website"},"datePublished":"2022-01-21T13:10:48+00:00","dateModified":"2022-01-24T08:23:11+00:00","breadcrumb":{"@id":"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/resources-in-delphi\/#breadcrumb"},"inLanguage":"nl-NL","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/resources-in-delphi\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/resources-in-delphi\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wiskunst.nl\/"},{"@type":"ListItem","position":2,"name":"Programmeren","item":"https:\/\/wiskunst.nl\/index.php\/programmeren1\/"},{"@type":"ListItem","position":3,"name":"Delphi\/Lazarus","item":"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/"},{"@type":"ListItem","position":4,"name":"Resources in Delphi"}]},{"@type":"WebSite","@id":"https:\/\/wiskunst.nl\/#website","url":"https:\/\/wiskunst.nl\/","name":"Wiskunst","description":"2\u221e\u2227&gt;","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wiskunst.nl\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"nl-NL"}]}},"_links":{"self":[{"href":"https:\/\/wiskunst.nl\/index.php\/wp-json\/wp\/v2\/pages\/355","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wiskunst.nl\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/wiskunst.nl\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/wiskunst.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wiskunst.nl\/index.php\/wp-json\/wp\/v2\/comments?post=355"}],"version-history":[{"count":20,"href":"https:\/\/wiskunst.nl\/index.php\/wp-json\/wp\/v2\/pages\/355\/revisions"}],"predecessor-version":[{"id":522,"href":"https:\/\/wiskunst.nl\/index.php\/wp-json\/wp\/v2\/pages\/355\/revisions\/522"}],"up":[{"embeddable":true,"href":"https:\/\/wiskunst.nl\/index.php\/wp-json\/wp\/v2\/pages\/309"}],"wp:attachment":[{"href":"https:\/\/wiskunst.nl\/index.php\/wp-json\/wp\/v2\/media?parent=355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}