Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

API Declaration

Status
Not open for further replies.

hyonos

Technical User
Apr 2, 2003
46
0
0
IT
hi to all.
in fox i can't declare all windows api instead in visual basic (for example) i can declare much more api.

then, i have an idea but i don't know if is it possible.
if i create a dll in vb or c++ fore declare api and call api ?
in foxpro i can declare my dll and after call dll for declare my api and execute the call.
in my dll i can have this metod:
- declare_api (api_declaration, str)
- call_api (api_to_call, str)
and in foxpro i call mydll function.

is it possible?
 
Hyonos

in fox i can't declare all windows api instead in visual basic (for example) i can declare much more api.

Yes you can declare Windows API functions in VFP, here is a website dedicated to that.



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
There are also several API examples in the FAQ section of this forum.

A function to synchronize your Local-System-Time to your Server-System-Time? faq184-3505 agit72
Alternate Method to Set local Time from Server faq184-3536 rgbean
API Structures & Pointers - Get Host & IP Example faq184-3854 slighthaze
Change a file's Attributes? (System, Readonly, Hidden, Archive, etc) faq184-3327 wgcs
Change a File's Date and Time? (ie. "Touch") faq184-3997 wgcs
Email/Website Hyperlinks on a Form faq184-3889 slighthaze
Find the current Time Zone name and Offest Bias faq184-3322 wgcs
Force Window to Front (not blink in taskbar) faq184-4262 slighthaze
Get Path To Windows Special Folders (such as Desktop) faq184-4264 slighthaze
Get Systems Directory faq184-4306 jimoo
How can I get the DOS Errorlevel from executed program? faq184-2788 wgcs
How can I open a file, using the default application for that file? faq184-3945 EricDenDoop
how can I read and write to an inifile using API calls faq184-2916 Baldwin
How do I display the Windows Version faq184-2695 rgbean
How do I get a third-party application window to appear inside VFP instead of in the Windows desktop?
How long the system is running since last boot faq184-4405 AirCon
How to Add Compression to a VFP Program Without ActiveX, Without $ faq184-2070 wgcs
How to bring up a Dial-up connection faq184-3593 mgagnon
How to Close Annoying Third Party Application Windows faq184-2677 wgcs
How to copy an active form and paste into a Word document faq184-4212 mgagnon
How to create office header files in VFP faq184-2749 cdms
How to determine Cancel was used with the printer prompt faq184-3770 mgagnon
How to lock a file using an API function faq184-2414 mgagnon
How to Place Icons on menu items in a form? faq184-2733 wgcs
How to Play a WAV file Sound faq184-4522 wgcs
How to register a file type and icon with Windows? faq184-3946 EricDenDoop
How to retreive HTML code from a web page faq184-3447 mgagnon 4/13/03 --
How to secure your Word document when opening them in VFP. faq184-4513 mgagnon
Minimize All Windows (Show Desktop) faq184-4263 slighthaze
one instance of program without use of WINDOW TITLE faq184-2442 danceman
Only one instance of an application faq184-1767 mgagnon
Open and Close CD Drawer(s) faq184-4261 slighthaze
Read the Windows Registry faq184-4674 jimoo


Jim Osieczonek
Delta Business Group, LLC
 
in my dll i can have this metod:
- declare_api (api_declaration, str)
- call_api (api_to_call, str)
and in foxpro i call mydll function.


All the citations in this thread should get you working with any API that you could possibly use with the method you describe above.

I don't think you'd get very far with that method, though, since, as far as I know, VB can't compile "on the fly" the way VFP can with Macro compiling, so the "declare_api" function would not be able to dynamically-build-and-execute the DECLARE statement.

The only thing we've found that you just plain Can't do in pure VFP with API functions are any functions that require Callback Function pointers, since VFP functions don't have a traditional C-like point of entry address. For these, it's necessary to provide a Stub callback function using some other tool (VB, C, Delphi, etc), usually most easily as an ActiveX control, then assign VFP code to the event triggered by that function stub.
 
wgcs

For these, it's necessary to provide a Stub callback function using some other tool (VB, C, Delphi, etc), usually most easily as an ActiveX control, then assign VFP code to the event triggered by that function stub.

[ignore][/ignore]

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Interesting, Mike: I've read that topic before, but never so carefully... SO it seems (according to MSDN) that VB doesn't do callbacks natively, either, but it can be coerced into it by using a helper DLL.

The trouble with the helper that's described in the wiki topic is that it's not generic: You have to build a function in C with the specific signature (parameters count and types) that the specific callback needs. However, this solution for VFP seems neater than the helper DLL for VB.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top