Raj, if this doesn't make your head hurt. like it does mine
your on your way

... sample code for toolkit
have an issue with opening a drawing with view only mode. But I am getting it, may be I am wrong. Can anybody please guide me to acheive that. Fyi, I am attaching my code herewith.
#include "stdafx.h"
#include <stdlib.h>
extern "C"{
#include <ProCore.h>
#include <ProNotify.h>
#include <ProDrawing.h>
#include <ProDimension.h>
#include <ProUtil.h>
#include <ProMdl.h>
}
ProError ProMdlRetrievePre(ProPath path, ProFileName file_name, ProFileRetrieveOpt **p_retr_options_arr)
{
static ProFileRetrieveOpt arr[]= {PRO_RETRIEVE_OP_VIEW_ONLY}; // Setting to View_Only Mode.
(*p_retr_options_arr) = arr;
return PRO_TK_NO_ERROR;
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
ProProcessHandle proe_handle;
ProError err;
ProBoolean random;
ProMdl mdlHandle;
ProMdldata mdlData;
ProName current_name;
//ProFileName fileFullName;
ProFamilyName fileFullName;
//char proe_command[PRO_NAME_SIZE];
char current_name_in_c[PRO_NAME_SIZE];
//FIX ME: Pro/E Command should be get from user.
//ProStringToWstring(proe_command, "proengg");
//Try to connect to Pro/E if it already running
err = ProEngineerConnect("",NULL,NULL,"",PRO_B_TRUE, 100, &random, &proe_handle);
//If not, start a new Pro/E Session.
if(err != PRO_TK_NO_ERROR)
{
err = ProEngineerStart("proengg", NULL);
err = ProEngineerConnect("",NULL,NULL,"",PRO_B_TRUE, 100, &random, &proe_handle);
}
//If fails notify the user
if(err != PRO_TK_NO_ERROR)
{
printf("%s\n","Error occured while connecting to Pro/Engineer.");
return -1; // failure
}
printf("Connection to Pro/Engineer established.\n");
ProStringToWstring(fileFullName, "c:\\bd857749-03e4-49a8-b056-536d.drw");
//Set the property PRO_RETRIEVE_OP_VIEWONLY
ProNotificationSet(PRO_MDL_RETRIEVE_PRE, (ProFunction)ProMdlRetrievePre); //Using Call back to change mode to View_Only
//err = ProMdlLoad(fileFullName, PRO_MDL_UNUSED, PRO_B_FALSE, &mdlHandle);
err = ProMdlRetrieve(fileFullName, PRO_MDL_DRAWING, &mdlHandle); //Getting TK_GENERAL_ERROR
//Check the model loaded sucsessfully.
if(err != PRO_TK_NO_ERROR)
{
printf("%s\n","Error occured while opening the specified document.");
return -1; // failure
}
ProMdlDisplay(mdlHandle);
ProMdlDataGet(mdlHandle, &mdlData);
ProMdlNameGet(mdlHandle, current_name);
ProWstringToString(current_name_in_c, current_name);
printf("%s\n", current_name_in_c);
ProMdlErase(mdlHandle);
ProEngineerDisconnect(&proe_handle, 10);
return(0);
}
Any sugessions???