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,

Recommended Answers

All 4 Replies

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

did you include windows.h? That's where BOOL and CALLBACK are defined.


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;
    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"));
     MsiSetProperty(hMSI, TEXT("LicenseViewed"), NULL);

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

Thanks and Regards,

:cheesy: :cheesy: :cheesy: you commented out all the include files:eek:

commented: Nice one :P -Niek_E +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.