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
What is best to use here as copy folder ?
I don't think it really matters.
I tend to use the \bin\ folder just because I think it keeps the app root installation folder a bit neater to have just the app exe, release info, and uninstall files in there, with all the other program files hidden away in the \bin subfolder.

The important thing is to make sure you're referencing the same folder in the #CustomBuildAction and the Inno Setup script.
 
Upvote 0

max123

Well-Known Member
Licensed User
Longtime User
There are some differences in flags here fron my previous (not working) to last working, what these will do ?
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

[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

Eg. in the command shell Flags: uninsdeletevalue noerror <versus> Flags: uninsdeletekey
 
Upvote 0

Chris2

Active Member
Licensed User
Longtime User
uninsdeletekey
When the program is uninstalled, delete the entire key, including all values and subkeys in it. It obviously wouldn't be a good idea to use this on a key that is used by Windows itself. You should only use this on keys private to your application.
To prevent disasters, this flag is ignored during installation if Subkey is blank or contains only backslashes.
uninsdeletevalue
Delete the value when the program is uninstalled. This flag can be combined with uninsdeletekeyifempty.
noerror
Don't display an error message if Setup fails to create the key or value for any reason.
 
Upvote 0

max123

Well-Known Member
Licensed User
Longtime User
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
I saw your post. To save time when programming Innosetup scripts, there's a software I've used for a long time to generate or modify Innosetup scripts. It can also compile and generate the installer, perform debugging, and includes several skins.
Check your scripts

1753388914618.png


P.S.: I use this software to create application installers for different Windows development languages.
 
Last edited:
Upvote 0

fernando1987

Active Member
Licensed User
But if you're working with B4J, why not give this tool a try? I built it specifically with B4J projects in mind. It’s designed to make the whole process easier: it automatically detects your project structure, generates a ready-to-compile script, and even lets you include file extensions, context menu options that interact with files or folders, and updates your project with everything needed for compilation.


It’s not meant to replace anything—just a humble contribution to the B4X community. Maybe it’ll save you some time 🙂


👉 https://www.b4x.com/android/forum/t...b4j-apps-into-professional-installers.167921/
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
But if you're working with B4J, why not give this tool a try? I built it specifically with B4J projects in mind. It’s designed to make the whole process easier: it automatically detects your project structure, generates a ready-to-compile script, and even lets you include file extensions, context menu options that interact with files or folders, and updates your project with everything needed for compilation.


It’s not meant to replace anything—just a humble contribution to the B4X community. Maybe it’ll save you some time 🙂


👉 https://www.b4x.com/android/forum/threads/🛠️-inno-setup-generator-–-package-your-b4j-apps-into-professional-installers.167921/
My recommendation is because sometimes it's necessary to install not only JAVA (B4J) components, but also plugins developed in other languages.

Note: This software is an InnoSetup script editor, and compilation is performed with the installed version of the InnoSetup compiler.
 
Upvote 0

max123

Well-Known Member
Licensed User
Longtime User
But if you're working with B4J, why not give this tool a try? I built it specifically with B4J projects in mind. It’s designed to make the whole process easier: it automatically detects your project structure, generates a ready-to-compile script, and even lets you include file extensions, context menu options that interact with files or folders, and updates your project with everything needed for compilation.


It’s not meant to replace anything—just a humble contribution to the B4X community. Maybe it’ll save you some time 🙂


👉 https://www.b4x.com/android/forum/threads/🛠️-inno-setup-generator-–-package-your-b4j-apps-into-professional-installers.167921/
So now I'm so popular..... I inspired you. I'm happy to hear this.... 😃 Thanks @fernando1987 I will try it, but at this time all worked without any additional resources, just used InnoSetup. I can click my files (even different extentions) and they open with my app.
 
Upvote 0

fernando1987

Active Member
Licensed User
So now I'm so popular..... I inspired you. I'm happy to hear this.... 😃 Thanks @fernando1987 I will try it, but at this time all worked without any additional resources, just used InnoSetup. I can click my files (even different extentions) and they open with my app.
That’s awesome to hear! 😊 Let me know how the tests go—whether you encounter any issues or if everything works smoothly. Your feedback will be super helpful for future improvements.

By the way, this tool was actually created to streamline the installer creation process for new members. The goal is to make things easier so more people can join and contribute to this amazing community!
 
Upvote 0
Top