Registering ProgId programatically to create Framemaker session
We created a Console application to create Framemaker session using FDKProgrammer guide. We were able to register Progid manually using the below command line:
Win+R : “C:\Program Files (x86)\Adobe\Adobe FrameMaker 2019 (32 Bit)\Framemaker.exe “/progid:Test321 /auto
We connect to the session using the below code snippet.
StringT opt_progid;
CLSID pclsid;
LPOLESTR progStr;
HRESULT res;
F_ObjHandleT docId;
// Get the process name.
opt_progid = (StringT)"NewTest";
// Convert the process name into a GUID
progStr = (OLECHAR*)malloc(WBUFLEN*sizeof(wchar_t));
if (0 == MultiByteToWideChar(CP_ACP, 0,
(char *)opt_progid, -1, progStr, WBUFLEN)) {
fprintf(stderr, "failed to allocate\n");
return(1);
}
if (progStr[0] == '{') // hex-codes within brackets
res = CLSIDFromString(progStr, &pclsid);
else
res = CLSIDFromProgID(progStr, &pclsid);
IntT fReturn = F_ApiWinConnectSession(NULL, NULL, &pclsid);
if (fReturn != 0)
{
FA_errno = FE_Success;
}
// Print the name of the current document.
docId = F_ApiGetId(0, FV_SessionId, FP_ActiveDoc);
if (docId) {
StringT docname = F_ApiGetString(FO_Session, docId,
FP_Name);
fprintf(stderr, "Current document: %s\n", docname);
F_ApiDeallocateString(&docname);
}
else
fprintf(stderr, "No active document\n");
Now we want to programmatically register Progid so that FDK Libraries consume the GUID from system registry for the given ProgId (we have dynamic Progid’s being passed while creating the Framemaker session) and work with it to create a Framemaker session etc.
