Solved

Can Application.Run return a value?

Posted on 2006-06-22
5
1,189 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

789 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