Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VB6 Outlook banner page

Posted on 2006-07-21
10
Medium Priority
?
327 Views
Last Modified: 2008-02-01
I have a VB6 program that I have written that read the inbox of a profile that i have setup in Outlook.  It is a corporate email system I might mention as well.

Anyway, when I open the Outlook appliclation via the program there is what I would call a banner page of sorts.  It is something that is specific to the corporation that I work for.  Either way, when I close the Outlook application via my program the banner page is still active and will cause a read of memory error.  If by chance I close the pop up banner page during the execution of my program it will not have this problem.  Is there anyway to stop the banner page from opening up or close it via my exe so I don't have the reading of memory error?

There is a ok button that can be clicked to close the banner but how do I go about doing that via the program?

Thanks

0
Comment
Question by:brake4blonds
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
10 Comments
 
LVL 9

Expert Comment

by:Rob_Jeffrey
ID: 17154974
How are you closing the Outlook application via your program?
Are you sending the windows message WM_Close?
0
 

Author Comment

by:brake4blonds
ID: 17156543
When I close the outlook application I do the following:

appNameSpace.Application.Quit
app.Application.Quit
app.Quit

Then I set them to nothing

set appNameSpace = nothing
set app.Application.Quit= nothing
set app = nothing

Then I return back to main() and then I get the error.
0
 
LVL 9

Expert Comment

by:Rob_Jeffrey
ID: 17156796
Can you run a delay of sorts between calling the close and setting to nothing?
Perhaps the close is taking longer?
0
Technology Partners: 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!

 

Author Comment

by:brake4blonds
ID: 17156936
I figured it out.  

There was a set statement where I was release a part of memory that was there anymore anyway so when I tried to set it to nothing it was throwing the error.
0
 

Author Comment

by:brake4blonds
ID: 17156950
Well, I thought that was it...hmmmm...
0
 
LVL 9

Expert Comment

by:Rob_Jeffrey
ID: 17157051
Is your program trying to get the current number of emails?
If it is a pop3 server take a look at this ->http://vbaccelerator.com/codelib/submit/e-checker.zip
(This would mean a re-write of the code - but it works fine)

This method of closing the application is alien to me so I am afraid I am not much help.
0
 

Author Comment

by:brake4blonds
ID: 17168110
It is not a pop3 server but an internal exchange account for the company that I am working for.  

The Outlook application is on the server and my local PC.  

Once the program opens the Outllook in the background (visible=false), it runs fine as far as reading, marking as read, and moving to another subfolder.  It is just when I close the application that I get the memory error.  I am not sure if it is because of the flash banner that is visible or there is something else that is going on.  

If there was a way to surpress the banner page and/or close it before I quit the application I may be able to get around the problem.  This is what I really would like to know how to do more than anything.  I was thinking that I would be able to do this be send keys or something but I am not sure that it would be possible in this particular case.



0
 
LVL 9

Accepted Solution

by:
Rob_Jeffrey earned 1000 total points
ID: 17168291
If you know the hWND of the app you can use:

Delare Function PostMessage& Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any)
Const WM_CLOSE = &H10

res = PostMessage(hwnd, WM_CLOSE, 0&, 0&)

This is the only way I know how to close an application - I've never used remote scripting.
It sounds like you still have an object referencing a closed object - so as soon as it goes out of scope you get a memory leek.
If you don't have the hWND take a look at:
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_21408260.html?query=WM_Close&topics=93
If you know the title of the window.
0
 

Author Comment

by:brake4blonds
ID: 17168855
That worked.  No longer getting the memory area.  This allowed for the flash window to be closed and didn't receive the memory error.

Thanks
0
 
LVL 9

Expert Comment

by:Rob_Jeffrey
ID: 17168901
Awesome!

Glad I could help.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

596 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