yes, this should be possible. Finally you want to invoke a C function. Please note, the C function does belong to Win32 SDK. Accordingly, you will need to include the appropriate Win32 header files (e.g. windows.h). For this purpose use the Inline Code member. Some further hint: while the file dialog is opened, the Embedded Wizard generated GUI application will be paused waiting for the return of the invoked function (e.g. GetOpenFileName()).
I hope it helps you further.
according to Microsoft documentation, the selected file name is stored as zero terminated string in the data field lpstrFile in the OPENFILENAME data structured passed to the Win32 function GetOpenFileName(). To relay this string to Embedded Wizard application use the function EwNewStringAnsi() or EwNewString(). These function will take care of the proper memory management for the new string. Whether you use the first or second function depends on the version of the GetOpenFileName() function. Win32 provides in this case the functions for ANSI or WCHAR strings (identifier by a final A or W sign in the name according to Microsoft).
Following could be the code to obtain an Embedded Wizard conform string from the ANSI version of the GetOpenFileName() function:
var string fileName = "";
native ( fileName )
/* Initialize the data structure ... */
data.lStructSize = sizeof( data );
if ( GetOpenFileNameA( &data ))
fileName = EwNewStringAnsi( data.lpstrFile );
// Again in Embedded Wizard world -> use the name returned by Windows.
trace "User has selected the file:", fileName;
I hope it helps you further. See also: Be careful when exchanging strings.
Ask Embedded Wizard
Welcome to the question and answer site for Embedded Wizard users and UI developers.
Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!