Relocate Send Assistant?
Relocate Send Assistant?
Using MadExcept 4.0.21 with DXE3.
Is it possible to move the Exception Box so it appears in a different spot on the screen, eg, maybe 500 pels higher? The problem is that there is an Outlook Dialog that sometimes pops up, prompting the user to allow automatic sending. Unfortunately, the Exception Box covers this other dialog. I would like to move it.
For example, something like:
Here are some relevant settings.
Many thanks,
sse
Is it possible to move the Exception Box so it appears in a different spot on the screen, eg, maybe 500 pels higher? The problem is that there is an Outlook Dialog that sometimes pops up, prompting the user to allow automatic sending. Unfortunately, the Exception Box covers this other dialog. I would like to move it.
For example, something like:
Here are some relevant settings.
Many thanks,
sse
Re: Relocate Send Assistant?
There's no direct API for that. But maybe the following callback exported by madExcept.pas can help you?
Basically you can register this callback, and then in your "OnExceptBoxCreate" callback you could move the window, or make it non-topmost, using pure win32 APIs (e.g. SetWindowPos()).
Code: Select all
// do you want to be notified when a madExcept exception box was created/destroyed?
var
OnExceptBoxCreate : procedure (exceptBox: HWND; simpleMsgBox: boolean) = nil;
OnExceptBoxDestroy : procedure = nil;
Re: Relocate Send Assistant?
P.S: Or maybe better: You could call RegisterExceptActionHandler(), and then if your handler is called for "sendBugReport", you can in that moment move the exception box? If you want to use this approach, you can use the following API in your ExceptActionHandler to get the window handle of the exception box:
Code: Select all
// get the handle of the madExcept exception box
// returns 0, if the box is not currently visible
function GetExceptBoxHandle : HWND;
Re: Relocate Send Assistant?
Thank you for the prompt reply. Unfortunately, I don't have any experience with your suggestions below.
I am using MadExcept out of the box. Not using the component or MadExcept.pas.
How (where in code) would I call RegisterExceptActionHandler? I see there is a reference to this at http://help.madshi.net/madExceptUnit.ht ... ionHandler I will do some reading. Are there any examples?
I am unsure of what you mean by:
Sorry to be so daft. The more examples the better. I will do the leg work.
I am using MadExcept out of the box. Not using the component or MadExcept.pas.
How (where in code) would I call RegisterExceptActionHandler? I see there is a reference to this at http://help.madshi.net/madExceptUnit.ht ... ionHandler I will do some reading. Are there any examples?
I am unsure of what you mean by:
I don't currently have a handler, and I am unsure of how to go about writing one for this purpose. Could you give me a bit more information on this?and then if your handler is called for "sendBugReport",
Sorry to be so daft. The more examples the better. I will do the leg work.
Re: Relocate Send Assistant?
Something like this (not tested or even test compiled):
Code: Select all
uses ..., madExcept;
procedure YourExceptActionHandler(action: TExceptAction; const exceptIntf: IMEException; var handled: boolean)
begin
if action = eaSendBugReport2 then
// a bug report is about to be sent - assistant already completed
SetTopmost(GetExceptBoxHandle, false);
end;
initialization
RegisterExceptActionHandler(YourExceptActionHandler, stDontSync);
end.
Re: Relocate Send Assistant?
That's great. This is very powerful stuff. Here is the completed code as per your suggestions, maybe it will help someone else.
Many thanks,
sse
Many thanks,
sse
Code: Select all
procedure ShiftExceptionBoxUp(action: TExceptAction; const exceptIntf: IMEException; var handled: boolean);
var
ExceptBoxHandle: THandle;
ExeptBoxRect: TRect;
const
UPWARD_SHIFT = 150;
begin
if action = eaSendBugReport3 then //Note: eaSendBugReport2 triggered after eaSendBugReport3, eg, when user clicks 'Send'
begin
// a bug report is about to be sent - assistant already completed
ExceptBoxHandle := GetExceptBoxHandle;
GetWindowRect(ExceptBoxHandle, ExeptBoxRect);
MoveWindow(ExceptBoxHandle, ExeptBoxRect.Left, ExeptBoxRect.Top - UPWARD_SHIFT, ExeptBoxRect.Width, ExeptBoxRect.Height, True);
// SetTopmost(GetExceptBoxHandle, false);
end;
end;
initialization
RegisterExceptActionHandler(ShiftExceptionBoxUp, stDontSync);
end.