User Tools

Site Tools


com_module_sample_vs

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

com_module_sample_vs [2018/06/08 05:37]
wolfgangriedmann created
com_module_sample_vs [2018/06/08 05:40] (current)
wolfgangriedmann
Line 15: Line 15:
 X# X#
    
-  ​Prepare a GUID+  ​Prepare a GUID
    
 The GUID is a unique number and one can be created at https://​www.guidgenerator.com/​online-guid-generator.aspx. ​ The GUID is a unique number and one can be created at https://​www.guidgenerator.com/​online-guid-generator.aspx. ​
Line 22: Line 22:
 587BF093-A8F9-4119-12EB-414AA8FCF344 587BF093-A8F9-4119-12EB-414AA8FCF344
    
-  ​ ​Create a new X# Class library in Visual Studio or Xide. I call the namespace DotNetLibForVO and the class VoDotNetClass+  ​ ​Create a new X# Class library in Visual Studio or Xide. I call the namespace DotNetLibForVO and the class VoDotNetClass
    
 In the startprogram after BEGIN NAMESPACE add the following 3 lines, with the generated guid from above. Note that there are no empty lines in between. The code then looks as follows: In the startprogram after BEGIN NAMESPACE add the following 3 lines, with the generated guid from above. Note that there are no empty lines in between. The code then looks as follows:
Line 36: Line 36:
   RETURN</​code>​   RETURN</​code>​
    
-  ​ Add methods. Here's a working sample: a method to get a file (e.g. one copied to the %temp% directory) in the clipboard, which is not (easily) possible from VO.+  ​ Add methods. Here's a working sample: a method to get a file (e.g. one copied to the %temp% directory) in the clipboard, which is not (easily) possible from VO.
 <​code>​METHOD SaveImageFromClipboard(cFile AS STRING) AS LOGIC <​code>​METHOD SaveImageFromClipboard(cFile AS STRING) AS LOGIC
 //#s Save jpg cFile from clipboard DvK 15-9-2014 //#s Save jpg cFile from clipboard DvK 15-9-2014
Line 59: Line 59:
 RETURN lCreated</​code>​ RETURN lCreated</​code>​
    
-  ​ Make sure to compile in Release mode otherwise your registration will fail.  Compile your DLL and make sure that all depending DLL's in the Release directory are copied in the VO program directory. +  ​ Make sure to compile in Release mode otherwise your registration will fail.  Compile your DLL and make sure that all depending DLL's in the Release directory are copied in the VO program directory. 
-  ​ Click on DotNetLibForVO,​ right mouse button, Properties +  ​ Click on DotNetLibForVO,​ right mouse button, Properties 
-  ​ In Build Events (VS: click Edit Post-build) :+  ​ In Build Events (VS: click Edit Post-build) :
    
 Enter the 3 lines below on Post build Event Comment Line.  Note that you may need to check the exact location of mt.exe and make sure that you do not use the mt.exe in x86 if you are on a 64 bits Windows. This should work too: Enter the 3 lines below on Post build Event Comment Line.  Note that you may need to check the exact location of mt.exe and make sure that you do not use the mt.exe in x86 if you are on a 64 bits Windows. This should work too:
Line 77: Line 77:
 At Run the post-build event choose: On successful build  At Run the post-build event choose: On successful build 
    
-  ​ Build the project. The manifest is now being created the project directory, (DotNetLibForVO.manifest). The DLLs are copied top the directory indicated. Then edit again the Post Build events by adding the REM in the first line so it won't be executed again. Build once more. Your DLL should now contain the manifest info.+  ​ Build the project. The manifest is now being created the project directory, (DotNetLibForVO.manifest). The DLLs are copied top the directory indicated. Then edit again the Post Build events by adding the REM in the first line so it won't be executed again. Build once more. Your DLL should now contain the manifest info.
    
 VO VO
    
-  ​ ​Retrieve c: \ cavo29 ​\ Appwiz \ cctl6.man, modify the program name, set the version number to 2.0.0.0 and add the relevant part of the generated manifest code as Dependency (see example above) and save it in a directory of your choice e.g. c:​\VoManifests. For the X# DLL make sure that processorArchitecture = "msil (and not" * ") +  ​ ​Retrieve c:\cavo28\Appwiz\cctl6.man,​ modify the program name, set the version number to 2.0.0.0 and add the relevant part of the generated manifest code as Dependency (see example above) and save it in a directory of your choice e.g. c:​\VoManifests. For the X# DLL make sure that processorArchitecture = "msil (and not" * ") 
-  ​ Add a module Manifest containing RESOURCE CREATEPROCESS_MANIFEST_RESOURCE_ID RC_RT_MANIFEST c:​\VoManifests\DotNetLibForVO.manifest. Note that after every change in the manifest you should touch the manifest mef and select Rebuild All for the VO Applications . E.g.:+  ​ Add a module Manifest containing RESOURCE CREATEPROCESS_MANIFEST_RESOURCE_ID RC_RT_MANIFEST c:​\VoManifests\DotNetLibForVO.manifest. Note that after every change in the manifest you should touch the manifest mef and select Rebuild All for the VO Applications . E.g.:
    
 RESOURCE CREATEPROCESS_MANIFEST_RESOURCE_ID RC_RT_MANIFEST c:​\VoManifests\ChosenName.manifest RESOURCE CREATEPROCESS_MANIFEST_RESOURCE_ID RC_RT_MANIFEST c:​\VoManifests\ChosenName.manifest
Line 116: Line 116:
 </​assembly></​code>​ </​assembly></​code>​
    
-  ​ To use a method from the library, write code in VO like the code below. For OleAutoObject you use, between {"​Namespacename.Classname"​} (as chosen in 1)+  ​ To use a method from the library, write code in VO like the code below. For OleAutoObject you use, between {"​Namespacename.Classname"​} (as chosen in 1)
    
 <​code>​METHOD PasteImage () CLASS Something <​code>​METHOD PasteImage () CLASS Something
Line 134: Line 134:
 Note that the architecture In yellow is what Windows found in the manifest and in blue what was found in the DLL (from the project settings in e.g. VS). The manifest line in 8), see in blue, must match the one in the DLL, otherwise this error occurs. Note that the architecture In yellow is what Windows found in the manifest and in blue what was found in the DLL (from the project settings in e.g. VS). The manifest line in 8), see in blue, must match the one in the DLL, otherwise this error occurs.
    
-  ​ For more info on the error there'​s one of those terrible command line tools from Microsoft, SX Trace+  ​ For more info on the error there'​s one of those terrible command line tools from Microsoft, SX Trace
    
 SXTrace SXTrace
Line 141: Line 141:
 Administrative privileges are required to use sxstrace.exe Administrative privileges are required to use sxstrace.exe
    
-  ​ Open Command Prompt ​ (Admin) +  ​ Open Command Prompt ​ (Admin) 
-  ​ Start SxSTrace by running the  command: ​ sxstrace.exe Trace -logfile:​tracetest.log+  ​ Start SxSTrace by running the  command: ​ sxstrace.exe Trace -logfile:​tracetest.log
 Note: Make sure you run the command on a directory with write permissions. As an alternative,​ point the –logfile parameter to a directory with write permissions  ​ Note: Make sure you run the command on a directory with write permissions. As an alternative,​ point the –logfile parameter to a directory with write permissions  ​
-  ​ Run the program causing the error message (from Explorer or another prompt). When the error message appears click OK +  ​ Run the program causing the error message (from Explorer or another prompt). When the error message appears click OK 
-  ​ Stop Trace (by pressing Enter in the DOS box) +  ​ Stop Trace (by pressing Enter in the DOS box) 
-  ​ ​Convert log to readable format. The tracetest.log from above is a binary formatted file. This command will convert into human readable format by parsing the binary log file and creating a text file+  ​ ​Convert log to readable format. The tracetest.log from above is a binary formatted file. This command will convert into human readable format by parsing the binary log file and creating a text file
 sxstrace.exe Parse -logfile:​tracetest.log -outfile:​tracetest.txt sxstrace.exe Parse -logfile:​tracetest.log -outfile:​tracetest.txt
    
Line 155: Line 155:
  
 Sample: courtesy by Dick van Kooten Sample: courtesy by Dick van Kooten
- 
- 
com_module_sample_vs.txt · Last modified: 2018/06/08 05:40 by wolfgangriedmann