Yes, you are right those are the 4 different ways, but the Edit/Lock does not count when the current project is a Teamwork project, and the "Teamwork Lock" does not count when it's a normal (not Teamwork) project. The ACAPI_TeamworkControl_HasConnection function tells whether the currently opened project is a Teamwork project.
1. Edit/Lock
- if the element is locked then the value of elem.header.lockId is 1
- the elem.header.lockId is a read-only field, so to lock/unlock an element use ACAPI_Element_Tool with APITool_Lock/APITool_Unlock parameters.
2. Layer Lock
- you can get the index of the element's layer from elem.header.layer and you have to retrieve the layer attribute using ACAPI_Attribute_Get to get the flags of the layer. If the flags of the layer contains APILay_Locked then the layer is locked, so the element is on a locked layer.
- you must modify the element's layer using ACAPI_Attribute_Modify to lock the layer.
3. Teamwork Lock
- your link leads to a good example, so I don't go into the details here.
4. Hotlinked element
- if the element is a member of a hotlink then the elem.header.hotlinkGuid is not APINULLGuid.