Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatically starting vfp on Windows Startup 3

Status
Not open for further replies.

alan232

Programmer
May 19, 2004
144
US
Hi All;

I have no idea how to accomplish this or what terms to use to describe it (or where to post it).

I want to start a vfp 6.0 program automatically when the computer (Windows XP) is first booted up. A small icon (to join the many others there) on the bottom right of the desktop would be nice too.

This program has its own form and running timer to service my PDA and will be independent of any other vfp program.

Any help will be sincerely appreciated.
Thanks,
Alan
 
Hi,

Going back to:
_SCREEN.Icon = MyIcon.ico

I'm afraid had no effect.

Suggestions?
Thanks again,
Alan
 
Hi Mike:

I'm using VFP 6 SP5 (if it helps).

I found a previous forum message suggesting using the project manager.

In any event, I can successfully change the displayed icon in the windows list box, and change the icon on the form title bar using the icon property of the form--but I can't seem to change the fox icon in the taskbar of the system tray when the fox appplication is minimized off the desktop.

My goal here, since I can't get it to run as a service, would be to have windows start it as an application with an icon that is different from other running fox applications.

So far, no luck.
Thanks for helping,
Alan
 
Hi Dave;

True. I did not follow the example completely since my exe is simply a vfp form with a timer anyway. Also, I could not get messagebeep() to work. (I down-loaded the Win32API and unzipped it to c:\windows\system, but when using messagebeep() I get an error stating that the Win32API needs additional files).

But in reading through the example, I get the impression that Windows is constantly instantiating then destroying the effective code. This makes me wonder if, services.msc is correct in reporting the form as running, but, maybe the timer event within it is being created and destroyed before the fifteen second delay is ever reached.

i.e., I don't understand how windows xp looks at the services. Does windows xp run through all the services on some time interval, or does the vfp timer use some kind of interrupt to trigger the timer event?

Thanks again for any help,
Alan
 

Alan,

I can't seem to change the fox icon in the taskbar of the system tray when the fox appplication is minimized off the desktop.

Can you clarify that. Setting _SCREEN.Icon will determine the icon for the taskbar, which is what you were asking for (I think). But that's not the same as the system tray, which I take to mean the notification area. And what do you mean by "minimized off the desktop"?

If you can change the icon in the form's title bar, that will also change the icon in the task bar.

And, by the way, whether or not you use the project manager has no effect either way.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Hi Dave;

I went back through Calvin Hsia's example, combining it with that from pcstat.com's example. (My version of regEdit does not work the same as Hsia's does.)

It does work! For Hsia's example, anyway--now to modify it for my needs. (I never could get the win32api to work).

Hsia is sharp!

This is great! I see the end in sight!
Much Thanks and many stars!
Alan
 
Hi Mike;

Thanks for tolerating my ignorance.

Please correct my terminology...

On my LCD, windows xp is showing the windows logo next to "Start" on the bottom left and on the same line to the far right is my clock. There are currently four icons displayed to the left of the clock with an '<' that expands the list of icons to the left. (There are about 19 icons when '<' is clicked.)

I don't know the correct term here, but I've been calling this 19 icon area next to the clock the 'notification area' with the entire bottom line being the 'system tray' or 'taskbar'.

Processes that windows percieves as running 'applications' are listed from left to right, starting about two inches from the 'Start' logo on the left of the screen. Again, I don't know what this area is called. For lack of anything else, I'll call this area the 'application area'?

Anyway, here is what happens.
First, on my form property box, there is an 'Icon' property, which when set with a full path to an icon file will correctly change the fox icon on the top line of the form. However, when the fox desktop (within which the form is running) is minimized, the desktop condenses to a 1 1/2 inch title in the 'Application Area' on the bottom most line of my lcd display. (When the fox desktop is minimized, the lcd returns to the standard window desktop).

When I try _Screen.icon = myicon in the command window or code, nothing seems to happen. Changing the icon on the forms title bar is also not echoed when the fox desktop is minimized to the bottom line. (I suspect this maybe do to the version of vfp I have.) All I get is the standard fox icon.

Thanks for any help, I certainly appreciate it!
Alan
 
Alan,

Let's try to clear up the terminology.

There are currently four icons displayed to the left of the clock with an '<' that expands the list of icons to the left. (There are about 19 icons when '<' is clicked.)

That is the notification areas.

Processes that windows percieves as running 'applications' are listed from left to right, starting about two inches from the 'Start' logo on the left of the screen.

That's the taskbar.

Now, turning to your application ....

With the vast majority of VFP applications, you will see a button in the taskbar. It shows an icon, with the name of the application to its right. Clicking that button will restore the application (if it's minimised) or bring it to the front.

You don't have to do anything special to create that button. It will just appear when the application starts.

The icon in that button is the same as the one you see in the title bar of the main (outer) window in the application. By default, it's a fox head. By setting _SCREEN.Icon in your code (or setting it in the Icon box in the property sheet for the screen), you can change it to any icon you like.

When you do that, VFP doesn't do any error checking. If the icon file does not exist, or VFP cannot find it, it will just ignore it and display the fox head instead.

Now, running an application from the notification area is a totally different concept. I would stress that this is not something that most developers do. You normally only do it if you want to run your app as some sort of background service, and then only if you want to give the user a way of communicating with that service.

If that's what you want, you need to stay with Dave. He has given you more information that I can. I'd only add that _SCREEN.Icon has no effect on apps running in the notification area, so if that's the route you're taking, don't get bogged down with that issue.

I hope this clarifies things.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Alan,

Thanks for the star, and I'm glad you got the example to work.

I created an app and made an executable completely different than the example, but I did name it "vfpsrv.exe" so I wouldn't have to change the registry entries. (In fact, it is based on the "chat" example which I have on my web site, so I can see that it is running and doing stuff.)
Anyway, it works just fine. So I know any executable can be made into a service. It just has to be done properly.

-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Hi Mike and Dave:

You'all are great!

Thanks for the clarification Mike. I appreciate it. In any event, I might be putting it in the wrong place of code, but I can't seem to get _screen.icon to change the default fox head on the button in the taskbar. This would be really helpful since my staff tend to run three or four different vfp apps more or less randomly as the day goes on.

Does the 'screen' have its own property sheet seperate from the form?

This thread really turned into two seperate issues--interesting how a discussion can travel.

Making the vfp code into a service is wonderfull for my purposes (and it does not need an icon)--its exactly why I started writing this code a decade ago. Now, without any user intervention, by simply turning on the machine, I can travel from room to room throughout the building, create, edit, and recall patient information to my PDA (via 802.11b) and print perscriptions, consults, memos, and orders to my staff without ever touching a piece of paper! This brings to a close what I wanted 20 years ago before the technology was there! (To the best of my knowledge, this is a very unique program).

I will work with the icon problem more this weekend, in the meantime,
best wishes, best regards, and a very very sincere thanks for a job well done!
Alan
 
Hi Mike:

It just worked exactly as you promised. I don't know why it didn't work before...

Oh well, my wife has always told me my programs have a personality.

Thanks again,
Alan
 
Addendum:

_screen.caption with _screen.icon placed in the form initialization code seem to work well to identify the app's button.

Thanks Mike
Alan
 

Alan,

Does the 'screen' have its own property sheet seperate from the form?

Yes (in VFP 7.0 and above). Click on the Properties Window button in the main VFP toolbar, while the form designer and class designer are both closed. (There ought to be a command you can type to open it as well, but I can't figure out what it is.)

It just worked exactly as you promised.

I'm relieved. I was beginning to think something must be badly broken in your system.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
It sounds pretty much like the thread has been closed, solved, whatever, and I don't really want to turn it into an epistle, but I am curious. If you don't mind or are able, would you expound a little on your app?
For instance, how are you communicating with the 'server' to retrieve, modify and update the data?

We are using some PDA's at our company and have been thinking about implementing that sort of 'roaming' capability for our parts/inventory. I've been stewing on some solutions and would like to hear a little about your methodology.



-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Hi Dave;

My basic problem was that I need a lot of very specific patient information and, ultimately, the insurance companies want everything printed out in dummy form. If I sound a bit mad, I am. Our current health care system has done much to reduce 15 years of post high-school education to that of the junior high school level. Hence, what I developed essentially is a checklist with a few free form text fields on the PDA. To be more exact, I selected an HP IPAQ for its full vga graphics and fairly decent handwriting recognition system. Since the initial version of this had to be made in about a month (for Blue Cross Blue Shield) and I did not have the time to learn Windows CE, I bought the enterprise edition of Visual CE. This particular product comes with mEnable. The HP IPAQ itself is well hardwired to make communication with local lan's using 802.11b, both with and without encryption (HIPPA rules). mEnable runs on both the Server and the PDA (client). On the server machine, it runs as a service. It has quit a few quirks about it--which of course their techs deny--but after many very long sleepless nights, I managed to get it and vfp to access and edit the same base files. (The insight came whan I had to create a seperate nursing form using remote views and odbc). Now, thanks in no small measure to yourself, I have a system that goes like this:
1. Staff comes in and turns on their computers. (They are turned off when we leave the office for HIPPA compliance).
2. My vfp app starts in the background, opens several files unique to the pda and checks several specific files for flags indicating that a record is 'completed'.
3. When my staff and nurses complete their vfp forms, their vfp code places 'jobs' in my main vfp job que on the server. This was done to completely isolate as many functions to the server as possible and not have random writes by the client machines to the pda files.
4. The 'server' then checks the job que as well as the files from mEnable and acts accordingly.
5. I left it to the server programs to move data to and from the pda.

For its part, the pda uses simple check boxes (logicals) and general text fields. The records so created on the pda are sent to the corresponding files, via mEnable. To appease the insurance companies, I used (I think) a fairly standard data dictionary to convert the logical check boxes into long-winded, correctly spelled, paragraph typed statements that would make any transcriptionist jealous. The data, of course, is stored back in the database for later retrieval (like perscription refills) if needed. I used check boxes for my speed and to keep transmission time to a minimum. I have a very busy practice (about 50 to 75 patients/day) in rural Alabama. On a busy day, mEnable uses about 13 files which can take some time for transmission. If you decide to go this route, I can offer some very specific recommendations. The first of which is be careful to take into account the time to transmit/update the pda/server files. (I had about one month to write the initial application and it took me the first week to resolve the timing. I'm sure this was obvious to anyone who knows this stuff, but I discovered it the hard way when my server was printing before the pda was finished synchronizing).

In short, when everything works correctly, I have something about the size of a standard perscription pad that can completely update/edit and query my patient records. I personnally decided on this route frankly because the current programs in use require much larger laptops or tablets and I felt patients did not want their doctor typing on a computer or looking at a computer screen
instead of them. (My patients have been extremely accepting of my use of the PDA). Several of my colleages have expressed interest in buying it for their use--I just don't know if I'm up to installing it all over again.

I hope I helped your decision,
Thanks again,
Alan

P.S. I'm really going to miss vfp when Microsoft ends it -- it really is the best general database language I've seen.

 

Alan,

I'm really going to miss vfp when Microsoft ends it

You clearly work on very long time scales <g>.

Microsoft have said that they will continue to support VFP to at least 2014. After that, the product will continue to exist and you will still be able to use it to develop applications. So you don't have to start worrying for a while yet.

Or do you know something that the rest of us don't?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 

Jim,

support for VFP9 extends to 1/13/2015.

Isn't that what I said. Oh, sorry, I said 2014. Not far out.

Of course, that date applies to VFP 9.0. Who knows what later version might appear at some time.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Alan,

Thanks for the explanation. It's appreciated.
It gives me an idea on what to expect.

By the way, that rings a bell - you were the one we were trying to get mEnable to cooperate with VFP a few weeks back, weren't you?

Thanks again.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top