Trying to revoke a drop target that has not been registered with TWebBrowser.

By: Quinn Wildman

Abstract: How to resolve the error "Trying to revoke a drop target that has not been registered".

TWebBrowser.ExecWB can generate the error "Trying to revoke a drop target that has not been registered" under 2 different conditions:

1. TWebBrowser is not yet ready to accept the command. For following may generate this error:

Navigate('e:\pictures\picture1.jpg');
ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER);

To resolve the problem use QueryStatusWB and wait for it to return OLECMDF_SUPPORTED + OLECMDF_ENABLED. Below is an example that fixes the problem:

Navigate('e:\pictures\picture1.jpg');
while QueryStatusWB( OLECMDID_PRINT) <> OLECMDF_SUPPORTED + OLECMDF_ENABLED do
Forms.Application.ProcessMessages;
ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER);

2. Even though you use QueryStatusWB, Copy and Paste may still fail. Add the following to the end of your unit to resolve the problem:

initialization
OleInitialize(nil);

finalization
OleUninitialize;


Server Response from: ETNASC02