Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 459
  • Last Modified:

ActiveXForm!!! Cannot focus on a disabled or invisible window ???

hi,all experts

  <font size=5> i made an ActiveXForm to display word document on a web page. it contains an OLE container, everytime i enter my webpage(testXForm.asp) which contain this activexForm by clicking a link on another webpage(default.asp) for the first time,everything is ok! but i return to default.asp,and click this link to enter testXForm.asp again, error occurd: Cannot foucus a disabled or invisible window!  it is not the worst, and then when i clicked close button on the iexplorer's title, this error message box appeared again,and this time, i was not lucky enough, because i have to kill this thread by myself to make sure my OS can run other applications~~ , an unrelease winword.exe is still running ~~
  how could this happen?
  any suggestion would be appreciated~~!!
  thanx in advance!</font>

nickong
0
nickong
Asked:
nickong
1 Solution
 
nickongAuthor Commented:
do u need my souce code posting here??
0
 
mocartsCommented:
check whether your code contains SetFocus method invocation. if so - before calling SetFocus check, whether it is possible, with CanFocus method of control. or use Form's ActiveControl property.

wbr, mo.
0
 
nickongAuthor Commented:
hi,mocarts

my code is here: i call setFocus in ActiveXForm's activate method. can i do so ??

procedure TNMWebWORD.ActiveFormActivate(Sender: TObject);
begin
  if nmg_Ole.Visible=true then
    nmg_Ole.SetFocus;
end;
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
nickongAuthor Commented:
and debug this program using showmessage(), i found such a fact: this procedure TNMWebWORD.ActiveFormActivate(Sender: TObject) was not called~~ why???
0
 
mocartsCommented:
try this way (with CanFocus check).

procedure TNMWebWORD.ActiveFormActivate(Sender: TObject);
begin
 if nmg_Ole.Visible and nmg_Ole.CanFocus then
   nmg_Ole.SetFocus;
end;

it is possible that ShowMessage doesn't work in ActiveX interface.
mo.
0
 
nickongAuthor Commented:
i just try in ur way , and it dosent work~~

of course ShowMessage can work in ActiveX interface , i am using showMessage in my activex interface ~~ and when i open a doc successful , i show a message :"open successful"! it works pretty good~~!
0
 
nickongAuthor Commented:
can anybody help???
0
 
nickongAuthor Commented:
i solve this problem in this way , but it is not what i want~~

i just used javascript to alert a messagebox , before i enter this webpage , then my activeXform get focus automatically, can any experts tell me why ????

thanks
0
 
CleanupPingCommented:
nickong:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
snehanshuCommented:
Hi!
No comment has been added lately and this question is therefore classified abandoned.

If asker wishes to close the question, then refer to
http://www.experts-exchange.com/help/closing.jsp

Otherwise, I will leave a recommendation in the Cleanup topic area that this question is:

PAQ'd and pts refunded

Please leave any comments here within the next seven days. It is assumed that any participant not responding to this request is no longer interested in its final disposition.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

...Snehanshu
EE Cleanup Volunteer
0
 
SpazMODicCommented:
PAQed, with points refunded (78)

SpazMODic
EE Moderator
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now