I am not sure whether you are using TestStand 1.0.x or 2.0. It sounds like you are trying to program an operator interface since you are using the NewExecution method and handling UIMessages.
You may want to take a look at the example "Simple MFC Operator Interface". From www.ni.com/support you can search Example Programs to find the above example. There are 2 attached examples. SimpleMFC.zip contains an example that uses the #import "teapi.dll" implemenation.
TestStand 2.0 ships with an VC opeator interface that uses the #import. It was based on the example above. In addition, TS 2.0 contains new information in the help file regarding the #import implementation. TS 1.0 help file did not contain this information.