Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Call VFP EXE and return value
Message
From
02/08/2020 12:07:52
 
General information
Forum:
C#
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01675453
Message ID:
01675497
Views:
51
>Sys(0) returns machine name and the user name.

Correct. If you need one or the other, use GETWORDNUM().

>As to your "proper solution", it is too complicated for my needs and my technical level. Don't take it personally though.
>Thank you.

It's one of those things, once you get it setup it's useful for 50+ other projects you never thought of before. C# surely has built-in facilities to access named pipe data. And on the VFP side there's surely some existing library which does this. If not, the CreateWindow() function can be a [Dllimport] and you just need a marshaling handler for the class. There are surely examples for that as well. For the HGLOBAL, you Lock() it whenever you want to access data. This returns a C pointer you can reference in C# to create a string, and then Unlock() afterward and then GlobalFree() it.

It's not complex. And there are surely examples available which will take you through it.

I would still recommend using Win32 functions. They'll provide you with everything you need. The [Dllimport] definitions are the key part, but for most common ones there are surely examples online which will tell you how to define them.

Did you ever get the sample I posted working for GetUserNameA()?
Previous
Reply
Map
View

Click here to load this message in the networking platform