Missing ACE64 Methods

Public support forum for peer to peer support with related to the Visual Objects and Vulcan.NET products
User avatar
rjpajaron
Posts: 364
Joined: Fri Nov 06, 2015 12:01 am

Missing ACE64 Methods

Post by rjpajaron »

Hi,

I did this but it resulted XS9002

Code: Select all


[DllImportAttribute("ace64.dll", CharSet := CharSet.Ansi)]
PUBLIC STATIC METHOD AdsMgGetOpenTables(hMgmtHandle AS IntPtr, pucUserName AS STRING, usConnNumber AS WORD, astOpenTableInfo OUT ADS_MGMT_TABLE_INFO, pusArrayLen OUT WORD, pusStructSize REF WORD) AS DWORD

[DllImportAttribute("ace64.dll", CharSet := CharSet.Ansi)]
PUBLIC STATIC METHOD AdsMgGetUserNames( hMgmtHandle AS IntPtr, pucFileName AS STRING, astUserInfo OUT ADS_MGMT_USER_INFO, pusArrayLen OUT WORD, pusStructSize OUT WORD ) AS DWORD
AdsMgGetOpenTables and AdsMgGetUserNames are both functions found at ADS ACE AEF but missing in XSharp.ADS namespace.

Thanks,

Rene
User avatar
Chris
Posts: 4936
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Missing ACE64 Methods

Post by Chris »

Hi Rene,

You just need to add a semicolon at the end of the first line with the attribute. It's like in VO, where if you want to continue a statement to the next line, you have to tell that to the compiler with a semicolon.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
rjpajaron
Posts: 364
Joined: Fri Nov 06, 2015 12:01 am

Missing ACE64 Methods

Post by rjpajaron »

Chris wrote:Hi Rene,

You just need to add a semicolon at the end of the first line with the attribute. It's like in VO, where if you want to continue a statement to the next line, you have to tell that to the compiler with a semicolon.
I copied from ACE.AEF, usual VO syntax...

and it works:

Code: Select all

_DLL FUNC AdsMgGetOpenTables( hMgmtHandle AS IntPtr, pucUserName AS STRING, usConnNumber AS DWORD, astOpenTableInfo OUT ADS_MGMT_TABLE_INFO, pusArrayLen OUT DWORD, pusStructSize REF DWORD ) AS DWORD PASCAL:ACE64.AdsMgGetOpenTables

_DLL FUNC AdsMgGetUserNames( hMgmtHandle AS IntPtr, pucFileName AS PSZ, astUserInfo OUT 
ADS_MGMT_USER_INFO, pusArrayLen OUT DWORD, pusStructSize OUT DWORD ) AS DWORD PASCAL:ACE32.AdsMgGetUserNames

I hope so this will works on testing soon...

--

Rene
User avatar
robert
Posts: 4540
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Missing ACE64 Methods

Post by robert »

Rene,
One of these prototypes are for the 64 bit DLL. I think you need to change that to ACE32.
In the next version of X# we have added some more prototypes. I will make sure that all the prototypes in the VO AEF are included.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
rjpajaron
Posts: 364
Joined: Fri Nov 06, 2015 12:01 am

Missing ACE64 Methods

Post by rjpajaron »

robert wrote:Rene,
One of these prototypes are for the 64 bit DLL. I think you need to change that to ACE32.
In the next version of X# we have added some more prototypes. I will make sure that all the prototypes in the VO AEF are included.

Robert
Please do Robert,

I need that two API to work. I am not yet sure mine will works. I use that to monitor activity and prevent admin from some task when other users are still in using some tables. Right now, I am still in the middle of 2nd "solutions" of our apps. Two more to go. I am in shock still on the degree of sophistication X# has become. I mostly coded on X# new stuff until now. I have so many bad codes in my VO stuff. Rather than run a refactoring and search and replace, I prefer to read errors and warnings to understand what it means. I was shock yesterday that X# requires subclass to have CONSTRUCTOR of its own and the error message is so cryptic for me. Hence, I posted about SUPER. I am use to SUPER:SomeMethodName()...

Happy New Year. I am now happy to return to FOX on January. One of those thing that I love in X# IntelliSense. It is quite a notch than it was before. There is one thing you need to consider. See photos. It believe that also make it easier for us to browse fields, members and all those methods/properties as item on Solutions > Project Tree. Of course, the combo box is consistent on what we have on C#.

Happy New Year. I cannot believe I am working on New Year's Eve....
12-30-2019 19-47-45.png
12-30-2019 19-47-45.png (62.73 KiB) Viewed 701 times
--

Rene
User avatar
rjpajaron
Posts: 364
Joined: Fri Nov 06, 2015 12:01 am

Missing ACE64 Methods

Post by rjpajaron »

Hi Robert,

Finally, our "big" apps now completely in X# and I already put all Moving Forward Plan on X#.

I have crashes for weeks on test computers but not on my laptop, only to realized that I did not include all the files in %:Program Files (x86)XSharpRedist

Now, all good. Remaining problem is ReportPro reports that have imbedded expression like this:

Code: Select all

IIF(temptable:OK,+temptable:somevalue,"")


ReportPro on VO will simply execute it, but X# will trigger crashes. Most of the adjustment I did was on bBrowser. ported VO apps was from older bBrowser. Somehow some code does not work.

FOX subs is already top of our budget next year BUT we shall get this before year end to get the discount.

However, the following ADS ACE32 Method prototypes is still missing in XSharp.RDD > XSharp.ADS.ACE32:

Code: Select all

AdsMgGetUserNames( hMgmtHandle AS DWORD, pucFileName AS PSZ, astUserInfo REF ADS_MGMT_USER_INFO, pusArrayLen REF WORD, pusStructSize REF WORD ) AS DWORD PASCAL:ACE32.AdsMgGetUserNames

FUNC AdsMgGetOpenTables( hMgmtHandle AS DWORD, pucUserName AS PSZ, usConnNumber AS WORD, astOpenTableInfo REF ADS_MGMT_TABLE_INFO, pusArrayLen REF WORD, pusStructSize REF WORD ) AS DWORD PASCAL:ACE32.AdsMgGetOpenTables
Closer inspection, majority of AdsMgXXXXX aren't supported. This is the last issue am trying to fix. For now, this feature: Ability to learn the number of users and tables open on the ADS remote server is still not-supported. I look for another way to do this. I used this features to determine which computers still running apps and what tables opened. In other way around, I query if particular table is open before doing anything else. For now, this is turn off.

Further observation from my testers: it looks cooler (I have no idea what they meant) and faster (I observed this too).

One issues on 2.6b. Forms are not properly rendered. I made an adjustments on the control width and height. It appears the changes is ignored. Another is Form Editor (at design time and test mode) background use the color of some controls making visually inaccurate. This is not an important issue for me now. But as I move completely to X#, it will be in the future.

Regards,

Rene
User avatar
rjpajaron
Posts: 364
Joined: Fri Nov 06, 2015 12:01 am

Missing ACE64 Methods

Post by rjpajaron »

Hi Robert,

See attachment, taken from Help of ADS Data Architect > Advantage Management API Functions. I used majority of that functions on VO apps.

Thanks.
Screenshot 2020-10-25 151256.png
Screenshot 2020-10-25 151256.png (103 KiB) Viewed 701 times
rjpajaron wrote:Hi Robert,

Finally, our "big" apps now completely in X# and I already put all Moving Forward Plan on X#.

I have crashes for weeks on test computers but not on my laptop, only to realized that I did not include all the files in %:Program Files (x86)XSharpRedist

Now, all good. Remaining problem is ReportPro reports that have imbedded expression like this:

Code: Select all

IIF(temptable:OK,+temptable:somevalue,"")


ReportPro on VO will simply execute it, but X# will trigger crashes. Most of the adjustment I did was on bBrowser. ported VO apps was from older bBrowser. Somehow some code does not work.

FOX subs is already top of our budget next year BUT we shall get this before year end to get the discount.

However, the following ADS ACE32 Method prototypes is still missing in XSharp.RDD > XSharp.ADS.ACE32:

Code: Select all

AdsMgGetUserNames( hMgmtHandle AS DWORD, pucFileName AS PSZ, astUserInfo REF ADS_MGMT_USER_INFO, pusArrayLen REF WORD, pusStructSize REF WORD ) AS DWORD PASCAL:ACE32.AdsMgGetUserNames

FUNC AdsMgGetOpenTables( hMgmtHandle AS DWORD, pucUserName AS PSZ, usConnNumber AS WORD, astOpenTableInfo REF ADS_MGMT_TABLE_INFO, pusArrayLen REF WORD, pusStructSize REF WORD ) AS DWORD PASCAL:ACE32.AdsMgGetOpenTables
Closer inspection, majority of AdsMgXXXXX aren't supported. This is the last issue am trying to fix. For now, this feature: Ability to learn the number of users and tables open on the ADS remote server is still not-supported. I look for another way to do this. I used this features to determine which computers still running apps and what tables opened. In other way around, I query if particular table is open before doing anything else. For now, this is turn off.

Further observation from my testers: it looks cooler (I have no idea what they meant) and faster (I observed this too).

One issues on 2.6b. Forms are not properly rendered. I made an adjustments on the control width and height. It appears the changes is ignored. Another is Form Editor (at design time and test mode) background use the color of some controls making visually inaccurate. This is not an important issue for me now. But as I move completely to X#, it will be in the future.

Regards,

Rene
User avatar
robert
Posts: 4540
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Missing ACE64 Methods

Post by robert »

Rene,
We never promises to support the full Advantage API. We created an Advantage RDD and we have included most of the API calls necessary to create a connection, open a table etc.
However, It should not take you longer than an hour or two to add the missing functions that you need.
I think the ACE32 and ACE64 prototypes are already there:
https://github.com/X-Sharp/XSharpPublic ... 4.prg#L998

All you have to do is add a method with the same name that checks if the app is running on 32 or 64 bits and call the right method.
For methods that are used a lot we have created delegates, to avoid this 32 bit check for every call. But if you are not calling these functions a lot then code such as in:
https://github.com/X-Sharp/XSharpPublic ... .prg#L2190
will suffice.

Robert





Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
rjpajaron
Posts: 364
Joined: Fri Nov 06, 2015 12:01 am

Missing ACE64 Methods

Post by rjpajaron »

Hi Robert,

There must be reason why you did not support this two functions:
1. AdsMgGetUserNames()
2. AdsMgGetOpenTables()

Both uses a structure. Yesterday and early today, I spent time to observe how VO and X# operates on Structure. Both give different resullt
User avatar
rjpajaron
Posts: 364
Joined: Fri Nov 06, 2015 12:01 am

Missing ACE64 Methods

Post by rjpajaron »

Hi Robert,

This is the whole code:

Code: Select all

METHOD GetOpenTablesList() AS VOID PASCAL CLASS RemoteDbServerMonitor_Win
	LOCAL hMgmtHandle AS DWORD
	LOCAL ulRetVal AS DWORD
	LOCAL usStructSizeTable,  usStructSizeUsers AS DWORD
	LOCAL usArrayLenTable, usArrayLenUsers AS DWORD
	LOCAL pbufferTable AS ADS_MGMT_TABLE_INFO
	LOCAL pbufferUsers AS ADS_MGMT_USER_INFO
	LOCAL tableName AS STRING
	LOCAL i, j AS DWORD
	LOCAL pos AS DWORD 
	LOCAL userName AS STRING  
	
	BEGIN SEQUENCE
	
	tableArrayList := {}
	userArrayList := {}
	
	tableCount := 0
	userCount := 0
	
	//ulRetVal := AdsMgConnect( String2Psz(GetIni():ServerPath), String2Psz("administrator"), String2Psz("ZM10lapq67101"), @hMgmtHandle ) 
	ulRetVal := AdsMgConnect( String2Psz(GetIni():ServerPath), NULL_PSZ, NULL_PSZ, @hMgmtHandle ) 
 
	// If there was an error then show it and exit
	IF ulRetVal <> AE_SUCCESS
		WarnBox(SELF, "Could not connect to server." +CRLF2 +"Server connection error!!!") 
		BREAK
	ENDIF 

	usArrayLenTable := 250 
	usStructSizeTable := _SIZEOF( ADS_MGMT_TABLE_INFO )   
	pbufferTable := MemAlloc( usArrayLenTable * usStructSizeTable ) 
	
	ulRetVal := AdsMgGetOpenTables( hMgmtHandle, NULL, 0, pbufferTable, @usArrayLenTable, @usStructSizeTable)
	
	IF ulRetVal <> AE_SUCCESS
		WarnBox(SELF, "Could not determined number of tables currently open at the server located at: " +GetIni():ServerPath +CRLF2 +"Server access error!!!") 
		BREAK
	END
	
	FOR j:= 1 UPTO usArrayLenTable
		//? @pbufferTable.aucTableName
		//? pbufferTable.aucTableName
		t[b]ableName := Psz2String(@pbufferTable.aucTableName)[/b]
		pos := AScan(requiredTables,{|x| Upper(x) == Upper(FileBase(tableName)) } )
		IF pos > 0
			BEGIN SEQUENCE
				
				usArrayLenUsers := 250
				usStructSizeUsers := _SIZEOF(ADS_MGMT_USER_INFO)
				pbufferUsers := MemAlloc(usArrayLenUsers * usStructSizeUsers)
			
				ulRetVal := AdsMgGetUserNames( hMgmtHandle, @pbufferTable.aucTableName, pbufferUsers, @usArrayLenUsers, @usStructSizeUsers)
				
				IF ulRetVal <> AE_SUCCESS
					WarnBox(SELF, "Could not determined number of users on table: " +tableName +CRLF2 +"Table access error!!!") 
					BREAK
				ENDIF		
				
				FOR i := 1 UPTO usArrayLenUsers
					userName := Psz2String(@pbufferUsers.aucUserName)
					IF AScan(userArrayList,userName) == 0
						AAdd(userArrayList,userName)  
						userCount += 1
					ENDIF   
					AAdd(tableArrayList,{FileBase(tableName),; //table filename without extension
												FilePath(tableName),; //full path
										 		userName,; //user name
										 		pbufferUsers.usConnNumber,;
										 		Psz2String(@pbufferUsers.aucAuthUserName),; //auth user name
										 		Psz2String(@pbufferUsers.aucAddress)} ) //address
					tableCount += 1
					pbufferUsers++					
				NEXT 
				
			END SEQUENCE
			
			IF pbufferUsers != NULL_PTR	
				MemFree(pbufferUsers)
			ENDIF
			
		ENDIF
		
		pbufferTable++
	
	
	NEXT
	
	//get server date & time	
	SELF:GetServerTime()
	//
	
		
	END SEQUENCE   

	IF pbufferTable != NULL_PTR	
		MemFree(pbufferTable)
	ENDIF        
	
	IF pbufferUsers != NULL_PTR	
		MemFree(pbufferUsers)
	ENDIF        
		
	AdsMgDisconnect( hMgmtHandle )
	
	RETURN

Primary purpose of above code is to get number and list of tables current open on the server and get name of computers (users). This way, I can warn admin as to what tables is currently open and what computers it was opened.

I think this is important to support in X#.

I postpone any work on this for the mean time. I have limited know how on structure and some low level stuff.

Regards,

Rene
Post Reply