Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can't get a DLL call to work in a form
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00188431
Message ID:
00188497
Views:
23
>geoge -
>
>sorry about the e-mail, wrong button.

No problem. I don't mind folks emailing me with problems and code samples, but I would prefer to respond here. That way in becomes part of the UT archive and, if the problem gets solved, becomes a resource for anyone having a similiar problem.

>declare integer PCMSOpenServer in pcmsrv32 integer appInst, integer hwnd
>declare integer PCMSCheckPlaceName in pcmsrv32 integer serverID, string cityzip
>
>Public mserver, mtext1, mgood
>
>mserver = PCMSOpenServer(0,0) &&& returns 10000
>mtext1 = '15243'
>mgood = PCMSCheckPlaceName(mserver,mtext1)
>
>mgood will return 1 in this simple prg

From the above, I assume that PCMSCheckPlaceName() actually is returning a boolean and that the function call is indicating that the text that was passed is a valid zip code.

The second function looks as if it wants the application instance and the window handle of the caller. You can get those for the form using a combination of Foxtools and the API:
DECLARE INTEGER GetClassLong IN Win32API;
  INTEGER hWnd, INTEGER nIndex
* The window handle from foxtools
lnhWnd = _WhTohWnd(_WFindTitl(ThisForm.Caption))
lnhInstance = GetClassLong(lnhWnd, -16)
You might try, adding those parameters as in: mserver = PCMSOpenServer(lnhInstnce, lnhWnd). You might also want to check to be sure that the string being passed to PCMSCheckPlaceName() is passed by reference. Finally, if there's an open function, there's almost got to be a close one. One the function is opened, it should be closed, and that might also be part of the problem.

>when i take the last 2 lines of code in place them in the valid event on the form, everything shutsdown. Page fault error in pcmsrv32.
>
>if i call the simple prg from the valid event - do simple() or do simple or =simple i get an invalid subscript.
>
>any clues?

Don't you mean do simple or = simple()?

hth,
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform