Hi there, I'm trying to create a small VB app to apply a color transform fom RGB to CMYK between two different profiles. I have put together the following code:
In my module I have: '----------------------------------- Public Type TRGB8 r As Long g As Long b As Long End Type Public Type TCMYK8 c As Long m As Long y As Long k As Long End Type Public Enum cmsIntent cmsPerceptual = 0 cmsRelativeColorimetric = 1 cmsSaturation = 2 cmsAbsoluteColorimetric = 3 End Enum Public Const lTYPE_RGB_8 As Long = 262169 Public Const lTYPE_CMYK_8 As Long = 393249 Declare Function cmsOpenProfileFromFile Lib "lcms.dll" _ (ByVal sProfilePath As String, ByVal sAccess As String) As Long Declare Function cmsCloseProfile Lib "lcms.dll" _ (ByVal lProfileHandle As Long) As Boolean Public Declare Function cmsCreateTransform Lib "lcms.dll" _ (ByVal lInputProfile As Long, ByVal lInputFormat As Long, _ ByVal lOutputProfile As Long, ByVal lOutputFormat As Long, _ ByVal iIntent As Integer, ByVal lFlags As Long) As Long Declare Function cmsDoTransform Lib "lcms.dll" _ (ByVal lTransformHandle As Long, ByRef lInputBuffer As TRGB8, ByRef lOutputBuffer As TCMYK8, ByVal lSize As Long) Declare Function cmsDeleteTransform Lib "lcms.dll" _ (ByVal lTransformHandle As Long) '------------------------------------------------------------------ and in form1 I have: '------------------------------------------------------------------ Private Sub Form_Load() Dim lInputProfile As Long Dim lOutputProfile As Long Dim lTransformHandle As Long Dim lOutputDib As Long Dim T_RGB As TRGB8 Dim T_CMYK As TCMYK8 lInputProfile = cmsOpenProfileFromFile("c:\winnt\system32\spool\drivers\color\sRGB Color Space Profile.icm", "r") lOutputProfile = cmsOpenProfileFromFile("c:\winnt\system32\spool\drivers\color\Photoshop5DefaultCMYK.icc", "r") ' Create Transform lTransformHandle = cmsCreateTransform(lInputProfile, lTYPE_RGB_8, lOutputProfile, lTYPE_CMYK_8, cmsPerceptual, 0) T_RGB.r = 1 T_RGB.g = 1 T_RGB.b = 1 cmsDoTransform lTransformHandle, T_RGB, T_CMYK, 1 cmsDeleteTransform lTransformHandle cmsCloseProfile lInputProfile cmsCloseProfile lOutputProfile End Sub ---------------------------------------------------------------------------------- I have no idea why, but VB always completely crashes and closes on the line: cmsDoTransform lTransformHandle, T_RGB, T_CMYK, 1 and if I comment out that line, it crashes on cmsDeleteTransform lTransformHandle Has anyone successfully been able to use lcms in VB yet? Thanks to anyone who can help me out!! Tyler ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf _______________________________________________ Lcms-user mailing list Lcms-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lcms-user