-
Change value of variable from another program?!!!!!!
I need to be able to change a value of a variable in my application from an
other application that i have created. One application will sit on the users
task bar making constant checks to a SQL Server database. if a value has
changed in a particular table i want to tell the second application and update
a variable.
I could just make the second application to the checks to the database but
that would mean both applications are doing the checking, which in turn could
put alot of pressure on the database.
Is there away of creating Environment variables that are global to both applications?
Or is there another place i can write to in Windows? Maybe the registry.
Any ideas
Thanks
-
Re: Change value of variable from another program?!!!!!!
Jack:
Some months ago I wrote a tip of the month that I call 'Send Text from One
App to Another'. Link to http://www.buygold.net/tips then look for the
December 2000 tip of the month. A sample program is provided. From the tip's
intro:
Thanks to Francesco Balena's article, Synchronize Your Apps, page 58, in the
September 2000 issue of the Visual Basic Programmers Journal, I was able to
develop a simple routine to allow communication between running
applications. I added a few wrinkles and made this the tip-of-the-month.
Cheers,
Larry Rebich
More tips link to:
http://www.buygold.net/tips
Please:
No personal e-mail questions :-)
"Jack Renold" <Renold_Jacks234@hotmail.com> wrote in message
news:3dee0712$1@tnews.web.devx.com...
>
> I need to be able to change a value of a variable in my application from
an
> other application that i have created. One application will sit on the
users
> task bar making constant checks to a SQL Server database. if a value has
> changed in a particular table i want to tell the second application and
update
> a variable.
>
> I could just make the second application to the checks to the database but
> that would mean both applications are doing the checking, which in turn
could
> put alot of pressure on the database.
>
> Is there away of creating Environment variables that are global to both
applications?
> Or is there another place i can write to in Windows? Maybe the registry.
>
> Any ideas
>
> Thanks
-
Re: Change value of variable from another program?!!!!!!
> I need to be able to change a value of a variable in my application from
an
> other application that i have created. One application will sit on the
users
> task bar making constant checks to a SQL Server database. if a value has
> changed in a particular table i want to tell the second application and
update
> a variable.
>
> I could just make the second application to the checks to the database but
> that would mean both applications are doing the checking, which in turn
could
> put alot of pressure on the database.
>
> Is there away of creating Environment variables that are global to both
applications?
> Or is there another place i can write to in Windows? Maybe the registry.
There are a number of options here, as you've evidently surmised. One you
didn't mention is Dynamic Data Exchange, or DDE, which is a messaging
protocol supported by Windows that is specifically designed to make one
application aware of changing data values in another.
The DDE mechanism is associated with forms and controls, permitting
applications to exchange commands and data with each other that are tied to
the contents of individual controls.
Read the writeups on the various properties, methods and events with names
beginning with "Link" in the VB Reference.
I gather that Microsoft has de-emphasized its use in recent years, but it's
still supported by Windows, and VB, at least for the immediate future. I
haven't looked to see if it's still there in the .NET world. I notice that
there does not appear to be a writeup on DDE in the VB6 Programmer's Guide
anymore, only in the Reference Guide, so a nice introductory writeup doesn't
seem to be included in the latest MSDN docs. That seems to suggest that MS
may eventually phase out support. I'm not clear on what
You should also look into creating an interface between the applications by
implementing the second, "background" application as an out-of-process
ActiveX server. It could notify your "foreground" application raising
Events.
By the way, I wouldn't recommend having a program in a continuous loop
constantly querying an SQL database, at least not without regulating the
frequency of checking through the use of a Timer. (A few years ago, I worked
with a programming team that adopted the term "Prairie-Dog Interface" to
describe methods of polling files and databases looking for updates. -- I
live in Boulder, Colorado, so this is a metaphor referencing the known
behavior patterns of the little rodents, who are constantly sticking their
noses out of their burrows checking on current conditions.) Any mechanism
you can use wherein one process receives a direct notification of updates
via a message is preferable to the Prairie-Dog method, which should only be
used if there is no direct message-sending mechanism readily available.
-
Re: Change value of variable from another program?!!!!!!
> I gather that Microsoft has de-emphasized its use in recent
> years, but it's still supported by Windows, and VB, at least for
> the immediate future. I haven't looked to see if it's still there
> in the .NET world.
Russ: FYI, VB.NET does not support DDE.
--
Phil Weber
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks