On a new form I put the following code in a button's event:
procedure TForm1.Button3Click(Sender: TObject);
var
hmod: THandle;
hwndScintilla: HWnd;
begin
//hmod := LoadLibrary('SciLexer.DLL');
hmod := LoadLibrary('isscint.dll');
if (hmod=0) then
begin
MessageBox(Handle,
'The Scintilla DLL could not be loaded.',
'Error loading Scintilla',
MB_OK or MB_ICONERROR);
end;
hwndScintilla := CreateWindowEx(0,
'Scintilla','', WS_CHILD or WS_VISIBLE or WS_TABSTOP or WS_CLIPCHILDREN,
10,10,500,400,handle,0, hInstance,nil);
end;
and it worked.
Then simply moved CreateWindowEx part to:
procedure TScintEdit.CreateWnd;
begin
//inherited;
Handle := CreateWindowEx(0,
'Scintilla','', WS_CHILD or WS_VISIBLE or WS_TABSTOP or WS_CLIPCHILDREN,
10,10,500,400,Parent.Handle,0, hInstance,nil);
FDirectPtr := Pointer(SendMessage(Handle, SCI_GETDIRECTPOINTER, 0, 0));
if FDirectPtr = nil then
Error('CreateWnd: FDirectPtr is nil');
{
...
}
end;
Notice that I commented everything else out. This way I don't need to subclass anything. Does it work for you?