Mega Code Archive

 
Categories / Delphi / API
 

Calling windows registerclass function

Question: I want to call the Windows RegisterClass() function, but I get the error "Incompatible types: 'TPersistantClass' and 'TWndClassA'" when compiling. How can I get around this? Answer: The RegisterClass() function is declared both in the Classes unit and the Windows unit. To call the Windows version, simply prefix the call with the unit name. Example: procedure TForm1.Button1Click(Sender: TObject); wc : TWndClass; begin Windows.RegisterClass(wc) end;