Improve company productivity with a Business Account.Sign Up

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

Component Request Pending

I have an ActiveX EXE and and ActiveX Dll and from within the EXE I call a standard form from inside the Dll. This form uses the EXE as the background and the standard form from the Dll is shown in the foreground. At this point if I was to click on the EXE in the background I get an Ole Component Request Pending message that I would like to capture and do away with. The VB help file doesn't seem to give that much information on this topic. Is it even possible?

Thanks for any help you may have.
Matthew
0
Profund
Asked:
Profund
  • 2
  • 2
1 Solution
 
ProfundAuthor Commented:
Thanks
0
 
MirkwoodCommented:
I can tell you what is happening.

An ActiveX exe is a process on its own. It gets its own processor time. When you call an ActiveX exe, the caller has to wait for the answer of the ActiveX exe. This means that the application need to be synchronized. Your calling EXE is not disabled but only waiting. That means that when you click on a form of the calling process (EXE) that windows has to remove this message since your EXE is waiting. At this moment the dialog box comes up.
What can you do to solve it? Not much.
First of all. Don't make the caller wait. With that I mean that the ActiveX exe should return with an answer as quick as possible but this is ofcourse not always possible.
Another solution is to make the ActiveX exe a DLL, which is also not always possible.
The third solution is to make the calls asynchronious. The ActiveX exe receives the call, marks it self as busy (and thereby ignoring all other calls, you have to make sure of that yourself) and return immediatelly. When it is finished it can notify the parent that it is finished. The most easiest way to do it is using a timer. The best way to do it is to start another thread, which is not easy is VB (very difficult).

Here is some psuedo code. This code is controlling the state of the EXE in stead of letting windows do it. Like you have seen with the window. It makes it sometimes a littlebit harder.

---Caller EXE---
sub command1_onClick
     ActiveXExe.DoitAsync
end sub      

sub ActiveXExe_Done
    msgbox "ActiveX EXE is finished"
end sub

---ActiveX EXE---
event Finished
Dim withevents form1timer1 as timer

public Sub DoitAsync
    if (busy) then err.raise -1, "Server is busy"
    busy = true
    form1timer1.enabled = true
end sub

private sub form1timer_tick
    form1timer1.enabled = false
    <Do your stuff here>
    busy = false
    raiseevent Finished
end sub

private sub class_initialize
   load form1
   set form1timer1 = form1.timer1
end sub

private sub class_terminate
   set form1timer1 = nothing
   unload form1
end sub
0
 
ProfundAuthor Commented:
Thanks for the input but I think we are not quite on the same page. I only have an ActiveX EXE which is my caller and the ActiveX Dll is what I am calling. The ActiveX Exe opens a form, in my case an MDI, and then at some later time the user can call a form from within the ActiveX Dll which I make the foreground window through an API call. Now I have the small Dll form in the front and the MDI form from the ActiveX Dll behind it. It is when I click on the MDI that I get this Request Pending message saying a request to the Dll is still waiting. I do not want to end the connection to the Dll, however, until the user closes out the small form. Will your code and use of a timer still work? You also mentioned that making one of my apps a Dll would be a solution. If so, does this change or give you some new ideas?

Thanks
Matthew
0
 
MirkwoodCommented:
Who calls the activeX executable?
If nobody calls your activex executable, change it to a standard exe.
BTW: Microsoft warns for loading forms from another DLL.

You can also make one form the owner or parent of the other form and start the form modal. This way the user will not be able to close the other form until the topmost one is closed.

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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