I have already answered this in another thread. Look at the point about ILinksManager in the following thread
IDocument* doc = Utils<ILayoutUIUtils>()->GetFrontDocument();
InterfacePtr<ILinksManager> linkmanager(doc, UseDefaultIID());
int32 linkcnt = linkmanager->GetLinkCount();
I have used this code to fetch the image count in the document but it displays the duplicate value is my code is correct or not. If not please guide me on this
You really, really should learn basic programming first, before attempting to dive into something as difficult as the InDesign SDK (difficult even for experienced programmers).
I have given up on SDK programming long ago (because it is so very difficult) but even I can spot the problem right away. What number did you believe to append with this line
when that 'ct' is actually the very same PMString!? See an earlier thread for how to properly use "AppendNumber": https://community.adobe.com/t5/indesign/how-concat-string-and-number/td-p/8424376?page=1
(but it would be far, far better for all of us if you first learn how to program C++ -- not only the bare basics, but classes, templates and all! -- and only then return to the InDesign SDK)
apart from the SDK one should know that not all images or graphics in a document were placed and linked.
One could also paste pixels from e.g. PhotoShop. A method that is based on links will fail to notice them.
FWIW: With ExtendScript we have the allGraphics array of a document. Will that get all graphics and images? Ahem. Surprisingly the answer is: No. Images and graphics in not active states of form fields of any kind will not get covered.
( ACP )
Sure Uwe, these cases do exist. I have also not dealt with all these cases, nor am i sure if sdk methods that i mentioned will help for these use cases or not. However the point that Jongware is trying to make is that there is no other option to deal with this other than read the documentation, shortcuts won't work.
Anyways OP did not revert back if a progress was made and if these cases did crop up, but with you comment makes the discussion complete. We can pick this up when needed and ponder if the sdk does help in identifying all cases or not