Posts

Showing posts from October, 2005

Reflection API to access COM objects sample

quoted from URL Object o; System.Type t = Type.GetTypeFromProgID("MODI.Document"); o = System.Activator.CreateInstance(t); Object[] a = new Object[1]; a[0] = "C:\\Temp\\iri36300.TIF"; t.InvokeMember("Create", BindingFlags.InvokeMethod, null, o, a); Object images = t.InvokeMember( "Images", BindingFlags.GetProperty, null, o, new Object[] {} ); Type imagesType = images.GetType(); Object item = imagesType.InvokeMember( "Item", BindingFlags.GetProperty, null, images, new Object[] {"0"} ); Type itemType = item.GetType(); itemType.InvokeMember("OCR", BindingFlags.InvokeMethod, null, item, new Object[] { 9 } ); Object layout = itemType.InvokeMember("Layout", BindingFlags.GetProperty, null, item, new Object[] {} ); Type layoutType = layout.GetType(); Object ocrResult = layoutType.InvokeMember( "Text", BindingFlags.GetProperty, null, layout,

Locating MAPI directory using FGetComponentPath

Codes below quoted from URL By Sam Charchian typedef BOOL (STDAPICALLTYPE FGETCOMPONENTPATH) (LPSTR szComponent, LPSTR szQualifier, LPSTR szDllPath, DWORD cchBufferSize, BOOL fInstall); typedef FGETCOMPONENTPATH FAR * LPFGETCOMPONENTPATH; static TCHAR s_szMSIApplicationLCID[] = "Microsoft\\Office\\9.0\\Outlook\0LastUILanguage\0"; // STRING_OK static TCHAR s_szMSIOfficeLCID[] = "Microsoft\\Office\\9.0\\Common\\LanguageResources\0UILanguage\0InstallLangu age\0"; // STRING_OK //////////////////////////////////////////////////////////////////////////// /// // Function name : CSVCFile::InitMAPIDir // Description : For Outlook 2000 compliance. This will get the correct path to the // : MAPISVC.INF file. // Return type : void // Argument : LPSTR szMAPIDir - Buffer to hold the path to the MAPISVC file. void CSVCFile::InitMAPIDir(LPTSTR szMAPIDir) {