Minimize application and show icon in Notification Area

IoSonoPiero

Active Member
Licensed User
Longtime User
Hello,
some days ago I've posted about the same question in another thread.
Because I'm in trouble, I've started a new thread so If I reach a solution, maybe other users with the same issue can benefit of this.

The matter is:
I want to minimize a form showing an icon in the Notification Area on PPC.
When I click on that icon, the application form will reappear on the screen.

I've tried NotifyIcon, but with 6.80 and optimized compile, it doesn't work.
I've tried ControlsExDevice Notification method, it works, but the icon is showed in the title, not on Notification Area.

So, because probably It's my problem not to understand the matter, can someone help me suggesting what to do or what to read to solve this?

I've searched in the forum a lot, but I'm locked here!

Thanks to all of you that will help me.
 

derez

Expert
Licensed User
Longtime User
I tried this on one of my programs:
-add notify icon (new1 + add)
- add flb.minimizebox
- cancelclose on the form_close

now the main form has X instead of OK, and it minimizes. In today screen the icon is on the bottom right.
To close the application - you must find a way (there is always the reset...)
 

IoSonoPiero

Active Member
Licensed User
Longtime User
I tried this on one of my programs:
-add notify icon (new1 + add)
- add flb.minimizebox
- cancelclose on the form_close

now the main form has X instead of OK, and it minimizes. In today screen the icon is on the bottom right.
To close the application - you must find a way (there is always the reset...)

Ok,
To close the application I can do this via a menu or a button.

Do you have a template or a code fragment to show this to me and others?
So we can create a tutorial for this argument, if you want.
 

derez

Expert
Licensed User
Longtime User
Well, I tried what I told you to do but something is wrong - I don't see the icon.

If you can make the icon show, this would minimize the form when pressing on the OK, and button1 will close it completely.

B4X:
Sub App_Start
   Form1.Show
   ni.new1
   ni.add
   hardware.New1
End Sub

Sub Button1_Click
flag = 1
AppClose
End Sub

Sub form1_close
If flag = 0 Then 
   form1.cancelclose 
   hardware.ShowTodayScreen
End If
End Sub 

Sub ni_click
form1.show
End Sub

Or, with Formlib instead of hardware, using minimizebox (again, since I don't see the icon - I can't check it):
B4X:
flb.New1("form1" ,B4PObject(1) )
    flb.MinimizeBox = True
 
Last edited:

IoSonoPiero

Active Member
Licensed User
Longtime User
Thanks derez.

With NotifyIcon I can't see the icon, because when I try to compile for the device, I receive with the constructor ni.new1:

Error Compiling program.
Error message: error CS1525: ')' è un termine non valido nell'espressione

Line number: x
Line: ni.new1

Note: è un termine non valido nell'espressione (ita) -> it's an invalid term in expression
 
Last edited:

IoSonoPiero

Active Member
Licensed User
Longtime User
derez; said:
Or, with Formlib instead of hardware, using minimizebox (again, since I don't see the icon - I can't check it):
B4X:
flb.New1("form1" ,B4PObject(1) )
    flb.MinimizeBox = True
With this code, I can minimize the Form on device but I can't see the icon, because I receive the usual error if I add the NotifyIcon library and try to compile it!
 

derez

Expert
Licensed User
Longtime User
I tried test3 from the thread and it doesn't show the icon.
I give up.

What I can't understand is what I did in the past to make it work. I have one application where it works.
 
Last edited:

IoSonoPiero

Active Member
Licensed User
Longtime User
Probably an old version of the compiler or some dll will hide the icon.
With actual version of B4P and dll this doesn't happens anymore.
 

IoSonoPiero

Active Member
Licensed User
Longtime User
I am not shure if the attached program does what you are looking for.

It uses the Door library and the Form Activated event.

Best regards.

Hi klaus, the application minimized correctly, yes, but don't show an icon in the lower right Notification Area.

This is my question: why with NotifyIcon I no more can minimize an app and see an icon in Notification Area.
 

derez

Expert
Licensed User
Longtime User
Ghale !

Just to cause you heart aches...

See the attached notify icon of my navigation program, but I don't know why it works there.

I will look at it thoroughly tomorrow.

Edit:
I couldn't wait till tomorrow, found it :icon_clap:

You must have an icon for the program, then this icon will appear minimized...

Tha attached program works.
 

Attachments

  • notify.jpg
    notify.jpg
    22 KB · Views: 258
  • test.zip
    791 bytes · Views: 298
Last edited:

IoSonoPiero

Active Member
Licensed User
Longtime User
Ghale !

Just to cause you heart aches...

See the attached notify icon of my navigation program, but I don't know why it works there.

I will look at it thoroughly tomorrow.

LOL!
Thank you derez, thank you.

I'll remember this... I'll remember...:cool:
 

IoSonoPiero

Active Member
Licensed User
Longtime User
derez said:
I couldn't wait till tomorrow, found it :icon_clap:

You must have an icon for the program, then this icon will appear minimized...

Tha attached program works.

Well, this code ... won't compile!!

If I compile from my PC I receive the message:
B4X:
Error Compiling program.
Error message: error CS1525: ')' [I]è un termine non valido nell'espressione[/I].

Line number: 8
Line: ni.new1
:BangHead::BangHead::BangHead:

What I have to do? :sign0148:
 

Cableguy

Expert
Licensed User
Longtime User
You need to add the ni(notify icon???) dll, through the usual way... components, etc..
 

IoSonoPiero

Active Member
Licensed User
Longtime User
You need to add the ni(notify icon???) dll, through the usual way... components, etc..

Ehm, Cableguy... I always added the dll...

The error is for the constructor ni, but the error is not referred to an uniniziatized object.
You draw me really noob!
 

klaus

Expert
Licensed User
Longtime User
Hi derez,

With what compiler did you compile your navigation program ?

With the sample program of post #4 when optimized compiled I get the same error as ghale pointed out by.
With non optimized compiled there is no error. But on my old Qtek 9090 (WM 2003) there is no icon shown. All dll's and ni.ico copied to the device.

With the program in post #9 the icon is shown, on my htc Touch HD in the task manager on top right of the screen (bug V13).

Best regards.
 

IoSonoPiero

Active Member
Licensed User
Longtime User
Klaus, you always precede me, LOL.

I'm downloading Microsoft® .NET Framework Version 1.1 Redistributable Package to test the non-optimized compilation.

I can stop, now, you give me the answer, thanks!
 

Cableguy

Expert
Licensed User
Longtime User
Ehm, Cableguy... I always added the dll...

The error is for the constructor ni, but the error is not referred to an uniniziatized object.
You draw me really noob!

Sorry!!!It was NOT intented to...:sign0013::sign0188:
 
Top