Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

List of Visu Users - Exception Error

Anonymous
2019-01-14
2022-02-01
  • Anonymous - 2019-01-14

    Originally created by: massimiliano.legati

    Hi,
    I want to handle visu users via code.
    One of the main topics is to read the users (and groups) list.
    I'm testing the method "GetUsers" of VisuUserManagement.VisuUserMgmt but my system crash.
    The code looks good, I can't understand.

    This is the code implemented:

    VAR
       iFBUserMng   : VisuUserManagement.VisuUserMgmt;
       stRet      : VisuUserManagement.VUM_ReturnValues;
       
       udiNumberOfUsers   : UDINT;
       dwUserDB         : DWORD;
       xUpdateUserList      : BOOL;
       
       astUserList         : ARRAY[0..10] OF VisuUserManagement.VUM_User;
       dwpUserList         : POINTER TO ARRAY[0..0] OF VisuUserManagement.VUM_User;
       udiUserListSize   : UDINT;
    END_VAR
    IF xUpdateUserList THEN
       dwUserDB := iFBUserMng.GetUserDBAsCopy();
       udiNumberOfUsers := iFBUserMng.GetUserCount(dwUserDB);
       xUpdateUserList := FALSE;
       
       dwpUserList := ADR(astUserList);
       udiUserListSize := SIZEOF(astUserList); 
       
       
       stRet := iFBUserMng.GetUsers(
                      dwUserDB:= dwUserDB, 
                      udiStartIndex:= 1, 
                      udiEndIndex:= 1, 
                      pArr:= dwpUserList, 
                      udiArrSize:= udiUserListSize);
       
    END_IF;
    
     
  • e.kislov - 2019-01-14

    I'm not sure, but

     dwpUserList         : POINTER TO ARRAY[0..0] OF VisuUserManagement.VUM_User;
    

    seems strange.

     
  • Anonymous - 2019-01-14

    Originally created by: massimiliano.legati

    I tested it in thousand ways...this is just the last version.

    I already tested:

    dwpUserList         : POINTER TO ARRAY[0..10] OF VisuUserManagement.VUM_User;
    

    And also with ARD(...) and SIZE_OF(...) directly on the method call.

     
  • ydc001 - 2022-01-31

    Hello, does someone has an update? How can all existing users be retrieved? Kind regards!

     

Log in to post a comment.