Novembre 2024 | Lun | Mar | Mer | Jeu | Ven | Sam | Dim |
---|
| | | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | | Calendrier |
|
|
| custom Icon | |
| | Auteur | Message |
---|
jennyk
Nombre de messages : 3 Age : 38 Date d'inscription : 10/05/2018
| Sujet: custom Icon Jeu 10 Mai 2018 - 1:00 | |
| Been busy at work, so not had chance to work with 'Panoramic' that much, but I love it, but we need to be able to customise the program icon to our own personal one, surely this cannot be so difficult to implement ? please keep up the excellent work, I love this language and am always happy to promote it.
Thanks. Jenny.
| |
| | | Klaus
Nombre de messages : 12331 Age : 75 Localisation : Ile de France Date d'inscription : 29/12/2009
| Sujet: Re: custom Icon Jeu 10 Mai 2018 - 1:25 | |
| You an actually do it in 2 ways, but keep in mind that you cannot modify a running EXE file. You only can do it to anot actually running EXE file. 1st possibilité: modify permanently an EXE file, after its creation via Panoramic_Editor:Use ResHacker - its simple. The new icon will show in File Explorer. 2nd possiblité: modify the main form icon dynamicallycreate a little Panoramic, using a function from KGF.dll to do the worl. The icon of form 0 will change. Calling this immédiately after startup wil produce the desired effect. Hereis how to do it: - Code:
-
dim res%, KGF$, icon$ KGF$ = "KGF.dll" : ' give here the path to the DLL, if not in the same folder icon$ = "Mycon.ico" : ' give here the path to the icon if not in the same folder dll_on KGF$ res% = dll_call2("SetFormIcon",handle(0),adr(icon$)) Good luck ! EDIT Sorry, I forgot the DLL_ON command. It's corrected above... | |
| | | jennyk
Nombre de messages : 3 Age : 38 Date d'inscription : 10/05/2018
| Sujet: Re: custom Icon Ven 11 Mai 2018 - 1:28 | |
| | |
| | | jennyk
Nombre de messages : 3 Age : 38 Date d'inscription : 10/05/2018
| Sujet: more help Ven 11 Mai 2018 - 1:49 | |
| Please . Where can I find more examples and utilities for 'Panoramic' - And is it possible to use it to package or encapsulate files like a wrapper for a self contained install package ? I know there's the 'Application compile option' but how would I copy the files into a folder ? Thank you
Jenny.
| |
| | | Yannick
Nombre de messages : 8635 Age : 53 Localisation : Bretagne Date d'inscription : 15/02/2010
| Sujet: re Ven 11 Mai 2018 - 8:22 | |
| | |
| | | Klaus
Nombre de messages : 12331 Age : 75 Localisation : Ile de France Date d'inscription : 29/12/2009
| Sujet: Re: custom Icon Ven 11 Mai 2018 - 16:57 | |
| - Citation :
- I know there's the 'Application compile option' but how would I copy the files into a folder ?
An "application" is built by Panoramic_Editor including any BMP, JPG and TXT file residing within the same folder as the Panoramic source file. At runtime, a simple FILE_OPEN_... specifying just the file name and extension without any path information will open the file included during application construction. Pysically, an application show as a single EXE file, the embedded BMP, JPG and TXT files are included as resources. No other file type can be included into an application. But you can "trick" the system ! Just rename any desired file as BMP, JMP or TXT and include it that way. At runtime, open the file(s) with FILEBIN_OPEN_READ, create a new one (into the folder of your choice !) using FILEBIN_OPEN_WRITE, than copy the input file into the output file using FILEBIN_BLOCK_READ and FILEBIN_BLOCK_WRITE, than close both files. And there you are... You even can include a small TXT file containing information about all "tricked" files (names, file sizes, destinateion folders, ...) in order to automatize the startup procedure. After that, it"s up to you to either delete all these copied files on program exit (using the ON_CLOSE event on form 0), or leave them where they are, and just avoid to redo all this staff if these files already exist. Good luck ! EDITYou might even try the FILE_COPY command instead of the binary copy operations described above. Just use the fake TXT file name without path as input and the real file name, eventually with its destination path, as output. It just may work... | |
| | | Klaus
Nombre de messages : 12331 Age : 75 Localisation : Ile de France Date d'inscription : 29/12/2009
| Sujet: Re: custom Icon Sam 12 Mai 2018 - 20:09 | |
| I made some tests concerning files to be included into a Panoramic Application EXE file. Sadly, Panoramic checks if TXT files are real text files and if the BMP or JPG files have correct format. Thus, my "trick" renaming binary files into TXT files will not work ! Sorry. But I give you a full solution for this problem. The idea is to convert any desired binary file into a TXT file containing a hexadecimal dump of the binary content. Thus, all these conerted binary files can be included just like any text file. Later, on program startup, they can be extracted and converted back to their original binary format. I give you here the conversion utility: - Code:
-
' hexify.bas ' ' This utility converts any binary file into a TXT file containing an hexadecimal dump ' of the binary file, with lines containing BlockSize%*2 characters. ' This kind of file can easyly be included into a Panoramic Application EXE file. ' Thus, any binary file can be used, not only TXT, JPG and BMP files. ' Please use the ExtractFiles procedure from the test_application.bas file to rebuild ' the binary files on program startup - see this program for documentation.
label opn, ext
dim f$, fout$, no%, no1%, no2%, ext$, buf$, siz%, siz0% dim BlockSize% : BlockSize% = 512
no% = no% + 1 : main_menu no% : no1% = no% no% = no% + 1 : sub_menu no% : no2% = no% : parent no%,no1% : caption no%,"Files" no% = no% + 1 : sub_menu no% : parent no%,no2% : caption no%,"Open" : on_click no%,opn no% = no% + 1 : sub_menu no% : parent no%,no2% : caption no%,"-" no% = no% + 1 : sub_menu no% : parent no%,no2% : caption no%,"Exit" : on_click no%,ext open_dialog 100 progress_bar 101 : top 101,40 : left 101,10 : width 101,width_client(0)-20
end
opn: ' ask for file to convert f$ = file_name$(100) if f$="_" then return if file_exists(f$)=0 message "File not found" return end_if ' build TXT file name ext$ = file_extract_extension$(f$) fout$ = left$(f$,len(f$)-len(ext$))+".txt" ' get binary file size filebin_open_read 1,f$ siz% = filebin_size(1) if siz%=0 message "File is empty" filebin_close 1 return end_if ' check if file exists if file_exists(fout$)=1 if message_confirmation_yes_no("Output file already exists. Replace ?")<>1 filebin_close 1 return end_if file_delete fout$ end_if ' conversion loop file_open_write 2,fout$ siz0% = siz% max 101,siz0% ' do as many full block reads as possible while siz%>=BlockSize% position 101,siz0%-siz% buf$ = filebin_hexa_read$(1,BlockSize%) file_writeln 2,buf$ siz% = siz% - BlockSize% end_while ' eventually, do a final partial block if siz%>0 position 101,siz0% buf$ = filebin_hexa_read$(1,siz%) file_writeln 2,buf$ end_if ' done position 101,siz0% . filebin_close 1 file_close 2 message "File created:"+chr$(13)+chr$(10)+fout$ position 101,0 return ext: terminate
and a demo program in which I include a hexified version of KGF.dll: - Code:
-
' test_application.bas ' ' This program is for demonstration purposes only. ' It show how to include any binary file into a Panoramic Application EXE file. ' Using the hexify utility, any binary file can be converted to an hexa dump ' in TXT format. Same file name, but *.TXT extension. Thus, the file will be ' flawlessly integrated into the application. ' As many binary files as required may be included in the same way. ' A supplemental TXT file must be supplied, giving the index of all included ' binary files, in the following format: ' index file name: IndexOfIncludedFiles.txt ' index file content: ' first line: #IndexOfIncludedFiles ' followed by 2 lines for each binary file. The first of them is the name ' of the hexified TXT file, without path. The second of them is the target ' file name, eventually including the destination path ' Example: ' #IndexOfIncludedFiles <=== first line as identifyer ' KGFdll.txt <=== name of the hexified TXT file ' KGF.dll <=== name of the resulting binary output file ' ...
dim res%, vers$, KGF$ KGF$ = "KGF.dll"
if file_exists(KGF$)=0 then ExtractFiles() message "Ready..."
end
sub ExtractFiles() dim_local s$, fincluded$, foutput$, nobj%, n% nobj% = 1 while object_exists(nobj%)=1 nobj% = nobj% + 1 end_while dlist nobj% file_load nobj%,"IndexOfIncludedFiles.txt" n% = 1 s$ = item_read$(nobj%,n%) if s$<>"#IndexOfIncludedFiles" message "Invalid index file" delete nobj% exit_sub end_if while n%<count(nobj%) n% = n% + 1 fincluded$ = item_read$(nobj%,n%) n% = n% + 1 foutput$ = item_read$(nobj%,n%) file_open_read 1,fincluded$ filebin_open_write 2,foutput$ while file_eof(1)=0 file_readln 1,s$ filebin_hexa_write 2,len(s$)/2,s$ end_while filebin_close 2 file_close 1 end_while delete nobj% end_sub
As you can see, at program startup, a check is done to see if KGF.dll is present. If not, the extraction is done, and than, the program goes on. | |
| | | Contenu sponsorisé
| Sujet: Re: custom Icon | |
| |
| | | | custom Icon | |
|
Sujets similaires | |
|
| Permission de ce forum: | Vous ne pouvez pas répondre aux sujets dans ce forum
| |
| |
| |