INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

How to notify users on new message, chat, end date of something in a vfp application.

How to notify users on new message, chat, end date of something in a vfp application.

How to notify users on new message, chat, end date of something in a vfp application.

(OP)
I want to make a new project of notifying users about new message, chat, and many other things like end date of something. The notification would be like gmail(new mail) or skype (somebody is online, new message). Is there any reference link or idea to start with?

RE: How to notify users on new message, chat, end date of something in a vfp application.

Yes, it is possible to do that sort of thing, but you must first decide how you want to do the notification. For example, it is perfectly possible to send an email from your application. But we can't be expected to guess what method you prefer to use.

If you decide on sending an email, there are several examples in the FAQs that will show you how to go about it. This is the method I prefer: FAQ184-4969: How to send e-mail using CDO and checking the connection status first.. But that's not the only approach.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: How to notify users on new message, chat, end date of something in a vfp application.

(OP)
Thank you Mike for the quick reply.
I try to present a more clear picture.
Suppose there is an administrator-client scenario with a workgroup of over 10 users all working on a vfp application at different locations.
Case1: Administrator wants to notify 3 of the users say 'abc string'. Now that 'abc string' should pop up on the right bottom of the screen of those users as say baloon notification.
Csse2: Mr. X mails something to Mr. Y.
Y is working on the software. A small message popped up in the same way to notify him that he has just now received a mail.
Case3: There are a few things pending say payment of some bill and it's last date is approaching. Message like '4 days left of payment of electricity bill', '3 days left of telephone bill' popping up once or twice a day to remind unless the pending is cleared.

RE: How to notify users on new message, chat, end date of something in a vfp application.

If all the users are working in their VFP application, and if the application shares a common database or server, then you don't need to use email (or Skype, or any other third-party tool).

What you do is have the sender (the user who needs to initiate the notification) set a flag somewhere in the database. "Set a flag" could mean setting a certain logical field to .T., or storing some sort of message in a character field, or creating a simple text file in a given directory that contains the message, or anything similar.

The other users (the ones who will receive the notification) will have a timer that fires, say, every 60 seconds. The timer will check to see if the flag is set. If it is, their application will display the form that contains the notification.

That form would be a top-level always-on-top form. Making it pop up in the corner of the screen would be no problem.

The above is a bit of an over-simplification. You also need to think about how and when you clear the flag (keeping in mind that not all users will be using the application at the time that the flag is set) and a few other issues. But it should give you the general idea.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: How to notify users on new message, chat, end date of something in a vfp application.

I second Mike. Also for the simple reason it is much simpler to create a balloon tip or anything else locally by the client and not remotely.

You know a mail sent to a client causes that balloon tip like message, but that is done by Outlook and doesn't happen with other mail clients the same way, if at all, so what happens is Outlook creates such notification windows when receiving mails. So this has the same general solution approach as Mike proposed, the local application reacts to messages it polls from somewhere. In case of Outlook thats it looking for new mails on the mail server every 10 minutes instead of data your EXE would look for frequently enough in a table or files your EXE would look for in a file share and then creates such notification popups, so sending the mail only triggers these notification popups indirectly.

VFP has CREATEOBJECTEX() to directly create objects on remote computers, so any client can tell another client to create an object and then run some code, without going through any server. That only applies to COM classes and would need a high privilege to be given to someone to be enabled to do such remote code execution. I'd think twice before using that feature, I never used this facility. CREATEOBJECTEX() requires to specify a remote computername, that must be known in the LAN/WAN/VPN. I wouldn't go that direction merely by the complications of the setup and user rights management involved even if the outset would only be the LAN.

Mikes proposed and recommended solution needs a common data source and all clients can push in notifications and pull out which are for themselves, that is a sensible solution and even if you don't yet have such a data source, it's easy to get a MySQL or MSSQL database somewhere central in the internet. Gloabl access will then mean faster or slower access and only a cloud service providing a seeming central database on synced data centers will level that effect. So to avoid that effect of a central instance another obvious solution is doing that yourself, use local database servers, which sync by replication.

If you want to have real push notifications, which appear as immediate as possible at a client, Skype messages or such instant message services surely work best. In detail these things need you to work with an API that's not as easy to use as mail. The only thing I ever did was using the Twitter API, but Twitter wouldn't be an appropriate messaging solution to use for business, even if you would think about direct (private) messaeges only. Any such service has the disadvantage ofgoing through something external. Mail is kind of a push notification but as already said the real actor is the mail client. Indeed you cannot only rely on the Outlook popups appearing and showing your subject line, your EXE could read from the inbox and let anything happen triggered by any information in such mails. Again, all messages go through most probably third party mail servers.

Further and older (mature) technologies exist that are meant for client to client or peer to peer communication, the message queue (MSMQ) for example, but that's something I never used, it also needs the client to look into such a queue. Also newer services,I thnk the latest is WNS - Windows Push Notification Services - but that only applies to Tile or Universal Windows apps, not to Desktop Win32 apps and involves you to setup the server side as an Azure cloud service. In the end I don't know the details, but I come to the conclusion a client side subscription to any type of notification source or channel will be polling for new messages. In the end any push notification depends on something polling or listening for such notifications. You might think of using a webserver for this, too, that would need to run on every client or at least everxy site will have its IIS running for the site to site communications. I don't think that's really a good idea for security reasons and the low level nature of such a solution - see thread184-1776113: Socketting using VFP, that covers sockets and then another low level technology is named pipes, but both these things are something you likely will struggle with as a beginner.

The whole topic is really not a beginner topic no matter what you use. It all boils down to a central data source everyone can look into, whether it really is just one central database instance or many local instances synced by a Windows internal sync service as MSSQL replication also can be seen as, or an external service like Dropbox. For security reasons you may encrypt messages you sync, and decrypt them locally, which is a nice possibility of such a solution.

Another reason I really like any syncing solution is it can be done on top of any local solution, which then only needs to be setup in the same manner on each site, ever site has the performance of a local LAN solution and only the data necessary everywhere, like such notifications or any other files and data will be synced. One downside is that syncing rules may become very complicated and need a lot of thinking who has which role and privileges, which site is a master and what are slave servers or whether you need equal partners. One task har enough for multi user in a LAN is solving update conflicts, syncing the data adds another layer of deciding which state of some record is the latest and most relevant to store. But notifications are a simple subject in this regard, because they are non permanent anyway.

Just don't think of answering every notification with a notification of a received notification, or you cause a recursive cascading of endless notifications, but that's not just only true for syncing solutions.

Bye, Olaf.

RE: How to notify users on new message, chat, end date of something in a vfp application.

Are we perhaps talking about two slightly different things? You asked how a supervisor can notify a workgroup of a particular event. Or, more generally, how to transmit a message within a group of users. That was the question that I tried to answer.

The blog post that you referenced describes how to actually display the message on the recipient's screen. If I knew that was what you wanted to know, I would have addressed that issue.

That said, I expect that blog post will be useful to you. By all means, go ahead with it. But there are much simpler ways of displaying this kind of notification. Essentially, it's just a form. And like any form, you can make it appear or disappear in any way you like. My preference would be to make the form "slide up" from the bottom edge of the screen - a bit like a piece of toast emerging from a toaster - and then slide down again when you want to close it. But of course there are other possibilities.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: How to notify users on new message, chat, end date of something in a vfp application.

I agree with Mike. Notice - no pun intended, that Outlooks popup message also isn't a systray baloon tipp, so even MS didn't unify its way of notifications.

I don't say is's not a nice feature and since few people still use XP it is more likely to be available on all clients, but its looks also have changed from Vista up to Win10. In Win10 you actually have notifications as a tray icon to start up an info center you can also look back into to see new notifications you didn't see while they popped up.

Such system concepts are nice to use, when you know all your clients are on the same OS. If so, that's a very fine usage of the system capabilites and goes in conjunction with a unified Windows UX, which I evangelize anyway. It might not reach to all clients, if you have a heterogeneous network, of course other operating systems than Windows can not be involved in a VFP solution anyway.

No matter what, displaying something is just the second step of a notification system and to allow backtracking the notifications for a user you'd need to provide your own notification history, too. I also second Mikes advice to do your own Form, not just because Outlook does too, but to have something as fallback for any older OSes. You can decide that inside your application, as you can check OS() or OS(3) and OS(4) to decide what to use for the notification visually.

Deciding for the mail popup or Skype message popup is deciding against the client application having the notification, though. And as you also considered that, I didn't thought you'd look for advice on how to visualize notifications only. Outlooks notification simply happens, all you do is send a mail. The difficulty of Skye messages is your solution really needs the sender to have code using Skype API and the client only sees these notifications inside the Skype app, not inside your app. Your own application is best involved by using a shared data or file source or local such sources, which are synced between locations.

Bye, Olaf.

RE: How to notify users on new message, chat, end date of something in a vfp application.

Just to add another word .....

Don't make it too complicated. You describe yourself as a beginner. So keep it simple. Use techniques that will help you learn, and which you will find useful as your career develops. Learning how to create simple forms is a fundamental idea that you will definitely need again and again.

Of course, if you are fascinated by the idea of using balloon tips and systray icons, by all means do so. But if your aim is to produce a reliable application without too much effort, then focus on the functionality and leave the cosmetics for another time.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: How to notify users on new message, chat, end date of something in a vfp application.

(OP)
Yes Mike, I totally agree with you.
I am a beginner, a beginner and just a beginner.
I could only read the conversation between both of you with a dreadful feeling of my incapability out of lack of knowledge and experience.
It seems the outline drawn by my question detracted the question.
It was only of getting notification on my system tray after having received a mail (to begin with).
I accomplished that in following way-
With one parameter pcNotification I created Balloon.prg
That parameter is meant for receiving the details of mail as to who mailed?
I defined that parameter using IIF() - if empty(pcNotification) then pcNotification ='' otherwise alltrim(pcNotification )
Copying the Systray.vcx and Systray.vct into my default program path, I created ySystr object based on Systray and using 4 of it's properties ie. IconFile,Tiptext,Menutext and AddIcontoSystray() and the variable pcNotification I got the notification on the system tray.
Now to proceed ahead I have 2 goals-
1. To display the notification unless user cancels notification and
2. To open the mail when clicked over that notification.

Problem is that I am not able to use IconClickEvent() of systray as I have not defined the class in the program but only created object based on systray as I don't want to notify through form but notify only through the balloon tip.

Please consider me just a growing bud... and then guide through your replies.

Thank you.
A Beginner

RE: How to notify users on new message, chat, end date of something in a vfp application.

(OP)

Sorry brothers, I was never intended to hurt your feelings through my reply. Please forgive me.

I proceeded a little starting from scratch...
Defined the systray class as form and on it added objects like editbox and command button.
Defined a menu and added 2 bars -
1 for email and
1 for exit
Passed Menutextismpr= .T.
and using showmenu() wrote the rightclick procedure.
On leftclick displayed the form on the screen and on right click shown the menu options,
Still what I am willing to accomplish has not been fulfilled ie.
1. To keep the balloon tip open until it is closed.
Reading the document about systray class, I concluded that it in not possible.
Please help me to solve this issue- to keep the balloon tip up always until the user closes it.

my codes:

Parameters pcNotification
pcNotification= Iif(Empty(pcNotification),'',Alltrim(pcNotification))
Set Classlib To Home(1)+ 'samples\solution\toledo\systray' Additive
Public oForm,lcPath,lcSystr
lcPath= Addbs(Justpath(Sys(16)))
Set Default To (lcPath)
oForm= Createobject('DisplayNotification')
oForm.Show()
Release Classlib Home(1)+ 'samples\solution\toledo\systray'
Read Events
Return

Define Class DisplayNotification As Form
Width= 250
Height= 100
ShowWindow= 2
Autocentre= .T.
MaxButton= .F.
Icon= Home(1)+ 'Graphics\Icon\Mail\Mail03.ico'
Caption= 'Email Notification!'
Name= 'Form1'

Add Object SysTray1 As Systray With ;
TipText= 'Email Notification!',;
IconFile= Home(1)+ 'Graphics\Icons\Mail\Mail05A.ico'

Add Object Edit1 As EditBox With;
Height= 100,;
Left= 12,;
Top= 10,;
Width= 200,;
Borderstyle= 0,;
FontBold= .T.,;
Forecolor= Rgb(0,0,255),;
Readonly= .T.,;
Value= '',;
ScrollBars= 0

Add Object cmdHide As CommandButton With;
Top= 65,;
Left= 180,;
Height= 20,;
Width= 60,;
backcolor= Rgb(0,255,0),;
autocenter= .F.,;
MousePointer= 15,;
Caption= 'Hide'

Procedure Init
Local m.myvar
WITH Thisform.SysTray1
.ShowBalloontip(pcNotification,'Notification!',1)
Set Cursor Off
TEXT To Thisform.Edit1.Value textmerge NoShow
<<pcNotification>>
<<datetime()>>
ENDTEXT
set safety off
Strtofile(thisform.edit1.value,lcPath+ 'lcSystr1.mpr')
ENDWITH
Text to m.myvar Noshow
Define Popup Rtclk shortcut Relative From Mrow(), Mcol()
Define Bar 1 of Rtclk Prompt 'Go To Email'
Define Bar 2 of Rtclk PROMPT 'Exit'
On Selection bar 1 of Rtclk Messagebox('Yet to code...')
On Selection Bar 2 of Rtclk Clear Events
Activate Popup Rtclk
ENDTEXT
Set Safety Off
Strtofile(m.myvar, lcPath+'lcSystr1.mpr')
Endproc

Procedure SysTray1.IconClickEvent
Thisform.Show()
If Thisform.WindowState= 1
Thisform.WindowState= 0
Endif
This.SetForegroundwindow(Thisform.HWnd)
ENDPROC

Procedure SysTray1.IconRightclickevent
With Thisform.SysTray1
.showmenu(lcPath+ 'lcSystr1.mpr')
.MenuTextIsMpr= .T.
Endwith
Endproc

Procedure
cmdHide.Click
Thisform.Hide()
Endproc

Procedure Edit1.DblClick
Thisform.Hide()
Endproc
Procedure QueryUnload
Clear Events
Endproc
Enddefine




RE: How to notify users on new message, chat, end date of something in a vfp application.

(OP)
There are 2 Problems-
1. As soon as I run the above code, the form jumps over the screen.
Can't it only appear over the screen when clicked over the balloon tip, as written in the icon click event?
2. The notification goes away in just a few moments.
Can't it stay up until it is closed?

RE: How to notify users on new message, chat, end date of something in a vfp application.

Quote:

Sorry brothers, I was never intended to hurt your feelings through my reply. Please forgive me.

Don't worry. As far as I am aware, you didn't hurt anyone's feelings, and there is nothing to forgive.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: How to notify users on new message, chat, end date of something in a vfp application.

I agree with Mike.

It is a bit unfortunate to go in the wrong direction, but also of us. Nothing is lost, it may help others, later, even yourself.

In regard of your questions:
1. I'd have to look and test your code, so no answer to that yet.
2. Well, ballon tips are wotrking that way, if you don't want that, you don't want baloon tips.
Messageboxes appear and only go away after user reaction, so they would be more appropriate for such a case you want the user to confirm to have taken notice of the notification.

I would double think about that, though, I am even getting annoyed with Micosoft Messages offering to get Office on this PC, though I have. That notification sometimes takes focus from a textarea in a website I currently type in. If I don't notice this, ie when my audio is muted, I often lose some typing.

Bye, Olaf.










RE: How to notify users on new message, chat, end date of something in a vfp application.

(OP)
Thanks to both of you. There is native language gap between us and that I was not receiving answers so, this made me think that way. Now no wary.

"Well, ballon tips are wotrking that way, if you don't want that, you don't want baloon tips

Quote:

" If such is the situation I will try to adapt this and proceed with the code.

RE: How to notify users on new message, chat, end date of something in a vfp application.

(OP)
For now, I didn't just pass the nTimeout parameter in the .Showballoontip() and found that the balloontip is up until mouse is moved over the screen.

RE: How to notify users on new message, chat, end date of something in a vfp application.

Using the ystray sample form from the Solutions.App, whatever I set as timeout doesn't matter. The Baloontips only are shown for 8 seconds, even if not moving the mouse. No, baloon tipps never persist until a user reaction, they disappear automatic. If you want something to stay you could go for theMessagebox, but it would annoy while typing text. Or you write your own form, as Mike initially suggested. That won't need to take focus away and could stay as long as you like.

Bye, Olaf.

RE: How to notify users on new message, chat, end date of something in a vfp application.

(OP)
Ok... I will write my own form later on and then will continue this thread.
For now please say if that form will stay on taskbar as this balloontip notification and it's icon stays ?

RE: How to notify users on new message, chat, end date of something in a vfp application.

(OP)
I mean Settling on the system tray, click behaviour like notification? etc

RE: How to notify users on new message, chat, end date of something in a vfp application.

I would help, if you'd write in whole sentences here. I don't know what you mean, now?
I observed it's not possible to keep a Balloon Tip notification open until a user sees it and clicks on it, it will always disappear - on Windows 10.
Your mileage may vary - meaning you might see something else on XP, Vista, 7, 8, or 8.1
But I don't think you'd want that, therefore I don't see a solution with this, despite writing your own form instead of using balloon tips.

Bye, Olaf.

RE: How to notify users on new message, chat, end date of something in a vfp application.

(OP)
"I observed it's not possible to keep a Balloon Tip notification open until a user sees it and clicks on it, it will always disappear - on Windows 10."
I agree, Our software is on windows server 2012. And I, having user access on server tested on that and also on a small laptop having windows 7 on which only vfp is installed for testing purpose (Software in not over that.). There was a lot of behavioral difference.

"...what you mean, now?"
All our forms are modal forms. Our working environment and large no. of forms don't allow us to convert all the forms to modeless thus they are planning to write a separate exe that will include modeless forms.
Till a decision comes, my question is that 'The form I am supposed to write, can that have a look like this balloon notification and feature like settling to the system tray?'

"I would help, if you'd write in whole sentences here.... "
Thank you for your assurance. I will write in whole sentences...

Buy


RE: How to notify users on new message, chat, end date of something in a vfp application.

Well, the for you wirte yourself can do anything you want and look anyway you want, so what is the question?
It will never appear in the systtray itself, but you can position it anywhere you want, you position it at the lower right corner of your desktop. It is totally unimportant for the form to be part of the systray or not, isn't it? Of course your own form is "just" a form, but otherwise you have full control over it, don't you? In what directions are you thinking?

Bye, Olaf.

RE: How to notify users on new message, chat, end date of something in a vfp application.

(OP)
Ok I got it.
At present having the loads of frx assignment. So I am bound to pause my current form works. I will continue this thread again as soon as the assignment is over.

Thank you
Bye

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close