Sign in to follow this  
Followers 0
Kiai

Better way to do this? Better language?

6 posts in this topic

From a novice programmer: I have written a program that started out small and is now a decent size (800 lines). It monitors for when a user is looking a few specific windows, then pulls info out of the window, presents a gui interface with options to quickly navigate to other parts of the same application (a medical records app). This is the main program loop:

While 1

Select

Case WinActive("New Results Patient's Name:")

$RTE_window_open = 1

$title = WinGetTitle("New Results Patient's Name:")

GUI_RTE()

Case WinActive("", "Document Type: Letter")

GUI_Sign_Print()

Case WinActive("Inbox Message", $patient) And $clipboard = 1

GUI_Msg_paste()

EndSelect

Sleep(1000)

WEnd

As-is the program doesn't use up any significant resources. But, my question is, is there a better way to do what I'm doing than a loop like this with a pause?

Also, having written this app with 800 lines of code, I wonder if (since it may wind up getting used by several hundred users) if it is worth considering converting it to another language such as visual basic. It works fine as-is, and performs functions quickly, but are there any advantages in terms of system performance (or security or anything else) to re-writing it in another language?

Thanks.

Share this post


Link to post
Share on other sites



Kiai, one of the most important things ever is: Never change a successful formula.

This has been translated into:

Never change a succesful brand.

Never change a winning team.

and ofcourse..

Never change a succesful program.

:P

Share this post


Link to post
Share on other sites

Don't fix what isn't broken.

Thanks for the sage advice!

I was trained as cobol programmer 20 years ago so am not as comfortable with objects. Is there a better way to patrol for the active windows that the program is waiting for other than the While Wend loop?

Share this post


Link to post
Share on other sites

Not unless you feel like hooking the CreateWindow function, no you're stuck looping.

Share this post


Link to post
Share on other sites

Not unless you feel like hooking the CreateWindow function, no you're stuck looping.

Thanks for the help.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0