Visualizzazione dei risultati da 1 a 3 su 3

Discussione: Delphi: Tipi

  1. #1
    Utente di HTML.it
    Registrato dal
    Feb 2003
    Messaggi
    14

    Delphi: Tipi

    Qualcuno mi sa dire il perchè ricevo questi errori.
    Se al posto della funzione dichiaro una procedura, funziona tutto.



    [Error] TestAppU.pas(31): Function needs result type
    [Error] TestAppU.pas(31): '=' expected but ';' found

    procedure TForm1.Button1Click(Sender: TObject);
    type
    TShowForm = function ShowForm : Integer; stdcall; <== Riga 31
    var
    DLLInstance : THandle;
    ShowForm : TShowForm;
    begin
    DLLInstance := LoadLibrary('myforms.dll');
    @ShowForm := GetProcAddress(DLLInstance, 'ShowForm');
    ShowForm;
    FreeLibrary(DLLInstance);
    end;

  2. #2
    Moderatore di Programmazione L'avatar di alka
    Registrato dal
    Oct 2001
    residenza
    Reggio Emilia
    Messaggi
    24,310

    Ometti il nome...

    Se definisci un prototipo di funzione, non devi specificare il nome di alcuna funzione nella dichiarazione.
    codice:
    TShowForm = function: Integer; stdcall;
    Ciao!
    MARCO BREVEGLIERI
    Software and Web Developer, Teacher and Consultant

    Home | Blog | Delphi Podcast | Twitch | Altro...

  3. #3
    Utente di HTML.it
    Registrato dal
    Feb 2003
    Messaggi
    14
    grazie 1000 alka.
    :metallica :metallica :metallica

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.