Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help converting STRUCT to VFP string
Message
From
05/11/1998 17:01:51
 
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00155020
Message ID:
00155029
Views:
27
>Can anyone provide some insight in converting structs and pointers to VFP strings ? I am trying to use a call to the HTML help object to display a popup with the following syntax:
>
>HTMLHelp(0,"",HH_DISPLAY_TEXT_POPUP, @lpHH_POPUP)
>
>I need to pass a pointer HH_POPUP structure to this function as the last parameter, which is what I am stuck on. The structure of the popup is as follows:
>
>typedef struct HH_POPUP
>{
>int cbStruct;
>HINSTANCE hinst;
>UINT idString;
>LPCTSTR pszText;
>POINT pt;
>COLORREF clrForeground;
>COLORREF clrBackground;
>RECT rcMargins;
>LPCTSTR pszFont;
>} HH_POPUP;
>
>I know that pt is a pointer to a POINT structure, which is defined as two LONGs that hold the X and Y co-ordinates of the cursor. The RECT structure is 4 LONGS that store the co-ordinates of the window to create. The pszText and pszFont are pointers to strings, if I am following this correctly.
>
>How (or CAN) I map this structure to a VFP string ? I have tried some routines I found here and in some books I have but have had no luck. Also, the cbStruct INTEGER needs to contain the size of the structure, how would I figure this out ? Is it impossible to pass this ???

Not impossible, but a bit difficult because of the pointers. You'll need to allocate space outside of VFP-controlled memory variables to hold the things pointed at because (1) there's no convenient way to grab the address of a VFP string to embed a pointer in a structure, and (2) VFP's string memory space can be rearranged on the fly, so if you did manage to get a pointer, there's no way to prevent VFP from moving it around 9short of the C API, in which case you can write a wrapper .DLL). The easiest solution, short of writing a wrapper .DLL in C or C++ to handle the task of creating and managing the structure for you, would be to take a look at Paul Tatavu's POINTERS class (it's available for download here on UT).
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform