Page 1 of 1

App Developer How to open a Browser Page

Posted: Fri Feb 26, 2021 10:37 am
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);
            }

        }

Re: App Developer How to open a Browser Page

Posted: Fri Feb 26, 2021 11:00 am
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...

Re: App Developer How to open a Browser Page

Posted: Fri Feb 26, 2021 12:44 pm
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 8395 times

Re: App Developer How to open a Browser Page

Posted: Mon Mar 01, 2021 12:14 pm
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/

Re: App Developer How to open a Browser Page

Posted: Mon Mar 01, 2021 5:03 pm
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 580 times
Cpp_2021-03-01_17-36-49.png
Cpp_2021-03-01_17-36-49.png (157.89 KiB) Viewed 8342 times

Re: App Developer How to open a Browser Page

Posted: Mon Mar 01, 2021 5:17 pm
by BenR
This one was done a lot more recently, hopefully shoud give you more joy.
Keyboard.zip
(26.33 KiB) Downloaded 521 times

Re: App Developer How to open a Browser Page

Posted: Mon Mar 01, 2021 5:48 pm
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

Re: App Developer How to open a Browser Page

Posted: Tue Mar 02, 2021 2:56 pm
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 8318 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 8317 times

Re: App Developer How to open a Browser Page

Posted: Tue Mar 02, 2021 4:30 pm
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;
    }