Component Request Pending

Posted on 1998-11-09
Last Modified: 2008-02-20
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.
Question by:Profund
  • 2
  • 2

Author Comment

ID: 1443945
LVL 13

Accepted Solution

Mirkwood earned 200 total points
ID: 1443946
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
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

Author Comment

ID: 1443947
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?

LVL 13

Expert Comment

ID: 1443948
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.


Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question