Solved

Can Application.Run return a value?

Posted on 2006-06-22
5
1,211 Views
Last Modified: 2008-01-09
I'm using the following code to activate the Windows XP Dialer.  Is there any way I can get a value back?  I want to know what the user pressed on the dialer screen.

Application.Run "utility.wlib_autodial", strPhNum
0
Comment
Question by:HKComputer
  • 2
  • 2
5 Comments
 
LVL 26

Accepted Solution

by:
dannywareham earned 300 total points
ID: 16966936
I'm pretty sure that you can't return a value this way.
There's more than likely a way to use API calls to track what's happening in the operating system.

However, Access cannot tell what's going on in external programs without linking to their object model (for which you'd need a reference and, most likely, an ActiveX control too).
0
 
LVL 16

Assisted Solution

by:Rick_Rickards
Rick_Rickards earned 200 total points
ID: 16966968
Q: Is there any way I can get a value back?
A: Yes but...

The caveat is that the number you get back details what happened when the DLL was called into action (specifically whether or not an error occurred).  So yes, it returns a value, but unfortunately it's not going to provide any information regarding what the user did.  Sorry. :(

In any case here is how you'd get the number if you wanted it...

Sub PlaceCall(strPhNum)
     Dim lngResult as Long
     lngResult = Application.Run("utility.wlib_autodial", strPhNum)
     MsgBox "The Number returned was... " & lngResult
End Sub

It'll return 0 if the API call was sucesfull.  It'll return a negative number if not but again the number returned helps us know why the API call failed and sheds little light regarding what the user did.  Here's a link that provides some interesting information regarding the API call that I believe is responsible for what utility.wlib_autodial does.

http://www.answers.com/topic/tapirequestmakecall

May not be what you wanted to here but hopefully having the answer satisfies curiosity if nothing else.
 
Rick
0
 
LVL 26

Expert Comment

by:dannywareham
ID: 16966978
...and I stand corrected :-)
Cheers Rick
0
 
LVL 16

Assisted Solution

by:Rick_Rickards
Rick_Rickards earned 200 total points
ID: 16967035
Perhaps but somehow I don't think it was the answer HKComputer was hoping to get.  You are correct, however, if one was to have any hope of getting meaningful information regarding the users actions you would have to retain an object reference so that your code could retain a dialog with the OLE process in action.  Additionally the DLL would have to avail a method for retrieving the information you wanted.  

It is conceivable to me that if one were to pull enough technical specs regarding the DLL in question that one might write their own wrapper, (a collection of Class Object(s) and supporting module(s)), that might make it possible to instantiate their own object and get to this information.  Whether or not the DLL even avails this type of information I'm really not sure although I'm reasonably certain that the depth of knowledge required and amount of time one might have to invest building such a wrapper is probably enough to cause most to reconsider how badly they need the information.  Even so, I suspect it's possible but getting there will require some R&D and expert skills.

Rick
0
 
LVL 4

Author Comment

by:HKComputer
ID: 17193554
Thanks, Rick, for the clarification of the answer to this question.

>It is conceivable to me that if one were to pull enough technical specs regarding the DLL in question that one might write their own wrapper, (a collection of Class >Object(s) and supporting module(s)), that might make it possible to instantiate their own object and get to this information.  Whether or not the DLL even avails this >type of information I'm really not sure although I'm reasonably certain that the depth of knowledge required and amount of time one might have to invest building >such a wrapper is probably enough to cause most to reconsider how badly they need the information.  Even so, I suspect it's possible but getting there will require >some R&D and expert skills.

"expert skills": We don't have that here right now.  We'll resort to not knowing what the user did, since it is acceptable.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question