Solved

Can Application.Run return a value?

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now