App Developer How to open a Browser Page

Post here to discuss any new features, components, chips, etc, that you would like to see in Flowcode.
Post Reply
stefan.erni
Valued Contributor
Posts: 752
http://meble-kuchenne.info.pl
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

App Developer How to open a Browser Page

Post by stefan.erni »

Hi Ben

In C# it's easy to start the IE explorer and open a page just with pressing a button

Is there a way to to this in the App Developer?

regards

Stefan

Code: Select all

       private void button2_Click(object sender, EventArgs e)
        {
            string target = "https://www.flowcodexchange.com/";
            try
            {
                System.Diagnostics.Process.Start(target);
            }
            catch (System.ComponentModel.Win32Exception noBrowser)
            {
                if (noBrowser.ErrorCode == -2147467259)
                    MessageBox.Show(noBrowser.Message);
            }
            catch (System.Exception other)
            {
                MessageBox.Show(other.Message);
            }

        }

Steve-Matrix
Matrix Staff
Posts: 1249
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 167 times
Been thanked: 277 times

Re: App Developer How to open a Browser Page

Post by Steve-Matrix »

Hi Stefan,

I don't know any simple way of doing this in Flowcode, but I might be able to add a new Build-in Function.

That said, Ben might know a way...

stefan.erni
Valued Contributor
Posts: 752
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: App Developer How to open a Browser Page

Post by stefan.erni »

Hi Steve

like a little hint
The Datarecorder has a button " ? "
If I press it, in the running app,
it's open the IE explorer with the wiki from flowcode.
A button that I can choose the page...
regards

Stefan
browser_App_2021-02-26_13-30-42.png
browser_App_2021-02-26_13-30-42.png (152.79 KiB) Viewed 4277 times

BenR
Matrix Staff
Posts: 1726
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 438 times
Been thanked: 602 times

Re: App Developer How to open a Browser Page

Post by BenR »

Hi Stefan,

Just a thought but can your C# code be put into a DLL. If it can then Flowcode can call DLL functions.

https://www.matrixtsl.com/blog/expandin ... sing-dlls/

stefan.erni
Valued Contributor
Posts: 752
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: App Developer How to open a Browser Page

Post by stefan.erni »

Hi Ben

Ok I saw how it's works.

I think I can do something like the test function.


Code: Select all


	//Test Function
	DECLDIR unsigned char Add( unsigned char a, unsigned char b )
	{
		return (a+b);
	}
	/Open Explorer Function from Stefan
	DECLDIR OpenWebsite (char * cpURL)
        {
                 ShellExecute (NULL, "open", cpURL, NULL, NULL, SW_SHOWNORMAL);
         }
		
		
		
		//OpenIEE Function
	DECLDIR unsigned OpenIEE( String a)
	{
		return ;
	}
	
	
	
But your sample for the DLL is already old. It's for Visualstudio 2008.
If I open it with VS2019 I get some errors.

I will have look about it



There is second wish
How to start a batch file from App Developper?

If I put this text in a batchfile it's starts the page in the IE

Code: Select all

start msedge https://www.flowcodexchange.com/
regards

Stefan

Time-Date-String.zip
(7.14 KiB) Downloaded 155 times
Cpp_2021-03-01_17-36-49.png
Cpp_2021-03-01_17-36-49.png (157.89 KiB) Viewed 4224 times

BenR
Matrix Staff
Posts: 1726
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 438 times
Been thanked: 602 times

Re: App Developer How to open a Browser Page

Post by BenR »

This one was done a lot more recently, hopefully shoud give you more joy.
Keyboard.zip
(26.33 KiB) Downloaded 181 times

stefan.erni
Valued Contributor
Posts: 752
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: App Developer How to open a Browser Page

Post by stefan.erni »

Hi Ben


Yes. Thanks a lot.

========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========


I saw the the sample ReadDate.fcm is also old and FC8 has the dll on a different place.

Is it possible to have the keyboard.fcm from FC9 ?

regards

Stefan

BenR
Matrix Staff
Posts: 1726
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 438 times
Been thanked: 602 times

Re: App Developer How to open a Browser Page

Post by BenR »

Hi Stefan,

Here you go.

Code: Select all

GetKeyPress:DLLs[$(appdir)API.DLL\Keyboard.dll]
DLL_Call_Macro.jpg
DLL_Call_Macro.jpg (31.24 KiB) Viewed 4200 times
If you look at te Build -> Compiler Options window then you can see all the useful directories available and their variable name.

e.g.

$(appdir) or $(srcdir)
Dirs.jpg
Dirs.jpg (107.44 KiB) Viewed 4199 times

stefan.erni
Valued Contributor
Posts: 752
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: App Developer How to open a Browser Page

Post by stefan.erni »

Hi Ben

I changed the keyboard dll. When I press the a key, it becomes retval 10 and starts the explorer with the desired page. It's working!

well I have to see how I can make more meaningful

regards

Stefan

Code: Select all

     #include <shellapi.h>
     DECLDIR unsigned char GetKeyPress(unsigned char key)
    {
        unsigned int ret;
        unsigned char retval = 0;
        ret = GetAsyncKeyState(key);
        if (ret & 0x0001)
            retval = 10;
        if (ret & 0x8000)
            retval = 10;
        if (retval==10)
            ShellExecute(0, 0, L"https://www.flowcodexchange.com/", 0, 0, SW_SHOW);
            return retval;
    }

Post Reply