System error code 1400 delphi

system error code 1400 delphi

exception message: System Error. Code: 1400. Invalid window handle. main thread ($b290): 0045762c +07c DLL_Testbed_TP_debug_no_monitor.exe. 在使用SocketConnection时出现 System error code:1400无效窗口句柄,调试ScktSrvr.exe & http://www.goodpm.net//DelphiNetwork/html/delphi_200412071242546756.html. System Error. Code 1400. Invalid window handle. I'm running D2007 with fast report 4_11. If I don't open the form with the fast report. system error code 1400 delphi

System error code 1400 delphi - interesting phrase

EDB_ERROR_VALIDATE (100)There is an error in the metadata for the <ObjectType> <ObjectName> (<ErrorMessage>)This error is raised whenever an attempt is made to create a new catalog or configuration object, and there is an error in the specification of the object. The specific error message is indicated within the parentheses.EDB_ERROR_UPDATE (101)There was an error updating the <ObjectType> <ObjectName> (<ErrorMessage>)This error is raised whenever ElevateDB encounters an issue while trying to update the disk file used to store a catalog or configuration. The specific error message is indicated within the parentheses.EDB_ERROR_SYSTEM (200)This operation cannot be performed on the system <ObjectType> <ObjectName> or any privileges granted to itThis error is raised whenever an attempt is made to alter or drop any system-defined catalog or configuration objects. Please see the System Information topic for more information on the system-defined objects in ElevateDB.EDB_ERROR_DEPENDENCY (201)The <ObjectType> <ObjectName> cannot be dropped or moved because it is still referenced by the <ObjectType> <ObjectName>This error is raised whenever an attempt is made to drop any catalog or configuration object, and that catalog or configuration object is still being referenced by another catalog or configuration object. You must first remove the reference to the object that you wish to drop before you can drop the referenced object.EDB_ERROR_MODULE (202)An error occurred with the module <ModuleName> (<ErrorMessage>)This error is raised whenever ElevateDB encounters an issue with loading an external module. Please see the External Modules topic for more information.EDB_ERROR_LOCK (300)Cannot lock <ObjectType> <ObjectName> for <AccessType> accessThis error is raised whenever ElevateDB cannot obtain the desired lock access to a given object. This is usually due to another session already having an incompatible lock on the object already. Please see the Locking topic for more information.EDB_ERROR_UNLOCK (301)Cannot unlock <ObjectType> <ObjectName> for <AccessType> accessThis error is raised whenever ElevateDB cannot unlock a given object. If this error occurs during normal operation of ElevateDB, please contact Elevate Software for further instructions on how to correct the issue.EDB_ERROR_EXISTS (400)The <ObjectType> <ObjectName> already existsThis error is raised whenever an attempt is made to create a new catalog or configuration object, and a catalog or configuration object already exists with that name.EDB_ERROR_NOTFOUND (401)The <ObjectType> <ObjectName> does not existThis error is raised when an attempt is made to open/execute, alter, or drop a catalog or configuration object that does not exist.EDB_ERROR_NOTOPEN (402)The database <DatabaseName> must be open in order to perform this operation (<OperationName>)This error is raised when an attempt is made to perform an operation on a given database before it has been opened.EDB_ERROR_READONLY (403)The <ObjectType> <ObjectName> is read-only and this operation cannot be performed (<OperationName>)This error is raised whenever a create, alter, or drop operation is attempted on an object that is read-only.EDB_ERROR_TRANS (404)Transaction error (This operation cannot be performed while the database <DatabaseName> has an active transaction (<OperationName>))This error is raised whenever ElevateDB encounters an invalid transaction operation. Some SQL statements cannot be executed within a transaction. For a list of transaction-compatible statements, please see the Transactions topic.EDB_ERROR_MAXIMUM (405)The maximum number of <ObjectType>s has been reached (<MaximumObjectsAllowed>)This error is raised when an attempt is made to create a new catalog or configuration object and doing so would exceed the maximum allowable number of objects. Please see the Appendix B - System Capacities topic for more information.EDB_ERROR_IDENTIFIER (406)Invalid <ObjectType> identifier '<ObjectName>'This error is raised when an attempt is made to create a new catalog or configuration object with an invalid name. Please see the Identifiers topic for more information on what constitutes a valid identifier.EDB_ERROR_FULL (407)The table <TableName> is full (<FileName>)This error occurs when a given table contains the maximum number of rows or the maximum file size is reached for one of the files that make up the table. The file name is indicated within the parentheses.EDB_ERROR_CONFIG (409)There is an error in the configuration (<ErrorMessage>)This error is raised whenever there is an error in the configuration. The specific error message is indicated within the parentheses.EDB_ERROR_NOLOGIN (500)A user must be logged in in order to perform this operation (<OperationName>)This error is raised whenever an attempt is made to perform an operation for a session that has not been logged in yet with a valid user name and password.EDB_ERROR_LOGIN (501)Login failed (<ErrorMessage>)This error is raised whenever a user login fails. ElevateDB allows for a maximum of 3 login attempts before raising a login exception.EDB_ERROR_ADMIN (502)Administrator privileges are required to perform this operation (<Operation>)This error is raised when an attempt is made to perform an operation that requires administrator privileges. Administrator privileges are granted to a given user by granting the system-defined "Administrators" role to that user.

Please see the User Security topic for more information.EDB_ERROR_PRIVILEGE (503)The current user does not have the proper privileges to perform this operation (<OperationName>)This error is raised when a user attempts an operation when he/she does not have the proper privileges required to execute the operation. Please see the User Security topic for more information.EDB_ERROR_MAXSESSIONS (504)Maximum number of concurrent sessions reached for the configuration <ConfigurationName>This error is raised when the maximum number of licensed sessions for a given configuration is exceeded. The number of licensed sessions for a given configuration depends upon the ElevateDB product purchased along with the particular compilation of the application made by the developer using the ElevateDB product.EDB_ERROR_SERVER (505)The ElevateDB Server cannot be started (<ErrorMessage>) The ElevateDB Server cannot be stopped (<ErrorMessage>)This error is raised when the ElevateDB Server cannot be started or stopped for any reason. Normally, the error message will contain a native operating system error message that will reveal the reason for the issue.EDB_ERROR_FILEMANAGER (600)File manager error (<ErrorMessage>)This error is raised whenever ElevateDB encounters a file manager error while trying to create, open, close, delete, or rename a file. The specific error message, including operating system error code (if available), is indicated within the parentheses.EDB_ERROR_CORRUPT (601)The table <TableName> is corrupt (<ErrorMessage>)This error is raised when ElevateDB encounters an issue while reading, writing, or validating a table. If this error occurs during normal operation of ElevateDB, please contact Elevate Software for further instructions on how to correct the issue. The specific error message is indicated within the parentheses.EDB_ERROR_COMPILE (700)An error was found in the <ObjectType> at line <Line> and column <Column> (<ErrorMessage>)This error is raised whenever an error is encountered while compiling an SQL expression, statement, or routine. The specific error message is indicated within the parentheses.EDB_ERROR_BINDING (800)A row binding error occurredThis error is raised when ElevateDB encounters an issue while trying to bind the cursor row values in a cursor row. It is an internal error and will not occur unless there is a bug in ElevateDB.EDB_ERROR_STATEMENT (900)An error occurred with the statement <StatementName> (<ErrorMessage>)This error is raised whenever an issue is encountered while executing a statement. The specific error message is indicated within the parentheses.EDB_ERROR_PROCEDURE (901)An error occurred with the procedure <ProcedureName> (<ErrorMessage>)This error is raised whenever an issue is encountered while executing a procedure. The specific error message is indicated within the parentheses.EDB_ERROR_VIEW (902)An error occurred with the view <ViewName> (<ErrorMessage>)This error is raised whenever an issue is encountered while opening a view. The specific error message is indicated within the parentheses.EDB_ERROR_JOB (903)An error occurred with the job <JobName> (<ErrorMessage>)This error is raised whenever an issue is encountered while running a job. The specific error message is indicated within the parentheses.EDB_ERROR_IMPORT (904)Error importing the file <FileName> into the table <TableName> (<ErrorMessage>)This error is raised when an error occurs during the import process for a given table. The specific error message is indicated within the parentheses.EDB_ERROR_EXPORT (905)Error exporting the table <TableName> to the file <FileName> (<ErrorMessage>)This error is raised when an error occurs during the export process for a given table. The specific error message is indicated within the parentheses.EDB_ERROR_CURSOR (1000)An error occurred with the cursor <CursorName> (<ErrorMessage>)This error is raised whenever an issue is encountered while operating on a cursor. The specific error message is indicated within the parentheses.EDB_ERROR_FILTER (1001)A filter error occurred (<ErrorMessage>)This error is raised whenever ElevateDB encounters an issue while trying to set or clear a filter on a given cursor. The specific error message is indicated within the parentheses.EDB_ERROR_LOCATE (1002)A locate error occurred (<ErrorMessage>)This error is raised whenever ElevateDB encounters an issue while trying to locate a row in a given cursor. The specific error message is indicated within the parentheses.EDB_ERROR_STREAM (1003)An error occurred in the cursor stream (<ErrorMessage>)This error is raised whenever an issue is encountered while loading or saving a cursor to or from a stream. The specific error message is indicated within the parentheses.EDB_ERROR_CONSTRAINT (1004)The constraint <ConstrainName> has been violated (<ErrorMessage>)This error is raised when a constraint that has been defined for a table is violated. This includes primary key, unique key, foreign key, and check constraints. The specific error message is indicated within the parentheses.EDB_ERROR_LOCKROW (1005)Cannot lock the row in the table <TableName>This error is raised when a request is made to lock a given row and the request fails because another session has the row already locked. Please see the Locking topic for more information.EDB_ERROR_UNLOCKROW (1006)Cannot unlock the row in the table <TableName>This error is raised whenever ElevateDB cannot unlock a specific row because the row had not been previously locked, or had been locked and the lock has since been cleared. Please see the Locking topic for more information.EDB_ERROR_ROWDELETED (1007)The row has been deleted since last cached for the table <TableName>This error is raised whenever an attempt is made to update or delete a row, and the row no longer exists because it has been deleted by another session. Please see the Updating Rows topic for more information.EDB_ERROR_ROWMODIFIED (1008)The row has been modified since last cached for the table <TableName>This error is raised whenever an attempt is made to update or delete a row, and the row has been updated by another session since the last time it was cached by the current session. Please see the Updating Rows topic for more information.EDB_ERROR_CONSTRAINED (1009)The cursor is constrained and this row violates the current cursor constraint condition(s)This error is raised when an attempt is made to insert a new row into a constrained cursor that violates the filter constraints defined for the cursor. Both views defined in database catalogs and the result sets of dynamic queries can be defined as constrained, and the filter constraints in both cases are the WHERE conditions defined for the underlying SELECT query that the view or dynamic query is based upon.EDB_ERROR_ROWVISIBILITY (1010)The row is no longer visible in the table <TableName>This error is raised whenever an attempt is made to update or delete a row within the context of a cursor with an active filter or range condition, and the row has been updated by another session since the last time it was cached by the current session, thus causing it to fall out of the scope of the cursor's active filter or range condition. Please see the Updating Rows topic for more information.EDB_ERROR_VALUE (1011)An error occurred with the <ObjectType> <ObjectName> (<ErrorMessage>)This error is raised whenever an attempt is made to store a value in a column, parameter, or variable and the value is invalid because it is out of range or would be truncated. The specific error message is indicated within the parentheses.EDB_ERROR_ROWCORRUPTED (1012)The row has been corrupted since last cached for the table <TableName>This error is raised whenever an attempt is made to update or delete a row, and the row buffer being used for the operation has been corrupted. This is typically due to improper multi-threaded access to the ElevateDB client engine.EDB_ERROR_CLIENTCONN (1100)A connection to the server at <ServerAddress> cannot be established (<ErrorMessage>)This error is raised when ElevateDB encounters an issue while trying to connect to a remote ElevateDB Server. The error message will indicate the reason why the connection cannot be completed.EDB_ERROR_CLIENTLOST (1101)A connection to the server at <ServerAddress> has been lost <ErrorMessage>)This error is raised when ElevateDB encounters an issue while connected to a remote ElevateDB Server. The error message will indicate the reason why the connection was lost.EDB_ERROR_INVREQUEST (1103)An invalid or unknown request was sent to the serverThis error is raised when an ElevateDB Server encounters an unknown request from a client session.EDB_ERROR_ADDRBLOCK (1104)The IP address <IPAddress> is blockedThis error is raised when a session tries to connect to an ElevateDB Server, and the originating IP address for the session matches one of the configured blocked IP addresses in the ElevateDB Server, or does not match one of the configured authorized IP addresses in the ElevateDB Server.EDB_ERROR_ENCRYPTREQ (1105)An encrypted connection is requiredThis error is raised when a non-encrypted session tries to connect to an ElevateDB Server that has been configured to only accept encrypted session connections.EDB_ERROR_SESSIONNOTFOUND (1107)The session ID <SessionID> is no longer present on the serverThis error is raised whenever a remote session attempts to reconnect to a session that has already been designated as a dead session and removed by the ElevateDB Server. This can occur when a session is inactive for a long period of time, or when the ElevateDB Server has been stopped and then restarted.EDB_ERROR_SESSIONCURRENT (1108)The current session ID <SessionID> cannot be disconnected or removedThis error is raised whenever a remote session attempts to disconnect or remove itself.EDB_ERROR_COMPRESS (1200)An error occurred while compressing data (<ErrorMessage>)This error is raised when ElevateDB encounters an issue while attempting to compress data. It is an internal error and will not occur unless there is a bug in ElevateDB. The specific error message is indicated within the parentheses.EDB_ERROR_DECOMPRESS (1201)An error occurred while uncompressing data (<ErrorMessage>)This error is raised when ElevateDB encounters an issue while attempting to decompress data. It is an internal error and will not occur unless there is a bug in ElevateDB. The specific error message is indicated within the parentheses.EDB_ERROR_BACKUP (1300)Error backing up the database <DatabaseName> (<ErrorMessage>)This error is raised when any error occurs during the backing up of a database. The specific error message is indicated within the parentheses.EDB_ERROR_RESTORE (1301)Error restoring the database <DatabaseName> (<ErrorMessage>)This error is raised when any error occurs during the restore of a database. The specific error message is indicated within the parentheses.EDB_ERROR_PUBLISH (1302)Error backing up the database <DatabaseName> (<ErrorMessage>)This error is raised when any error occurs during the backing up of a database. The specific error message is indicated within the parentheses.EDB_ERROR_UNPUBLISH (1303)Error unpublishing the database <DatabaseName> (<ErrorMessage>)This error is raised when any error occurs during the unpublishing of a database. The specific error message is indicated within the parentheses.EDB_ERROR_SAVEUPDATES (1304)Error saving updates for the database <DatabaseName> (<ErrorMessage>)This error is raised when any error occurs during the saving of the updates for a database. The specific error message is indicated within the parentheses.EDB_ERROR_LOADUPDATES (1305)Error loading updates for the database <DatabaseName> (<ErrorMessage>)This error is raised when any error occurs during the loading of the updates for a database. The specific error message is indicated within the parentheses.EDB_ERROR_STORE (1306)Error with the store <StoreName> (<ErrorMessage>)This error is raised when any error occurs while trying to access a store, such as a read or write error while working with files in the store. The specific error message is indicated within the parentheses.EDB_ERROR_CACHEUPDATES (1307)Error caching updates for the cursor <CursorName> (<ErrorMessage>)This error is raised when any error occurs during the caching of updates for a specific table, view, or query cursor. The specific error message is indicated within the parentheses.EDB_ERROR_FORMAT (1400)Error in the format string <FormatString> (<ErrorMessage>)This error is raised when ElevateDB encounters an issue with a format string used in a date, time, or timestamp format used in a table import or export. The specific error message is indicated within the parentheses.

I understand how it feels when you receive an error while trying to perform backup. I will be happy to help you with this issue.

Let’s try the following troubleshooting steps; I am sure this will help you resolve the issue.

Step 1: System File Checker (SFC)

SFC tool scans system files and replaces incorrect versions of the system files by using the correct versions.

To run the System File Checker tool, follow these steps:

a)Click Start, and then type cmd in the Start Search box.

b)Right-click cmd in the Programs list, and then click Run as administrator.

If you are prompted for an administrator password or confirmation, type your password or click Continue

c)At the command prompt, the following line, and then press ENTER:

sfc /scannow

How to use the System File Checker tool to troubleshoot missing or corrupted system files on Windows Vista or on Windows 7?

http://support.microsoft.com/kb/929833

 

Step 2: I would suggest you to keep the computer in clean boot mode and try performing the backup then check if the issue persists.

A clean boot helps to verify if any third party application services or startup item is causing this issue.
You may refer the following KB article to set the computer in clean boot:
http://support.microsoft.com/kb/929135
Note: After the trouble shooting steps, refer to Step 3 from clean boot link to set the computer back to normal start up mode.

 

I hope it helps. If you have any issues in future please let us know. We will be happy to help you.

Handling Errors (FireDAC)

Go Up to Working with Connections (FireDAC)


This topic describes how to handle database errors with FireDAC.

General

The EFDDBEngineException class is the base class for all DBMS exceptions. A single exception object is a collection of database errors, accessible through the EFDDBEngineException.Errors[] property and represented by the TFDDBError class.

FireDAC combines "personalization" and unification of the EFDDBEngineException exception and of the TFDDBError error classes. "Personalization" means that a driver can have its own exception and error classes, which contain information specific to the DBMS:

TFDDBError has an ErrorCode property, which is the native DBMS error code.

"Unification" means that all driver exception classes are inherited from the EFDDBEngineException - a single base class that contains driver independent information. Its Kind property is a DBMS independent error code. For example, the code for handling a unique key violation may be as follows:

tryFDQuery1.ExecSQL('insert into MyTab(code, name) values (:code, :name)',[100,'Tokyo']);exceptonE:EFDDBEngineExceptiondobeginifE.Kind=ekUKViolatedthenShowMessage('Please enter unique value !');raise;end;end;

Error Information

The error information is mainly present by the EFDDBEngineException properties:

  • Errors -- the collection of the TFDDBError objects.
  • ErrorCount -- the number of errors in the Errors collection.
  • Kind -- the DBMS independent error kind.
  • Message -- the actual error message.

And by the TFDDBError properties:

  • ErrorCode -- the DBMS vendor specific error code.
  • Kind -- the DBMS independent error kind.
  • Message -- the error message.

To simplify the application debugging or to make exception logging more informative, the EFDDBEngineException provides the SQL and Params properties.

Also, depending on the error area and the DBMS ability to provide the advanced error information, the following TFDDBError properties are useful:

  • When a SQL parsing error is involved, then CommandTextOffset returns the offset in the SQL command text.
  • When a constraint violation, a DB object alteration failure, or some other errors are involved, then the ObjName property returns a database object name.
  • When an Array DML error is involved, then RowIndex returns the array row index, to which the error belongs.

Handling Exceptions

Exceptions can be processed in one of the following ways:

  • using the try/except/end construction. This is a standard Delphi way to handle exceptions. For example:
FDConnection1.StartsTransaction;tryFDQuery1.ExecSQL;FDConnection1.Commit;exceptonE:EFDDBEngineExceptiondobeginFDConnection1.Rollback;// do something hereraise;end;end;
procedureTForm1.FDConnection1Error(ASender:TObject;constAInitiator:IFDStanObject;varAException:Exception);varoExc:EFDDBEngineException;beginifAExceptionisEFDDBEngineExceptionthenbeginoExc:=EFDDBEngineException(AException);ifoExc.Kind=ekRecordLockedthenoExc.Message:='Please, try the operation later. At moment, the record is busy'elseif(oExc.Kind=ekUKViolated)andSameText(oExc[0].ObjName,'UniqueKey_Orders')thenoExc.Message:='Please, provide the unique order information. It seems, your order was already put';end;end;FDConnection1.OnError:=FDConnection1Error;

Using End User Error Dialog

With the help of the TFDGUIxErrorDialog component, an end user can be notified about errors returned by the database:

FireDACErrorPicture.png

To use the dialog, just drop the component somewhere on a form. The dialog hooks the TApplication.OnException event handler and pops up the dialog, when there is an unhandled FireDAC exception. The "Query" page allows you to see the SQL command text produced by the exception. Pressing Ctrl+C in the dialog puts the complete exception information into clipboard.

See Also

Possible causes of "EOSError 1400 - Invalid window handle"

I had the same problem, error code 5 . This turned out to related to a thread started to test an internet connection on an embedded panel (using ). If the user exits the form (which is testing the internet connection) immediately after displaying the form, the AV occurs.

On my development PC, the internet connection test was successful...and so fast I never saw the problem! After struggling for several hours, I finally tracked it down to this thread and reproduced it by disconnecting my network cable.

The solution was straightforward: When exiting the form (eg. in the event) ensure the thread is definitely not running before continuing.

AlainD Avatar answered Mar 14 '21 12:03

AlainD


Credits

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: StackOverflow


System Error. Code: 1400. Invalid window handle

jhansen31's profile imagejhansen31 posted 5 years ago in GeneralPermalink
  1. Upgraded to 9.5.0.5204
  2. Move a few columns around on a MariaDB database on a Synology NAS
  3. When done with editing data simply closed app by clicking on the X upper right hand corner
  4. At this point the app presented a crash dialog with ability to save enclosed report.
jhansen31's profile imagejhansen31 posted 5 years agoPermalink

Will post in Bugtracker where it should go

Please login to leave a reply, or register at first.

System Error. Code: 1400. Invalid window handle

jhansen31's profile imagejhansen31 posted 5 years ago in GeneralPermalink
  1. Upgraded to 9.5.0.5204
  2. Move a few columns around on a MariaDB database on a Synology NAS
  3. When error doctor 2007 37 with editing data simply closed app by clicking on the X upper right hand corner
  4. At this point the app presented a crash dialog with ability to save enclosed report.
jhansen31's profile imagejhansen31 posted 5 years agoPermalink

Will post in Bugtracker where it should go

Please login to leave a reply, or register at first.

Possible causes of "EOSError 1400 - Invalid window handle"

I had the same problem, error code 5system error code 1400 delphi. This turned out to related to a thread started to test an internet connection on an embedded panel (using ). If the user exits the form (which is testing the internet connection) immediately after displaying the form, the AV occurs.

On my development PC, the internet connection test was successful.and so fast I never saw the problem! After struggling for several hours, I finally tracked it down to this thread and reproduced it by disconnecting my network cable.

The solution was straightforward: When exiting the form (eg. in the event) ensure the thread is definitely not running before continuing.

AlainD Avatar answered Mar 14 '21 12:03

AlainD


Credits

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: StackOverflow


Board index » delphi » System Error. Code:1400

hi ppl,
        I am learing abt multithreading and i came across an example. when i
run it in debug mode, it comes up with an error." System Error. Code:1400.
Invalid Window Handle". It works fine if i put a break point on the click
event system error code 1400 delphi the TButton and then step through it using F7/F8. but it doesnt
work otherwise. Here's the code. Could someone help me out? I tried to find
out the answer on system error code 1400 delphi newsgroups, but couldnt find an answer, system error code 1400 delphi. Any help
will be appreciated. I am using Delphi 6 UP2.

=====================Source of the Form================
unit PrimeForm;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TPrimeFrm = class(TForm)
    NumEdit: TEdit;
    SpawnButton: TButton;
    procedure SpawnButtonClick(Sender: TObject);
  private
      { Private declarations }
  public
      { Public declarations }
  end;

var
  PrimeFrm: TPrimeFrm;

implementation

uses PrimeThread;

{$R *.DFM}

procedure TPrimeFrm.SpawnButtonClick(Sender: TObject);

var
  NewThread: TPrimeThrd;

begin
  NewThread := TPrimeThrd.Create(True);
  NewThread.FreeOnTerminate := True;
  try
    NewThread.TestNumber := StrToInt(NumEdit.Text);
    NewThread.Resume;
  except on EConvertError do
    begin
      NewThread.Free;
      ShowMessage('That is not a valid number!');
    end;
  end;
end;

end.
=====================Source of the Thread================
unit PrimeThread;

interface

uses
  Classes; error when compiling generated c code powerbuilder
  TPrimeThrd = class(TThread)
  private
    FTestNumber: integer;
  protected
    function IsPrime: boolean;
    procedure Execute; override;
  public
    property TestNumber: integer write FTestNumber;
  end;

implementation

uses SysUtils, Dialogs;

function TPrimeThrd.IsPrime: boolean;

var
  iter: integer;

begin
  result := true;
  if FTestNumber < 0 then
  begin
    result := false;
    exit;
  end;
  if FTestNumber <= 2 then
    exit;
  for iter := 2 to FTestNumber - 1 do
  begin
    if (FTestNumber mod iter) = 0 then
    begin
      result := false;
      exit;
    end;
  end;
end;

procedure TPrimeThrd.Execute;
begin
  if IsPrime then
    ShowMessage(IntToStr(FTestNumber) + 'is prime.')
  else
    ShowMessage(IntToStr(FTestNumber) + 'is not prime.');
end;

end.
---TIA ,Mounil, system error code 1400 delphi.

 

Closing Excel : System Error. Code: 1400. Invalid window handle.

system error code 1400 delphi samhow





Posts: 28
Joined: 2009-03-10
Hi,

I am getting this error when I close Excel :

Exception EOSError in model MyDLL.DLL at 00011791.
System Error. Code: 1400. Invalid window handle.

It doesn't happen every time I close excel, I haven't worked out what
I need to do to trigger the error, so debugging it is not easy for me.

I have a TadxExcelTaskPane, and from buttons on the pane a couple of Modal TForms can be launched. The modal forms are created in a try finally block, so they are definately freed. At the moment I think they are not causing the problem.

Since the errors occurs when I exit excel I suspect something in on destroy events.

I don't have a TadxExcelTaskPane onDestroy method.

My TAddInModule does have a finalise method :

procedure TAddInModule.adxCOMAddInModuleAddInFinalize(Sender: TObject);
begin
adxcoSSheet := nil;
end;

Any suggestions on how to get rid of this error are appreciated.

Cheers
Sam H






Posted12 Apr, 2009 11:48:50Top

system error code 1400 delphi Andrei Smolin



Add-in Express team


Posts: 18302
Joined: 2006-05-11
Hello Sam,

Can you send me your project (or any other project reproducing the same behavior) to the support e-mail address (see readme.txt)?

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted13 Apr, 2009 10:30:38Top

Andrei Smolin



Add-in Express team


Posts: 18302
Joined: 2006-05-11
Hello Sam,

Yes, the project is too big and it isn't compilable, system error code 1400 delphi. The only thing I managed to find is an item added to the TaskPanes collection of the add-in module. Try removing it, system error code 1400 delphi. If this doesn't help to solve the problem, system error code 1400 delphi, I'd need to have a shortened edition of your project (if it is possible).

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted14 G_vfs_done read error = 5, 2009 09:52:09Top

samhow





Posts: 28
Joined: 2009-03-10
Hi,

I believe I have solved this problem and it was unrelated to Add-In-Express.

A component was trying to free something that had already been freed.

My apologies for taking your time.

Cheers
Sam H
Posted19 Apr, 2009 07:28:18Top

Andrei Smolin



Add-in Express team


Posts: 18302
Joined: 2006-05-11
Thank you for letting us know.

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted20 Apr, 2009 05:45:38Top

Delphi and threads: "System Error. Code: 1400. Invalid window handle"

You have posted a lot of code but not the key, relevant part. Specifically the implementation of your event handler/method (unless it literally only calls that log method that you posted).

This method is being executed in the context of the TMySynHTTPAsync thread and based on the behaviour you are describing - particularly the fact that resolves your problem - it is highly likely that some activity in that event handler is creating a window handle.

That window handle is then owned by the HTTP Async thread, not the main application thread (sometimes referred to as the "VCL thread") that is otherwise running your application. When your application closes, the VCL thread performs some final housekeeping, destroying objects and windows etc. if one of system error code 1400 delphi windows was created by some other thread this will cause problems.

Window handles are the strict property of the thread in which they were created. You cannot create a window handle in one thread and then destroy it in another.

NOTE:This is a fundamental of Windows, not Delphi.

Worth noting here is that window handles in VCL can often be created indirectly. You won't necessarily see an explicit creation of a control that marks the creation of the underlying window handle. It is quite common for window handles only to be actually created when required. Similarly changing the properties of a control can trigger the VCL to attempt to recreate the window for that control, destroying the current one in the process.

It should be fairly apparent that these mechanisms are highly vulnerable to problems that can arise when VCL methods are called by threads other than the VCL thread. This is why you will often here it said that "the VCL is not thread-safe".

The safest way to operate is to only manipulate VCL objects from code running in the VCL thread itself.

Synchronize to the Rescue

This is in fact precisely why exists.

The mechanism that you are invoking by using actually works to ensure that the method you are Synchronizing is execute on the VCL thread. If this is in fact creating a window handle then when the VCL thread later comes to destroy that window handle it is quite free to do run-time error 1059 since it did in fact create it.

Hence your problem is solved.

Other Options

The mechanism is quite complex however, dealing (these days) with cross platform concerns among other things, system error code 1400 delphi, and as a result may be overkill in this case.

If your code is specific to Windows, a possible alternate solution to this problem may be to exploit the fact that windows allows threads to send (or post) messages to windows in other threads. When those messages are received by those windows, they are then processed by that window's own thread just as all other messages to those windows are. i.e. you cannot end up interrupting a "click" message received by that window by suddenly jumping across to run the notification from system error code 1400 delphi thread. That notification message simply has to wait it's turn while the window finishes processing that click message. For example.

You can think of this as a 'Synchronize' system "built-in" in to the OS.

So you could, for example, pass a window handle to a form (or control or anything with a window handle) to your HTTP async thread during initialisation, identifying a VCL window that wishes to receive the "request complete" or other notifications from the thread, system error code 1400 delphi. The thread can then send notifications to that window handle using or which you could handle either by overriding the WindowProc on the form or using a declared message handler.

If the thread uses to system error code 1400 delphi the notification, then it is automatically suspended and forced to wait until the message is received and processed by the window (in the VCL thread).

If the thread uses then the message is sent asynchronously and the thread can continue with other work without having to wait. The VCL thread will eventually pick up the message and process it.

NOT a Recommendation

This is not to say that I would recommend this alternative in this case. Although it does seem that it might be appropriate given that it does appear to be a simple "work is complete" notification in this case, without a more comprehensive understanding of your specific needs it is impossible to say which is most appropriate.

I mention it only to highlight the fact that alternatives do exist and that the key to safe, system error code 1400 delphi, reliable threading is to understand the principles and the mechanisms involved.

answered Apr 27, 2016 at 0:17

user avatar
DelticsDeltics

21.3k22 gold badges4141 silver badges7070 bronze badges

Contact US

INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Thanks. We have received your request and will respond promptly.

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!

  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Us!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Tek-Tips Posting Policies

Contact US

System Error. Code: 1400. Invalid Windows Handle

System Error. Code: 1400. Invalid Windows Handle

tjcusick(Programmer)

(OP)

In our program we seem to be having an issue where after a series of opening windows we have a report preview screen and when you place your mouse cursor over the buttons you are to get the hint pop up.  The problem is that it's system error code 1400 delphi us a "System Error. Code: 1400.  Invalid Windows Handle" message box.

Any Ideas or Suggestions?

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

0 Comments

Leave a Comment