Ver Mensaje Individual
  #7  
Antiguo 03-09-2015
Avatar de escafandra
[escafandra] escafandra is offline
Miembro Premium
 
Registrado: nov 2007
Posts: 2.197
Reputación: 20
escafandra Tiene un aura espectacularescafandra Tiene un aura espectacular
Close no funciona en el evento OnCreate (tampoco lo hace en delphi), si quieres que en él se cierre el formulario debes usar un mensaje:

Código PHP:
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>

#define WM_MYCLOSE WM_USER + 1

//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:    // IDE-managed Components
  
void __fastcall FormCreate(TObject *Sender);
private:    
// User declarations
  
void __fastcall WMForzarClose(TMessage &Msg);
public:        
// User declarations
  
__fastcall TForm1(TComponentOwner);

 
BEGIN_MESSAGE_MAP
   MESSAGE_HANDLER
(WM_MYCLOSE,  TMessageWMForzarClose)
 
END_MESSAGE_MAP(TForm)
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif 
Código PHP:
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponentOwner)
  : 
TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::WMForzarClose(TMessage &Msg)
{
   
Close();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::FormCreate(TObject *Sender)
{
  
PostMessage(HandleWM_MYCLOSE00);
}
//--------------------------------------------------------------------------- 

Saludos.
Responder Con Cita