B4J Question [SOLVED] Open B4J app by double clicking on a file

max123

Well-Known Member
Licensed User
Longtime User
Hi all,

I've developed with B4J, a custom video encoder to be used to encode videos that Arduino, ESP8266 and ESP32 can read as fast
possible from micro SD card, play the video on a TFT screen and play audio in sync with video.

This my encoder accept a series of images, and convert them to a single custom video file.
The encoder show the video while encoder process create the it.

All this works and on Arduino side, I can read the file header and all video data and play them.

My problem now is that, because this is a custom format, Windows, Linux and other OS don't see them
as video files and they cannot be played on desktop side.

So now I want to develop a video player to open these files.

Here there are things I do not know, B4J apps accept arguments when launched, but how to extract the path ?

B4X:
Sub AppStart (Form1 As Form, Args() As String)

I explain better, on desktop I want to double click my file, then my player open with that file,
so at least I need the file path passed, in a way I can open the file and manage to play it.

Note that this should be done without an additional bat file, just double click on a file in any position to launch the player with it.

I want to ask if it is that possible, and if yes what is the best approach to do it.

Many thanks
 
Last edited:

Chris2

Active Member
Licensed User
Longtime User
Or you can create a custom icon for you app's associated files that's different to the app icon itself
(in the same way that for example, an excel .xlsx document file will have a slightly different icon than a shortcut to the Excel app itself).
E.g.
B4X:
Root: HKCR; Subkey: Raw Video Bitmap File\DefaultIcon; ValueType: string; ValueData: {app}\bin\raw_video_file_icon.ico,0; Flags: uninsdeletevalue noerror

For which you'd need to create raw_video_file_icon.ico youself and copy it to the packaged app folder when you Build Standalone Package. E.g.:
B4X:
#CustomBuildAction: After Packager, %WINDIR%\System32\robocopy.exe, ..\ temp\build\bin\ raw_video_file_icon.ico
 
Upvote 0

max123

Well-Known Member
Licensed User
Longtime User
@Chris2 Thanks for useful infos.

Suppose my app will open 3 different custom formats, I have to do something like that on InnoSetup ?
B4X:
[Registry]
Root: HKCR; SubKey: .rvb; ValueType: string; ValueData: Raw Video Bitmap Files; Flags: uninsdeletekey noerror; Tasks: ; Languages:
Root: HKCR; SubKey: Raw Video Bitmap Files; ValueType: string; ValueData: Raw Video Bitmap Files; Flags: uninsdeletekey noerror
Root: HKCR; SubKey: Raw Video Bitmap Files\Shell\Open\Command; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletevalue noerror
Root: HKCR; Subkey: Raw Video Bitmap Files\DefaultIcon; ValueType: string; ValueData: {app}\{#MyAppExeName},0; Flags: uninsdeletevalue noerror

[Registry]
Root: HKCR; SubKey: .rvj; ValueType: string; ValueData: Raw Video Jpeg Files; Flags: uninsdeletekey noerror; Tasks: ; Languages:
Root: HKCR; SubKey: Raw Video Jpeg Files; ValueType: string; ValueData: Raw Video Jpeg Files; Flags: uninsdeletekey noerror
Root: HKCR; SubKey: Raw Video Jpeg Files\Shell\Open\Command; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletevalue noerror
Root: HKCR; Subkey: Raw Video Jpeg Files\DefaultIcon; ValueType: string; ValueData: {app}\{#MyAppExeName},0; Flags: uninsdeletevalue noerror

[Registry]
Root: HKCR; SubKey: .rvp; ValueType: string; ValueData: Raw Video Png Files; Flags: uninsdeletekey noerror; Tasks: ; Languages:
Root: HKCR; SubKey: Raw Video Png Files; ValueType: string; ValueData: Raw Video Png Files; Flags: uninsdeletekey noerror
Root: HKCR; SubKey: Raw Video Png Files\Shell\Open\Command; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletevalue noerror
Root: HKCR; Subkey: Raw Video Png Files\DefaultIcon; ValueType: string; ValueData: {app}\{#MyAppExeName},0; Flags: uninsdeletevalue noerror

In that case would be possible to have the player with it's icon (the app icon), and any format have a different icon to differentiate it on the desktop ?
Eg. one with B (bitmap based encoder), one with J (jpeg based encoder) and one with P (png based encoder) letters printed out icons ?
 
Last edited:
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Many thanks all for help,
I will try your advices.... I see very active forum today o_O
probably is a good day to release my next WebGL tutorial, time permitting.
Once you release the tutorial, If haven't yet done so, join our Facebook Group and Post about it there so that everyone on the group can see it!
We need to showcase B4x and all it can do!
 
Upvote 0

Chris2

Active Member
Licensed User
Longtime User
In that case would be possible to have the player with it's icon (the app icon), and any format have a different icon to differentiate it on the desktop ?
Eg. one with B (bitmap based encoder), one with J (jpeg based encoder) and one with P (png based encoder) letters printed out icons ?
I've never tried it wth more than one assigned file extension, but I don't think you'd need multiple [Registry] sections. I'd guess it would be more like:
B4X:
[Registry]
Root: HKCR; SubKey: .rvb; ValueType: string; ValueData: Raw Video Bitmap Files; Flags: uninsdeletekey noerror; Tasks: ; Languages:
Root: HKCR; SubKey: Raw Video Bitmap Files; ValueType: string; ValueData: Raw Video Bitmap Files; Flags: uninsdeletekey noerror
Root: HKCR; SubKey: Raw Video Bitmap Files\Shell\Open\Command; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletevalue noerror
Root: HKCR; Subkey: Raw Video Bitmap Files\DefaultIcon; ValueType: string; ValueData: {app}\{#MyAppExeName},0; Flags: uninsdeletevalue noerror
Root: HKCR; SubKey: .rvj; ValueType: string; ValueData: Raw Video Jpeg Files; Flags: uninsdeletekey noerror; Tasks: ; Languages:
Root: HKCR; SubKey: Raw Video Jpeg Files; ValueType: string; ValueData: Raw Video Jpeg Files; Flags: uninsdeletekey noerror
Root: HKCR; SubKey: Raw Video Jpeg Files\Shell\Open\Command; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletevalue noerror
Root: HKCR; Subkey: Raw Video Jpeg Files\DefaultIcon; ValueType: string; ValueData: {app}\{#MyAppExeName},0; Flags: uninsdeletevalue noerror
Root: HKCR; SubKey: .rvp; ValueType: string; ValueData: Raw Video Png Files; Flags: uninsdeletekey noerror; Tasks: ; Languages:
Root: HKCR; SubKey: Raw Video Png Files; ValueType: string; ValueData: Raw Video Png Files; Flags: uninsdeletekey noerror
Root: HKCR; SubKey: Raw Video Png Files\Shell\Open\Command; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletevalue noerror
Root: HKCR; Subkey: Raw Video Png Files\DefaultIcon; ValueType: string; ValueData: {app}\{#MyAppExeName},0; Flags: uninsdeletevalue noerror
Each line is just another key being written to the WIndows Registry.
Have a look at the following link too. In particular for this stuff the Setup Script Sections > [Registry] section:
 
Last edited:
Upvote 0

max123

Well-Known Member
Licensed User
Longtime User
Yes thanks @Cableguy, I will check it. :)

Not because I wrote WebGL library, I already wrote dozen of libraries, but WebGL is really an insane library, you have to use it to know my words. It permits to do all with 3D, but even you can get full 3D games with even spatial sound and physics engines and even support of 4 gamepads (over USB or BT) at full frames depending on video card. On the next tutorial I will explain how to create full 3D games and change completely the full scene by just load another scene model. At this point pass the scene model to the physic engine and it automatically will calculate all the scene in a couple of milliseconds, so you will end up with the physics you have added by code in addition with the scene. It now is fully developed even for Android, here it is show on the main app, but it at same time even is exposed over HTTP and you can access from any web browser. From B4J IDE to B4A IDE, all projects are fully compatible, just need to change the Inizialize line, so any project developed on B4J will work on Android and viceversa. Because big differences between desktop and mobile, here I made a big work to make all these differences invisible to the final end user that use the library to develop something. Stay tuned.
 
Last edited:
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Yes thanks @Cableguy, I will check it. Not because I wrote WebGL library, I already wrote dozen of libraries, but WebGL is an insane library. It permits to do all with 3D, but even you can get full 3D games with even spatial sound and physics engines and even support of 4 gamepads at full frames depending on video card. On the next tutorial I will explain how to create full 3D games and change the full scene by just load another scene model. At this point pass the scene model to the physic engine and it automatically will calculate all the scene in a couple of milliseconds, so you will end up with the physics you have added by code in addition with the scene. It now is fully developed even for Android, here it is show on the main app, but it at same time even is exposed over HTTP and you can access from any web browser. Stay tuned.
If you already have a series going, link it into the group
 
Upvote 0

max123

Well-Known Member
Licensed User
Longtime User
You can link all my tutorials you see on my overview, not just the WebGL related links.
 

Attachments

  • Screenshot 2025-07-03 165256.png
    Screenshot 2025-07-03 165256.png
    135 KB · Views: 35
Upvote 0

max123

Well-Known Member
Licensed User
Longtime User
Something do not return to me....
This is my Inno Setup script:
B4X:
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "VideoPlayer"
#define MyAppVersion "1.2"
#define MyAppPublisher "DigitalRobotics"
#define MyAppExeName "VideoPlayer.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{A338886B-6B36-9CC2-BBBE-4377EAC4692C}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
DefaultDirName={pf}\{#MyAppPublisher}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputDir=.
Compression=lzma
SolidCompression=yes
SetupIconFile=icon.ico
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
OutputBaseFilename=Setup {#MyAppName}
UninstallDisplayIcon={app}\{#MyAppExeName}
VersionInfoVersion=1.0.0.0
ChangesAssociations=yes
;ChangesAssociations setup .iss script forces Explorer to refresh its file extensions so that the
;icon you specify will be shown on the associated files without a logoff/restart being necessary.
;Su Windows 11 sembra che le icone siano viste senza fare logoff.

[Languages]
Name: english; MessagesFile: compiler:Default.isl

[Tasks]
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked

[Files]
Source: build\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: {group}\{#MyAppName}; Filename: {app}\{#MyAppExeName}
Name: {commondesktop}\{#MyAppName}; Filename: {app}\{#MyAppExeName}; Tasks: desktopicon

[Run]
Filename: {app}\{#MyAppExeName}; Description: {cm:LaunchProgram,{#MyAppName}}; Flags: nowait postinstall skipifsilent

;[Registry]
;Root: HKCR; SubKey: .rvb; ValueType: string; ValueData: Raw Video Bitmap Files; Flags: uninsdeletekey noerror; Tasks: ; Languages:
;Root: HKCR; SubKey: Raw Video Bitmap Files; ValueType: string; ValueData: Raw Video Bitmap Files; Flags: uninsdeletekey noerror
;Root: HKCR; SubKey: Raw Video Bitmap Files\Shell\Open\Command; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletevalue noerror
;Root: HKCR; Subkey: Raw Video Bitmap Files\DefaultIcon; ValueType: string; ValueData: {app}\{#MyAppExeName},0; Flags: uninsdeletevalue noerror

[Registry]
Root: HKCR; SubKey: .rvb; ValueType: string; ValueData: Raw Video Bitmap Files; Flags: uninsdeletekey noerror; Tasks: ; Languages:
Root: HKCR; SubKey: Raw Video Bitmap Files; ValueType: string; ValueData: Raw Video Bitmap Files; Flags: uninsdeletekey noerror
Root: HKCR; SubKey: Raw Video Bitmap Files\Shell\Open\Command; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletevalue noerror
Root: HKCR; Subkey: Raw Video Bitmap File\DefaultIcon; ValueType: string; ValueData: {app}\bin\raw_video_bitmap_icon.ico,0; Flags: uninsdeletevalue noerror
Root: HKCR; SubKey: .rvj; ValueType: string; ValueData: Raw Video Jpeg Files; Flags: uninsdeletekey noerror; Tasks: ; Languages:
Root: HKCR; SubKey: Raw Video Jpeg Files; ValueType: string; ValueData: Raw Video Jpeg Files; Flags: uninsdeletekey noerror
Root: HKCR; SubKey: Raw Video Jpeg Files\Shell\Open\Command; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletevalue noerror
Root: HKCR; Subkey: Raw Video Jpeg File\DefaultIcon; ValueType: string; ValueData: {app}\bin\raw_video_jpeg_icon.ico,0; Flags: uninsdeletevalue noerror

Even I used these in the IDE:
B4X:
    #CustomBuildAction: After Packager, %WINDIR%\System32\robocopy.exe, ..\ temp\build\bin\ raw_video_bitmap_icon.ico
    #CustomBuildAction: After Packager, %WINDIR%\System32\robocopy.exe, ..\ temp\build\bin\ raw_video_jpeg_icon.ico
and copied the icon files to project folder, but after installation, both .rvb and .rvj have te same icon, the app icon, the copied icons are not used at all.

May I'm doing something wrong here ?

Even there is a strange thing, I compiled the app that show Args(0) on a message box,
when I double-click on .rvb file, it open the app and show the file path,
when I double-click on .rvj file, it open the app but the messagebox is void, it do not show the file path here
..... So for sure I managed something wrong. These lines probably contais something wrong:
B4X:
[Registry]
Root: HKCR; SubKey: .rvb; ValueType: string; ValueData: Raw Video Bitmap Files; Flags: uninsdeletekey noerror; Tasks: ; Languages:
Root: HKCR; SubKey: Raw Video Bitmap Files; ValueType: string; ValueData: Raw Video Bitmap Files; Flags: uninsdeletekey noerror
Root: HKCR; SubKey: Raw Video Bitmap Files\Shell\Open\Command; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletevalue noerror
Root: HKCR; Subkey: Raw Video Bitmap File\DefaultIcon; ValueType: string; ValueData: {app}\bin\raw_video_bitmap_icon.ico,0; Flags: uninsdeletevalue noerror
Root: HKCR; SubKey: .rvj; ValueType: string; ValueData: Raw Video Jpeg Files; Flags: uninsdeletekey noerror; Tasks: ; Languages:
Root: HKCR; SubKey: Raw Video Jpeg Files; ValueType: string; ValueData: Raw Video Jpeg Files; Flags: uninsdeletekey noerror
Root: HKCR; SubKey: Raw Video Jpeg Files\Shell\Open\Command; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletevalue noerror
Root: HKCR; Subkey: Raw Video Jpeg File\DefaultIcon; ValueType: string; ValueData: {app}\bin\raw_video_jpeg_icon.ico,0; Flags: uninsdeletevalue noerror

The associations of .rvb and .rvj files are successfully added to Windows, I can see it on Default Apps/Files by extensions, but the icons doesnt' works and .rvj do not return the path in Args(0).

Attached a screeshot.
 

Attachments

  • Screenshot 2025-07-03 191404.png
    Screenshot 2025-07-03 191404.png
    125.6 KB · Views: 36
Last edited:
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
You can link all my tutorials you see on my overview, not just the WebGL related links.
Thank you, I will, but I don't want to "monopolise" posting in the FB Group... We need it to be ALIVE and for that it need members posting!
So I would prefer you would join and post... of course, if you don't want to join, it's fine and I will post...
 
Upvote 0

fernando1987

Active Member
Licensed User
Something do not return to me....
This is my Inno Setup script:
B4X:
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "VideoPlayer"
#define MyAppVersion "1.2"
#define MyAppPublisher "DigitalRobotics"
#define MyAppExeName "VideoPlayer.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{A338886B-6B36-9CC2-BBBE-4377EAC4692C}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
DefaultDirName={pf}\{#MyAppPublisher}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputDir=.
Compression=lzma
SolidCompression=yes
SetupIconFile=icon.ico
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
OutputBaseFilename=Setup {#MyAppName}
UninstallDisplayIcon={app}\{#MyAppExeName}
VersionInfoVersion=1.0.0.0
ChangesAssociations=yes
;ChangesAssociations setup .iss script forces Explorer to refresh its file extensions so that the
;icon you specify will be shown on the associated files without a logoff/restart being necessary.
;Su Windows 11 sembra che le icone siano viste senza fare logoff.

[Languages]
Name: english; MessagesFile: compiler:Default.isl

[Tasks]
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked

[Files]
Source: build\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: {group}\{#MyAppName}; Filename: {app}\{#MyAppExeName}
Name: {commondesktop}\{#MyAppName}; Filename: {app}\{#MyAppExeName}; Tasks: desktopicon

[Run]
Filename: {app}\{#MyAppExeName}; Description: {cm:LaunchProgram,{#MyAppName}}; Flags: nowait postinstall skipifsilent

;[Registry]
;Root: HKCR; SubKey: .rvb; ValueType: string; ValueData: Raw Video Bitmap Files; Flags: uninsdeletekey noerror; Tasks: ; Languages:
;Root: HKCR; SubKey: Raw Video Bitmap Files; ValueType: string; ValueData: Raw Video Bitmap Files; Flags: uninsdeletekey noerror
;Root: HKCR; SubKey: Raw Video Bitmap Files\Shell\Open\Command; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletevalue noerror
;Root: HKCR; Subkey: Raw Video Bitmap Files\DefaultIcon; ValueType: string; ValueData: {app}\{#MyAppExeName},0; Flags: uninsdeletevalue noerror

[Registry]
Root: HKCR; SubKey: .rvb; ValueType: string; ValueData: Raw Video Bitmap Files; Flags: uninsdeletekey noerror; Tasks: ; Languages:
Root: HKCR; SubKey: Raw Video Bitmap Files; ValueType: string; ValueData: Raw Video Bitmap Files; Flags: uninsdeletekey noerror
Root: HKCR; SubKey: Raw Video Bitmap Files\Shell\Open\Command; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletevalue noerror
Root: HKCR; Subkey: Raw Video Bitmap File\DefaultIcon; ValueType: string; ValueData: {app}\bin\raw_video_bitmap_icon.ico,0; Flags: uninsdeletevalue noerror
Root: HKCR; SubKey: .rvj; ValueType: string; ValueData: Raw Video Jpeg Files; Flags: uninsdeletekey noerror; Tasks: ; Languages:
Root: HKCR; SubKey: Raw Video Jpeg Files; ValueType: string; ValueData: Raw Video Jpeg Files; Flags: uninsdeletekey noerror
Root: HKCR; SubKey: Raw Video Jpeg Files\Shell\Open\Command; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletevalue noerror
Root: HKCR; Subkey: Raw Video Jpeg File\DefaultIcon; ValueType: string; ValueData: {app}\bin\raw_video_jpeg_icon.ico,0; Flags: uninsdeletevalue noerror

Even I used these in the IDE:
B4X:
    #CustomBuildAction: After Packager, %WINDIR%\System32\robocopy.exe, ..\ temp\build\bin\ raw_video_bitmap_icon.ico
    #CustomBuildAction: After Packager, %WINDIR%\System32\robocopy.exe, ..\ temp\build\bin\ raw_video_jpeg_icon.ico
and copied the icon files to project folder, but after installation, both .rvb and .rvj have te same icon, the app icon, the copied icons are not used at all.

May I'm doing something wrong here ?

Even there is a strange thing, I compiled the app that show Args(0) on a message box,
when I double-click on .rvb file, it open the app and show the file path,
when I double-click on .rvj file, it open the app but the messagebox is void, it do not show the file path here
..... So for sure I managed something wrong. These lines probably contais something wrong:
B4X:
[Registry]
Root: HKCR; SubKey: .rvb; ValueType: string; ValueData: Raw Video Bitmap Files; Flags: uninsdeletekey noerror; Tasks: ; Languages:
Root: HKCR; SubKey: Raw Video Bitmap Files; ValueType: string; ValueData: Raw Video Bitmap Files; Flags: uninsdeletekey noerror
Root: HKCR; SubKey: Raw Video Bitmap Files\Shell\Open\Command; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletevalue noerror
Root: HKCR; Subkey: Raw Video Bitmap File\DefaultIcon; ValueType: string; ValueData: {app}\bin\raw_video_bitmap_icon.ico,0; Flags: uninsdeletevalue noerror
Root: HKCR; SubKey: .rvj; ValueType: string; ValueData: Raw Video Jpeg Files; Flags: uninsdeletekey noerror; Tasks: ; Languages:
Root: HKCR; SubKey: Raw Video Jpeg Files; ValueType: string; ValueData: Raw Video Jpeg Files; Flags: uninsdeletekey noerror
Root: HKCR; SubKey: Raw Video Jpeg Files\Shell\Open\Command; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletevalue noerror
Root: HKCR; Subkey: Raw Video Jpeg File\DefaultIcon; ValueType: string; ValueData: {app}\bin\raw_video_jpeg_icon.ico,0; Flags: uninsdeletevalue noerror

The associations of .rvb and .rvj files are successfully added to Windows, I can see it on Default Apps/Files by extensions, but the icons doesnt' works and .rvj do not return the path in Args(0).

Attached a screeshot.
I have added file associations in at least three different source codes of mine, and in one of them, I even implemented a custom context menu for the extensions. In all those cases, the functionality worked correctly and the associations were applied without any issues.
I’m not an expert in this, but I hope the correction I’m sharing can be helpful and assist in resolving the problem you’re experiencing.

ino setup:
[Files]
Source: build\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs
Source: build\raw_video_bitmap_icon.ico; DestDir: {app}; Flags: ignoreversion
Source: build\raw_video_jpeg_icon.ico; DestDir: {app}; Flags: ignoreversion

[Registry]
Root: HKCR; Subkey: ".rvb"; ValueType: string; ValueData: "RawVideoBitmapFile"; Flags: uninsdeletekey
Root: HKCR; Subkey: "RawVideoBitmapFile"; ValueType: string; ValueData: "Raw Video Bitmap File"; Flags: uninsdeletekey
Root: HKCR; Subkey: "RawVideoBitmapFile\Shell\Open\Command"; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletekey
Root: HKCR; Subkey: "RawVideoBitmapFile\DefaultIcon"; ValueType: string; ValueData: "{app}\raw_video_bitmap_icon.ico,0"; Flags: uninsdeletevalue

Root: HKCR; Subkey: ".rvj"; ValueType: string; ValueData: "RawVideoJpegFile"; Flags: uninsdeletekey
Root: HKCR; Subkey: "RawVideoJpegFile"; ValueType: string; ValueData: "Raw Video Jpeg File"; Flags: uninsdeletekey
Root: HKCR; Subkey: "RawVideoJpegFile\Shell\Open\Command"; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletekey
Root: HKCR; Subkey: "RawVideoJpegFile\DefaultIcon"; ValueType: string; ValueData: "{app}\raw_video_jpeg_icon.ico,0"; Flags: uninsdeletevalue
 
Last edited:
Upvote 0

max123

Well-Known Member
Licensed User
Longtime User
Thanks @fernando1987 I will try it, actually I solved the problem for the icon copy, I had to place them on the root project folder, non in the Objects folder. After that the icons are successfully copied to /temp/build/bin, but after installing the app, both extensions are associated to Win, but all files (rvb and rvj no matter) have just the app icon and I can get the file path only on .rvb but not on .rvj files. I will try to experiment with your script and compare with mine. Thanks
 
Upvote 0

Chris2

Active Member
Licensed User
Longtime User
but all files (rvb and rvj no matter) have just the app icon
I have found in the past that the icon associations sometimes need a PC reboot in order to be updated. Particularly when you are running multiple installation routines and tweaking things. For some reason WIndows sometimes seems to remember the old icon that was associated with a file type.
 
Upvote 0

Chris2

Active Member
Licensed User
Longtime User
Also, if you're copying the icon files to the ...\bin\ folder as in:
B4X:
 #CustomBuildAction: After Packager, %WINDIR%\System32\robocopy.exe, ..\ temp\build\bin\ raw_video_bitmap_icon.ico
then the DefaultIcon line for each file type should point to the installed apps bin folder too:
B4X:
Root: HKCR; Subkey: "RawVideoBitmapFile\DefaultIcon"; ValueType: string; ValueData: "{app}\bin\raw_video_bitmap_icon.ico,0"; Flags: uninsdeletevalue  noerror
 
Upvote 0

max123

Well-Known Member
Licensed User
Longtime User
Yes, I've done it, but without success, even .rvj do not return the path. I think that here there are something wrong, may I have to use double quotes.....
B4X:
[Registry]
Root: HKCR; SubKey: .rvb; ValueType: string; ValueData: Raw Video Bitmap Files; Flags: uninsdeletekey noerror; Tasks: ; Languages:
Root: HKCR; SubKey: Raw Video Bitmap Files; ValueType: string; ValueData: Raw Video Bitmap Files; Flags: uninsdeletekey noerror
Root: HKCR; SubKey: Raw Video Bitmap Files\Shell\Open\Command; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletevalue noerror
Root: HKCR; Subkey: Raw Video Bitmap File\DefaultIcon; ValueType: string; ValueData: {app}\bin\raw_video_bitmap_icon.ico,0; Flags: uninsdeletevalue noerror

Root: HKCR; SubKey: .rvj; ValueType: string; ValueData: Raw Video Jpeg Files; Flags: uninsdeletekey noerror; Tasks: ; Languages:
Root: HKCR; SubKey: Raw Video Jpeg Files; ValueType: string; ValueData: Raw Video Jpeg Files; Flags: uninsdeletekey noerror
Root: HKCR; SubKey: Raw Video Jpeg Files\Shell\Open\Command; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletevalue noerror
Root: HKCR; Subkey: Raw Video Jpeg File\DefaultIcon; ValueType: string; ValueData: {app}\bin\raw_video_jpeg_icon.ico,0; Flags: uninsdeletevalue noerror

@fernando1987 This is different that mine, I only have the first line, even you used double quotes on registry keys, effectively they are strings:
B4X:
[Files]
Source: build\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs
Source: build\raw_video_bitmap_icon.ico; DestDir: {app}; Flags: ignoreversion
Source: build\raw_video_jpeg_icon.ico; DestDir: {app}; Flags: ignoreversion
 
Last edited:
Upvote 0

max123

Well-Known Member
Licensed User
Longtime User
Ok, another problem solved. Now I can see different icon for both file types.
This changed uncommenting this line, probably as @Chris2 says I had to reboot or logoff,
but with this line commented after app installation it see all .rvb and .rvj files with app icon (not format icon) automatically, without need a logoff or reboot:
B4X:
ChangesAssociations=yes
;ChangesAssociations setup .iss script forces Explorer to refresh its file extensions so that the
;icon you specify will be shown on the associated files without a logoff/restart being necessary.
;Su Windows 11 sembra che le icone siano viste senza fare logoff.
and adding these lines in [Files] section (thanks @fernando1987 for the tip)
B4X:
Source: build\raw_video_bitmap_icon.ico; DestDir: {app}; Flags: ignoreversion
Source: build\raw_video_jpeg_icon.ico; DestDir: {app}; Flags: ignoreversion

Now remain just one problem, .rvb files return the path, but .rvj do not, and I don't know because this happen, the simple code is equal for both extensions, just show a messagebox with Args(0) that should be the file path.

When I click on both files types the app open successfully.

The one on the left is by double-click on .rvb file, the one on the right is by double-click on .rvj file.

1751621854479.png

Here is my last script:
B4X:
#define MyAppName "VideoPlayer"
#define MyAppVersion "1.2"
#define MyAppPublisher "DigitalRobotics"
#define MyAppExeName "VideoPlayer.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{A338886B-6B36-9CC2-BBBE-4377EAC4692C}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
DefaultDirName={pf}\{#MyAppPublisher}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputDir=.
Compression=lzma
SolidCompression=yes
SetupIconFile=icon.ico
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
OutputBaseFilename=Setup {#MyAppName}
UninstallDisplayIcon={app}\{#MyAppExeName}
VersionInfoVersion=1.0.0.0
ChangesAssociations=yes 
;ChangesAssociations setup .iss script forces Explorer to refresh its file extensions so that the
;icon you specify will be shown on the associated files without a logoff/restart being necessary.
;Su Windows 11 sembra che le icone siano viste senza fare logoff.

[Languages]
Name: english; MessagesFile: compiler:Default.isl

[Tasks]
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked

[Files]
Source: build\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs
Source: build\raw_video_bitmap_icon.ico; DestDir: {app}; Flags: ignoreversion
Source: build\raw_video_jpeg_icon.ico; DestDir: {app}; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: {group}\{#MyAppName}; Filename: {app}\{#MyAppExeName}
Name: {commondesktop}\{#MyAppName}; Filename: {app}\{#MyAppExeName}; Tasks: desktopicon

[Run]
Filename: {app}\{#MyAppExeName}; Description: {cm:LaunchProgram,{#MyAppName}}; Flags: nowait postinstall skipifsilent

[Registry]
Root: HKCR; Subkey: ".rvb"; ValueType: string; ValueData: "RawVideoBitmapFile"; Flags: uninsdeletekey
Root: HKCR; Subkey: "RawVideoBitmapFile"; ValueType: string; ValueData: "Raw Video Bitmap File"; Flags: uninsdeletekey
Root: HKCR; Subkey: "RawVideoBitmapFile\Shell\Open\Command"; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletekey
Root: HKCR; Subkey: "RawVideoBitmapFile\DefaultIcon"; ValueType: string; ValueData: "{app}\raw_video_bitmap_icon.ico,0"; Flags: uninsdeletevalue

Root: HKCR; Subkey: ".rvj"; ValueType: string; ValueData: "RawVideoJpegFile"; Flags: uninsdeletekey
Root: HKCR; Subkey: "RawVideoJpegFile"; ValueType: string; ValueData: "Raw Video Jpeg File"; Flags: uninsdeletekey
Root: HKCR; Subkey: "RawVideoJpegFile\Shell\Open\Command"; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletekey
Root: HKCR; Subkey: "RawVideoJpegFile\DefaultIcon"; ValueType: string; ValueData: "{app}\raw_video_jpeg_icon.ico,0"; Flags: uninsdeletevalue
 
Last edited:
Upvote 0

Chris2

Active Member
Licensed User
Longtime User
Source: build\raw_video_bitmap_icon.ico; DestDir: {app}; Flags: ignoreversion Source: build\raw_video_jpeg_icon.ico; DestDir: {app}; Flags: ignoreversion
I'm not sure why you need to add those. I'd have thought that the build\* line would copy everything in build\.
Anyway, if it works, it works!
Although, copying 'build\raw_video_bitmap_icon.ico' implies to me that the icon files are in the \build\ folder, not \build\bin\?
Now remain just one problem, .rvb files return the path, but .rvj do not
What do you have in your AppStart sub?
 
Last edited:
Upvote 0

max123

Well-Known Member
Licensed User
Longtime User
I'm not sure why you need to add those. I'd have thought that the build\* line would copy everyting in build\.
Anyway, if it works, it works!
Although, copying 'build\raw_video_bitmap_icon.ico' implies to me that the icon files are in the \build\ folder, not \build\bin\?
I've changed this in the source code:
B4X:
#Region Project Attributes
    #MainFormWidth: 600
    #MainFormHeight: 600
    '#CommandLineArgs: /Path/To/My/Video.rvb
    #PackagerProperty: IconFile = ..\Files\icon_launcher.ico
    #PackagerProperty: ExeName = VideoPlayer
    '#CustomBuildAction: After Packager, %WINDIR%\System32\robocopy.exe, ..\ temp\build\bin\ raw_video_bitmap_icon.ico
    '#CustomBuildAction: After Packager, %WINDIR%\System32\robocopy.exe, ..\ temp\build\bin\ raw_video_jpeg_icon.ico
    #CustomBuildAction: After Packager, %WINDIR%\System32\robocopy.exe, ..\ temp\build\ raw_video_bitmap_icon.ico
    #CustomBuildAction: After Packager, %WINDIR%\System32\robocopy.exe, ..\ temp\build\ raw_video_jpeg_icon.ico
#End Region
AppStart Sub, on B4XPage_Created I only have a messagebox that show FilePath:
B4X:
Sub AppStart (Form1 As Form, Args() As String)
 
    MainForm = Form1
    MainForm.Show
 
    If Args.Length > 0 Then
        Try
            Dim path As String = Args(0)
            If File.Exists(path, "") And path.ToLowerCase.EndsWith(".rvb") Then 'don't assume that it is a valid path
                'ListView1.Items.AddAll(File.ReadList(Args(0), ""))
                FilePath = path
                'File.GetFileParent(
            End If
        Catch
            Log(LastException)
        End Try
    End If
 
    Dim PagesManager As B4XPagesManager
    PagesManager.Initialize(MainForm)
End Sub
I post here my simple project and my last .iss script is on post #36, all works now, except .rvj do not return the file path in Args(0).

EDIT: I found the problem.....:) this line:
B4X:
If File.Exists(path, "") And path.ToLowerCase.EndsWith(".rvb") Then 'don't assume that it is a valid path
only filter .rvb files
Now changed to:
B4X:
If File.Exists(path, "") And (path.ToLowerCase.EndsWith(".rvb") Or path.ToLowerCase.EndsWith(".rvj")) Then 'don't assume that it is a valid path

Note that during these tests I never rebooted my pc, in fact it is powered from 2 days, and no logged off my session. So is not right the fact that it need reboot, at least my Win11. Now I will try to uninstall and reinstall all to well know if windows see icons and file associations, probably the latest test, .rvj files path should be now returned.

For additionals icons (not the app icon) probably needed these in [Files] section, when I added these I started to see file icons:
B4X:
Source: build\raw_video_bitmap_icon.ico; DestDir: {app}; Flags: ignoreversion
Source: build\raw_video_jpeg_icon.ico; DestDir: {app}; Flags: ignoreversion
 

Attachments

  • Project.zip
    20.1 KB · Views: 35
Last edited:
Upvote 0

Chris2

Active Member
Licensed User
Longtime User
EDIT: I found the problem.....:) this line:
B4X:
If File.Exists(path, "") And path.ToLowerCase.EndsWith(".rvb") Then 'don't assume that it is a valid path
It's amazing how many times just writing out the code again, or even just copying/pasting it into another place can help you spot something you've been missing :)
 
Upvote 0

max123

Well-Known Member
Licensed User
Longtime User
It's amazing how many times just writing out the code again, or even just copying/pasting it into another place can help you spot something you've been missing :)
Yes... I just edited the iss script, and my B4X code was bad 🤣 🤣 🤣
This is the most simple code I wrote until now, like basic LET a = 1 b = 1 PRINT(a + b) 🤣 🤣 🤣
This confused me. o_O And yes, I noted the error just while I copied/pasted my code to the post.

What is best to use here as copy folder ?
B4X:
    '#CustomBuildAction: After Packager, %WINDIR%\System32\robocopy.exe, ..\ temp\build\bin\ raw_video_bitmap_icon.ico
    '#CustomBuildAction: After Packager, %WINDIR%\System32\robocopy.exe, ..\ temp\build\bin\ raw_video_jpeg_icon.ico
    #CustomBuildAction: After Packager, %WINDIR%\System32\robocopy.exe, ..\ temp\build\ raw_video_bitmap_icon.ico
    #CustomBuildAction: After Packager, %WINDIR%\System32\robocopy.exe, ..\ temp\build\ raw_video_jpeg_icon.ico

EDIT: This screenshot confirm that all works, file associations, different icons for any extension, different icon for main app, when doubleclick the app will open, only Windows require File Manager refresh to see icons after installations. Finally the problems seem solved. I mark the post as SOLVED, if there are problems eventually I will reopen it. So today, another time I learned something new, thanks to all for help, may this post will be useful in future for other users.
1751630000826.png
 
Last edited:
Upvote 0
Top