Hello,
I am using the latest version of Lazarus on Windows 7 SP1 64bit. I should probably mention that I have one day of experience with FPC and Lazarus - IOW, I'm fairly clueless but trying to correct that problem.
I am compiling a program for 32bit execution (for now, after everything works right in 32bit, I'll tackle the 64bit version.)
The example consists of porting a very simple Windows API program which compiles and runs with Delphi 2 (yes, version 2) and performs as expected.
The program's resource file is produced by BRCC32.exe with the -w32 option to create a 32bit Windows resource file.
When Delphi 2 is handed the resulting .res file, it includes it in the executable and the resources, which include a menu and a dialog box are present and work as expected.
When using the same resource file with Lazarus or the command line FreePascal compiler, the menu and the dialog box are missing indicating that something went wrong with the resource file.
The file are as follows
1. resource.pas
{ resource IDs for the TextOut example }
{-----------------------------------------------------------------------------}
INTERFACE
{-----------------------------------------------------------------------------}
const
IDM_EXIT = 900;
IDM_ABOUT = 990;
{-----------------------------------------------------------------------------}
IMPLEMENTATION
{-----------------------------------------------------------------------------}
end.
the resource file .rc which "includes" the above resource.pas is as follows:
#include "resource.pas"
APPICON ICON "APPICON.ICO"
APPMENU MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "E&xit", IDM_EXIT
END
POPUP "&Help "
BEGIN
MENUITEM "&About TextOut ...", IDM_ABOUT
END
END
ABOUTBOX DIALOG 42, 20, 170, 90
STYLE DS_MODALFRAME | WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU
CAPTION "About TextOut"
FONT 8, "MS Sans Serif"
BEGIN
ICON "APPICON", -1, 10, 10, 32, 32
LTEXT "Win32 API Example - Functions", -1, 35, 10, 170, 10
LTEXT "TextOut", -1, 35, 20, 170, 10
CTEXT "Copyright \251 1997 You can copy it",-1, 1, 40, 170, 10
CTEXT "All rights reserved.", -1, 1, 48, 170, 10
DEFPUSHBUTTON "OK", IDOK, 60, 67, 50, 14
END
and the relevant bit of the program that uses the resource is as follows:
{$APPTYPE GUI}
{$IFDEF FPC}
{$MODE Delphi}
{$MODESWITCH ANSISTRINGS-}
{$ENDIF}
{$LONGSTRINGS OFF}
{$WRITEABLECONST ON}
{$R textout.RES}
program _TextOut;
uses Windows, Messages, Resource;
Delphi 2 is happy with all of the above and produces what is show in the attachement that shows the program with its menu and its dialog box.
FPC and Lazarus, produce the program that has no menu and no dialog.