Tracy and Ted,

Your responses were just what I needed!

I miss hanging out here.  All the off the wall discussions, not to mention
the really cool tips on things I can do with VFP.  Too bad MS has done such
a good job of mucking it all up....  But it's good to hear from you (and the
others).

Anyway, thanks again,

Fletcher 


Fletcher Johnson
fletchersjohn...@yahoo.com
408-781-2345 - Cell
408-946-0960 - Work
501-421-9629 - Fax


-----Original Message-----
From: profox-boun...@leafe.com [mailto:profox-boun...@leafe.com] On Behalf
Of Tracy Pearson
Sent: Tuesday, September 06, 2011 2:11 PM
To: profox@leafe.com
Subject: RE: Passing structs to COM objects

Fletcher Johnson wrote on 2011-09-06: 
>  Hi all,
> 
> 
>  Long time, no chat..
> 
> 
>  I am working on a VFP project that requires that I pass a struct.  
> For my  current problem, it wants an array of structs that simply have 2
doubles.
> 
> 
>  I seem to remember there being a fairly straightforward way to create 
> a  variable that, to the COM objects method, looks like a struct, 
> when, in  fact, it is a string of values patched together.
> 
> 
>  So the code in .net might look like
> 
> 
>  Dim pt(2) as somestruct
>  
>  Pt(0).x = 123.9876
>  
>  Pt(0).y = 456.789
>  
>  Pt(1).x = 123.1
>  
>  Pt(1).y = 789
> 
> 
>  Comobj.SomeSillyMethod(pt)
> 
> 
>  And the structure looks something like:
>  
>  Structure Somestruct
>    Double x
>    
>    Double y
> 
> 
>  I assume I should be able to use a VFP array, but not sure how to 
> model
the
>  struct.
> 
> 
>  I am also not sure how to do it so that it sees it as a double and 
> not a  decimal or some other data type.
> 
> 
>  Any and all ideas are welcome!
> 
> 
>  Take care,
> 
> 
>  Fletcher
>  
>  (who lurks here when time permits or problems require)
> 
> 
>  Fletcher Johnson
>  

Fletcher,

You cannot use the VFP Array. 

BINTOC(xValue, "4RS")+BINTOC(yValue, "4RS") should give you the structure. 

The DECLARE of the API will need to have that parameter be STRING.

If you need the information back, because it's an in/out parameter, it may
work. 

When I worked with the ShellExecuteEx() API, it worked fine. When I worked
with AllocateAndInitializeSid() and CheckTokenMembership() I needed to
allocate memory and free it with HeapAlloc(), HeapFree(). When I initialized
the allocated memory, I used SYS(2600). API's are a fun puzzle (for some).


Tracy Pearson
PowerChurch Software


[excessive quoting removed by server]

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/04c201cc7292$a9f48db0$fddda910$@yahoo.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to