Photoshop SDK [C++] How could I export a single layer treating it as an object?

coding
photoshop
cpp

#1

I’ve built a Phoshop CS6 plugin; how it works is it exports each layer in the document (By name) with it’s proper image format (png, jpg, etc), my issue is:

I have to turn off each layers viability if I don’t want to export it (I have to loop through all the layers and apply):

  error = sPSActionControl->Play(&result, eventHide, desc2, plugInDialogSilent);
  if (error) goto returnError;

  error = sPSActionControl->Play(&result, eventShow, desc, plugInDialogSilent); 
  if (error) goto returnError;

What I would like to do is export the layer itself as an object (Element) directly.

Do you know off the top of your head if I am able to pass in any predefined key or event that would allow me to export out a single layer (Without having to change any layer visibility)? This is how I get my layers (Pulled from my Photoshop listener):

PIUGetInfoByIndexIndex(layCounter, activeDocID, classLayer, classDocument, 0, &descLayer, NULL);

I would like to do something like this:

error = sPSActionList->PutData(desc, keyThatIDontKnowExists, TheLayerToExport);

ANY help would be appreciated! Thanks guys!