Transferring large VO project to X#
Posted: Fri May 07, 2021 7:32 am
Hi Stefano,
sorry to read that.
.. I will check that asap !
Fab
sorry to read that.
.. I will check that asap !
Fab
Code: Select all
PCallNative <LOGIC> ( hFunc , GetCurrentProcess() , @lIsWow64 )
Code: Select all
PCall(hFunc ,GetCurrentProcess(), @lIsWow64)
Code: Select all
FUNCTION PCE_Is64BitOS() AS LOGIC
LOCAL hModule AS PTR
LOCAL hFunc AS PTR
LOCAL lIsWow64 AS LOGIC
hModule := GetModuleHandle( String2Psz( "kernel32" ) )
hFunc := GetProcAddress( hModule, String2Psz( "IsWow64Process" ) )
IF ! hFunc == NULL_PTR
PCallNative <LOGIC> ( hFunc , GetCurrentProcess() , @lIsWow64 )
ENDIF
RETURN lIsWow64
Code: Select all
FUNCTION PCE_Is64BitOS() AS LOGIC
LOCAL hModule AS PTR
LOCAL hFunc AS __IsWow64Process PTR
LOCAL lIsWow64 AS LOGIC
hModule := GetModuleHandle( String2Psz( "kernel32" ) )
hFunc := GetProcAddress( hModule, String2Psz( "IsWow64Process" ) )
IF ! hFunc == NULL_PTR
PCALL( hFunc, GetCurrentProcess(), @lIsWow64 )
ENDIF
RETURN lIsWow64
STATIC FUNCTION __IsWow64Process( hProcess AS PTR , Wow64Process AS LOGIC PTR ) AS LOGIC
RETURN FALSE
Unfortunately there still seem to be issues. Not sure if you saw my message in the dev forum, but there are problems with references, for example the FabPaintLib project references the CLR2 versions of System.Drawing and System.Windows.Forms, also the 2.1 version of the X# runtime is referenced. This is from FabPaintLib.xsproj :Fabrice wrote:Hi Stefano,
I've to rebuild and had some glitches
so, I've Pushed some corrections to the repository: https://github.com/X-Sharp/FabTools
Mainly, I've done some corrections due to 2.8 ... Ambiguity between a function or a method call
and a trouble (!?) with the DotnetZip NuGet package: What I've done here was to suppress the package from the four Zip projects, and re-install: It is ok now, so I hope the link has been corrected.
Please, keep me informed if you still have some troubles with it.
Code: Select all
<Reference Include="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Name>System.Drawing</Name>
<AssemblyName>System.Drawing.dll</AssemblyName>
</Reference>
<Reference Include="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<Name>System.Windows.Forms</Name>
<AssemblyName>System.Windows.Forms.dll</AssemblyName>
</Reference>
<Reference Include="VOWin32APILibrary, Version=2.1.0.0, Culture=neutral, PublicKeyToken=a967d8055360a7b9">
<Name>VOWin32APILibrary</Name>
<AssemblyName>VOWin32APILibrary.dll</AssemblyName>
<SpecificVersion>False</SpecificVersion>
<Private>True</Private>
<HintPath>C:Program Files (x86)XSharpRedistVOWin32APILibrary.dll</HintPath>
</Reference>
<Reference Include="XSharp.Core, Version=2.1.0.0, Culture=neutral, PublicKeyToken=ed555a0467764586">
<Name>XSharp.Core</Name>
<AssemblyName>XSharp.Core.dll</AssemblyName>
<SpecificVersion>False</SpecificVersion>
<Private>True</Private>
<HintPath>C:Program Files (x86)XSharpAssembliesXSharp.Core.dll</HintPath>
</Reference>
<Reference Include="XSharp.RT, Version=2.1.0.0, Culture=neutral, PublicKeyToken=ed555a0467764586">
<Name>XSharp.RT</Name>
<AssemblyName>XSharp.RT.dll</AssemblyName>
<SpecificVersion>False</SpecificVersion>
<Private>True</Private>
<HintPath>C:Program Files (x86)XSharpAssembliesXSharp.RT.dll</HintPath>
</Reference>
Thanks for looking into it! About the DotNetZip library, isn't it much simpler if you just include the dll and add a reference to it in the project? Or is this library not allowed to be redistributed freely?Fabrice wrote: Thx, I will check that and make the corrections.
The DotNetZip is a NuGet package, not installed per default, I will the steps to Restore the package.
and Ionic.Zip is the "old" version of DotNetZip, I have removed that reference in the latest push.
Chris wrote:Hi Glen,
As Wolfgang said, please do read all the articles under the "Migrating apps from VO to X#" topic that I pointed you out to earlier, they contain extremely valuable information, especially for someone who now starts the porting process.
It is mentioned in the 2nd sample there, that because in .Net it is not possible to have an access/assign pair and a method with the same name (Font and Font() in the Control class of the VOSDK), the Font access/assign has been renamed to ControlFont in X#, so you just need to change "Font" to "ControlFont".
About the PCALL problem, this is more tricky, but simplest and most efficient solution is to just define a _DLL function for it, which should work also in VO:
_DLL FUNCTION IsWow64Process(hHandle AS PTR, plWow64Process AS LOGIC PTR) AS LOGIC:KERNEL32.IsWow64Process
....
LOCAL lIsWow64 AS LOGIC
? IsWow64Process(GetCurrentProcess() , @lIsWow64)
? lIsWow64
wriedmann wrote:Hi Glen,
OLE/COM as it worked in VO does not works anymore in X#.
Please see the X# help, "Migrating apps from VO to X#", "Example 5 - The Email Client Example".
That works (I have done it myself).
Wolfgang