473,383 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Issuing AfxMessageBox

I have some legacy code wrapped in a .NET managed assembly that I'm using
from within an asp web application and all works fine until the legacy code
detects an error during a function call on an object and it tries to issue
an AfxMessageBox: The browser (IE) hangs.

How does one deal with this situation in a web application? I have a
try-catch in the aspx.cs but it never gets to the catch block.

Thanks.

Jon Lea.
Nov 18 '05 #1
2 1438
Hi Jon:

Unfortunately, AfxMessageBox will be the kiss of death in a web
application. The message box will appear on a hidden desktop and wait
for someone to click and close it.

The best solution would be to recompile the legacy code to be server
friendly (no calls to APIs requiring interactive UI). Either this or
porting the legacy code to .NET.

If that's impossible, you might be able to do something by hooking /
intercepting API calls, but it's not something I'd suggest doing until
it is the last option. If you google for keywords like: intercept hook
thunk win32 api, you'll find some research and articles on the
subject, and there are some commercial toolkits to help also.

--
Scott
http://www.OdeToCode.com/

On Thu, 30 Sep 2004 08:39:41 -0700, "jlea" <jo*@leapsoft.com> wrote:
I have some legacy code wrapped in a .NET managed assembly that I'm using
from within an asp web application and all works fine until the legacy code
detects an error during a function call on an object and it tries to issue
an AfxMessageBox: The browser (IE) hangs.

How does one deal with this situation in a web application? I have a
try-catch in the aspx.cs but it never gets to the catch block.

Thanks.

Jon Lea.


Nov 18 '05 #2
Scott - thanks for the good info; I was afraid this might be the case.

I was thinking of percolating a return code up through the legacy code and
then have the client issue an appropriate error message depending on the
application: AfxMesssageBox or text string in a web page since the legacy
code is used for Win32/MFC apps in addition to web apps. This will take time
also but less than re-writing a bunch of code.

Jon.

"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:ub********************************@4ax.com...
Hi Jon:

Unfortunately, AfxMessageBox will be the kiss of death in a web
application. The message box will appear on a hidden desktop and wait
for someone to click and close it.

The best solution would be to recompile the legacy code to be server
friendly (no calls to APIs requiring interactive UI). Either this or
porting the legacy code to .NET.

If that's impossible, you might be able to do something by hooking /
intercepting API calls, but it's not something I'd suggest doing until
it is the last option. If you google for keywords like: intercept hook
thunk win32 api, you'll find some research and articles on the
subject, and there are some commercial toolkits to help also.

--
Scott
http://www.OdeToCode.com/

On Thu, 30 Sep 2004 08:39:41 -0700, "jlea" <jo*@leapsoft.com> wrote:
I have some legacy code wrapped in a .NET managed assembly that I'm using
from within an asp web application and all works fine until the legacy codedetects an error during a function call on an object and it tries to issuean AfxMessageBox: The browser (IE) hangs.

How does one deal with this situation in a web application? I have a
try-catch in the aspx.cs but it never gets to the catch block.

Thanks.

Jon Lea.

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Susan Bricker | last post by:
Greetings. I am running Acc 2k3 on Windows XP. I have the following VB code behind a form in the btnClose_Click event: Dim intAns As Integer If blnDataChanged = True Then intAns =...
3
by: Jigar Mehta | last post by:
Hye, I am Jigar Mehta, currently, I am using AfxMessageBox where I need to change the caption of the messagebox using that function only... What I get is, the project name as the caption. I don't...
3
by: Brian | last post by:
Hi, I want to issue mailto from one of my pages. Basically to drop contact information from a from to the body of the email and have the user enter the desired address to send it to. I thought...
0
by: James Johnson | last post by:
I have a file that I open a FileStream and a StreamReader for. I issue a SEEK and read a series of records. I then issue another SEEK, no errors, but when I issue the read it picks up where the...
6
by: cj | last post by:
I'm tryin to set up a sqlcommand in VB.NET that would issue the command: insert into server1.database.owner.table select * from server2.database.owner.table Since this sqlcommand has it's...
4
by: Randy | last post by:
Hello, I'm trying to find out if it is possible, and if so...how to accomplish issuing a PLSQL command from within C#. The command is... SET SCAN OFF; What is happening is I'm trying to...
1
by: Paid The Umpire | last post by:
Hi, I'm trying to get a basic MDI program working. I create the template through Microsoft Visual Studio 2005, and then before changing any code i run the program. But it doesn't actually run...
3
by: Raqueeb Hassan | last post by:
Hello, Given the idea of having voter ID card for all the citizens of Bangladesh, I was thinking of assessing few things before it actually starts. The election commission, the government agency...
4
by: raccoon | last post by:
keep getting an ora-04020: deadlock detected while trying to lock object XDB. XDNDBKDJjilnd The statement I'm trying to issue is: REVOKE execute on abc."descript_T" FROM PUBLIC; I am not...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.