Hi ,

I want to create a dll using the cpp file. I have followed some steps which I got from the some forums and tried to create a dll and it throws the following errors.

**********************************************************
islicenseviewed.cpp(19) : error C2146: syntax error : missing ';' before identifier 'CALLBACK'

islicenseviewed.cpp(19) : error C2501: 'BOOL' : missing storage-class or type specifiers

islicenseviewed.cpp(19) : fatal error C1004: unexpected end of file found

Generating Code...
Error executing cl.exe
***********************************************************

I have turned off the using of the precompiled headers. I don't know how to avoid these errors.

Please help me on this.

Thanks and Regards,
Gauravji

You have problems in your sourcecode. Please post your code so we can help you.

Edited 6 Years Ago by Nick Evan: n/a

Hi,

Please find the source code below.

//***********************************************************
//** This source code is provided "AS IS" with no warranties, 
//** and confers no rights.
//** Author: Kallely L Sajan (<snip e-mail>)
//***********************************************************
//** Include the standard header files here
 //#include "stdafx.h"
 //#include < windows.h >
 //#include < msi.h >
 //#include < msiquery.h >
//***********************************************************
//** Call back function for EnumChildWindows()
//**---------------------------------------------------------
//** Author: Kallely L Sajan (<snip email>)
//***********************************************************
BOOL CALLBACK EnumChildProc(HWND hwnd,LPARAM lParam)
{
  TCHAR buf[100];
  GetClassName( hwnd, (LPTSTR)&buf, 100 );
  if ( _tcscmp( buf, _T("RichEdit20W") ) == 0 )
  {
   *(HWND*)lParam = hwnd;
   return FALSE;
  }
  return TRUE;
}

//***********************************************************
//** Custom action to check if the license is completly 
//** viewed. 
//**---------------------------------------------------------
//** Return values:
//**  (1) Always returns success
//**    (2) Sets the private property LicenseViewed when 
//**        the text is scrolled to near end.
//**---------------------------------------------------------
//** Usage:
//**  (1) Change "MyProduct Installer" to the window title 
//**     of the license agreement window
//** (2) In the license agreement dialog, on the scrollable 
//**      text control event, call the custom action 
//**      CheckLicenseViewed using a DoAction
//**  (3) For the Next button, modify the Enable 
//**      ControlCondition to include the property 
//**      LicenseViewed
//**---------------------------------------------------------
//** Author: Kallely L Sajan (<snip email>)
//***********************************************************
UINT __stdcall CheckLicenseViewed(MSIHANDLE hMSI)
{
 HWND hWnd;
 HWND hWndChild=NULL;
 if (MsiEvaluateCondition(hMSI,"LicenseViewed")==MSICONDITION_FALSE) 
 {
  hWnd = FindWindow(NULL, "MyProduct Installer");
  if (hWnd) 
  {
   EnumChildWindows( hWnd, EnumChildProc, (LPARAM)&hWndChild );
   if ( hWndChild ) 
   {
    SCROLLINFO sinfo;
    sinfo.cbSize=sizeof(sinfo);
    sinfo.fMask=SIF_TRACKPOS | SIF_RANGE | SIF_POS | SIF_PAGE;
    GetScrollInfo(hWndChild, SB_VERT, &sinfo);
    //max range depends on page size
    UINT MaxScrollPos = sinfo.nMax  - (sinfo.nPage - 1) ;
    //max less, say 5 - an allowable max.
    MaxScrollPos = MaxScrollPos - 5;
    if (sinfo.nTrackPos  > MaxScrollPos) 
    {
     MsiSetProperty(hMSI, TEXT("LicenseViewed"), TEXT("1"));
    }
    else
     MsiSetProperty(hMSI, TEXT("LicenseViewed"), NULL);
   }
  }
 }
 return ERROR_SUCCESS;
}

Please let me know what is wrong with this and how can I create a dll from this ?

Thanks and Regards,
Gauravji

This article has been dead for over six months. Start a new discussion instead.