Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Pascal - Borland Pascal
Forum - Pascal - Borland Pascal

Avatar
Saladino (Member)
Pro


Messaggi: 90
Iscritto: 30/05/2010

Segnala al moderatore
Postato alle 11:02
Sabato, 12/06/2010
Questo è il link per Borland Pascal.
http://hotfile.com/dl/25853326/80b366f/BP_pascal.rar.html
Non so perchè ,ma quando vengo a creare una app window nel task menager non indica alcuna memoria , ed alla chiusura del programma mi da errore dicendo General Protection Fault.

Ecco un esempio per creare un applicazione windows :
Codice sorgente - presumibilmente Delphi

  1. program ciao;
  2. uses
  3.  Owindows;
  4.  
  5. Type
  6.  Applicazione = Object(TApplication)
  7.   Procedure InitMainwindow; Virtual;
  8.  end;
  9.  
  10. Var
  11.   App : Applicazione;
  12.  
  13. Procedure Applicazione.InitMainWindow;
  14. begin
  15.  MainWindow := New( Pwindow ,Init(nil ,'Ciao Borland Pascal'));
  16. end;
  17. begin
  18.  App.Init('Ciao Borland Pascal');
  19.  App.Run;
  20.  App.Done;
  21. end.



Ricordatevi di scaricare questa dll al seguente indirizzo e di metterla in Bin
http://www.nodevice.com/dll/BWCC_DLL/item3026.html

Ultima modifica effettuata da Phi il 13/06/2010 alle 8:14
PM Quote
Avatar
Phi (Member)
Expert


Messaggi: 241
Iscritto: 30/12/2009

Segnala al moderatore
Postato alle 16:09
Lunedì, 14/06/2010
Scusa ho dei problemi con compilatore. Non trova il file della unit owindows.

Comunque non hai detto cosa dovrebbe fare il programma.
Deve aprite una finestra GUI bianca con titolo "CIAO" ?? O ho capito male.

PM Quote
Avatar
Saladino (Member)
Pro


Messaggi: 90
Iscritto: 30/05/2010

Segnala al moderatore
Postato alle 16:30
Lunedì, 14/06/2010
Vai nella cartella unit e copia tutto in bin.

PM Quote
Avatar
Phi (Member)
Expert


Messaggi: 241
Iscritto: 30/12/2009

Segnala al moderatore
Postato alle 18:06
Lunedì, 14/06/2010
L'ho fatto ma non la trova comunque. :_doubt:


Ma non basta scrivere:

Codice sorgente - presumibilmente Delphi

  1. program CIAO;
  2. {$MODE DELPHI}
  3. uses Windows;
  4.  
  5. function WindowProc(Window:HWnd; AMessage,WParam,LParam:Longint): Longint; stdcall;
  6. begin
  7. WindowProc := 0;
  8. case AMessage of
  9.  wm_Destroy : begin
  10.   PostQuitMessage(0);
  11.   Exit;
  12.  end;
  13.  end;
  14.  WindowProc := DefWindowProc(Window, AMessage, WParam, LParam);
  15. end;
  16.  
  17. { Register the Window Class }
  18. function WinRegister: Boolean;
  19. var WC: WndClass;
  20. begin
  21. with WC do begin
  22.  Style := cs_hRedraw or cs_vRedraw;
  23.  lpfnWndProc := WndProc(@WindowProc);
  24.  cbClsExtra := 0;
  25.  cbWndExtra := 0;
  26.  hInstance := system.MainInstance;
  27.  hIcon := LoadIcon(0, idi_Application);
  28.  hCursor := LoadCursor(0, idc_Arrow);
  29.  hbrBackground := GetStockObject(WHITE_BRUSH);
  30.  lpszMenuName := nil;
  31.  lpszClassName := 'CIAO';
  32. end;
  33. Result := RegisterClass(WC) <> 0;
  34. end;
  35.  
  36. { Create the window }
  37. function WinCreate: HWnd;
  38. var hWindow: HWnd;
  39. begin
  40. hWindow:=CreateWindow('CIAO','ciao',ws_OverlappedWindow,cw_UseDefault,cw_UseDefault,
  41.    cw_UseDefault,cw_UseDefault,0,0,system.MainInstance, nil);
  42. if hWindow <> 0 then begin
  43.  ShowWindow(hWindow, CmdShow);
  44.  UpdateWindow(hWindow);
  45. end;
  46. Result := hWindow;
  47. end;
  48.  
  49. var
  50. AMessage: Msg;
  51. hWindow: HWnd;
  52.  
  53. Begin
  54. if not WinRegister then begin
  55.  MessageBox(0, 'registrazione fallita', nil, mb_Ok);
  56.  Exit;
  57. end;
  58. hWindow := WinCreate;
  59. if longint(hWindow) = 0 then begin
  60.  MessageBox(0, 'creazione finestra fallita', nil, mb_Ok);
  61.  Exit;
  62. end;
  63. while GetMessage(@AMessage, 0, 0, 0) do begin
  64.  TranslateMessage(AMessage);
  65.  DispatchMessage(AMessage);
  66. end;
  67. End.


PM Quote
Avatar
Saladino (Member)
Pro


Messaggi: 90
Iscritto: 30/05/2010

Segnala al moderatore
Postato alle 17:03
Martedì, 15/06/2010
No ,se usi owindows no.

PM Quote