Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Windows API Calls.
Hello, I'm just wondering if someone could explain why they would make calls
to Windows API? What this actually means, and what extra functionality this gives VBA? I've seen a few good examples which include things from win32 api, but I'm a little lost. Thank you for any answers in advance. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Windows API Calls.
Why? Because they can do things that can't be done using native VBA, such as
resizing a userform in VBA. Basically, you are tapping directly into operating system functions, extending the functionality, and often increasing the performance. I am sure that the question has more depth than that simple answer, but I am not sure what. -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "NateBuckley" wrote in message ... Hello, I'm just wondering if someone could explain why they would make calls to Windows API? What this actually means, and what extra functionality this gives VBA? I've seen a few good examples which include things from win32 api, but I'm a little lost. Thank you for any answers in advance. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Windows API Calls.
Thanks for the speedy reply,
That helped, I just simply had no idea about these Windows Api Calls, Quite Intriguing, as I've never used them before. I shall go forth and attempt to learn the basics. Thank you. "Bob Phillips" wrote: Why? Because they can do things that can't be done using native VBA, such as resizing a userform in VBA. Basically, you are tapping directly into operating system functions, extending the functionality, and often increasing the performance. I am sure that the question has more depth than that simple answer, but I am not sure what. -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "NateBuckley" wrote in message ... Hello, I'm just wondering if someone could explain why they would make calls to Windows API? What this actually means, and what extra functionality this gives VBA? I've seen a few good examples which include things from win32 api, but I'm a little lost. Thank you for any answers in advance. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Windows API Calls.
I would add to the discussion that API calls are completely unforgiving. If
you provide an invalid value for a parameter, you are quite likely to immediately crash the entire application (though probably not Windows itself). SAVE YOUR WORK before calling code containing APIs unless you are sure you have the correct data types and values. Pay attention to the ByVal and ByRef modifiers in the API declaration -- they matter. Note also that errors and return values that indicate error conditions are completely independent and separate from any error handling you may have in place using VB/VBA's On Error statements. On Error has no effect relative to API calls. If, according the the API documentation, a function sets the last error and that you can get further information using GetLastError, you should use Err.LastDllError to get the error value generated by the API. The error numbers reported by Err.LastDllError are different from the error numbers used in Err.Number. Thus, the Err.Description property cannot be used to get the text description of an error. If you need to get the text description of an API-caused error, you need to use the FormatMessage API function. I have code that wraps up FormatMessage in VB/VBA-friendly code at http://www.cpearson.com/Excel/FormatMessage.aspx. -- Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) "NateBuckley" wrote in message ... Thanks for the speedy reply, That helped, I just simply had no idea about these Windows Api Calls, Quite Intriguing, as I've never used them before. I shall go forth and attempt to learn the basics. Thank you. "Bob Phillips" wrote: Why? Because they can do things that can't be done using native VBA, such as resizing a userform in VBA. Basically, you are tapping directly into operating system functions, extending the functionality, and often increasing the performance. I am sure that the question has more depth than that simple answer, but I am not sure what. -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "NateBuckley" wrote in message ... Hello, I'm just wondering if someone could explain why they would make calls to Windows API? What this actually means, and what extra functionality this gives VBA? I've seen a few good examples which include things from win32 api, but I'm a little lost. Thank you for any answers in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
cannot open exel from windows xp in windows vista and visa versa | New Users to Excel | |||
Calls per Day | Excel Discussion (Misc queries) | |||
can windows vista edit shared document from windows xp | Excel Worksheet Functions | |||
XLA calls dll | Excel Programming | |||
VBA Calls | Excel Programming |