Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

set EXE on foreground using PID 1

Status
Not open for further replies.

Gerrit Broekhuis

Programmer
Aug 16, 2004
313
1
18
NL
Hi

If I know the PID of another .EXE that's running, how can I bring that .EXE to the foreground to make sure it's visible?

Regards, Gerrit
 
[ignore][/ignore]You can save a single mail even simpler with OLE automation of Outlook.Application. No need to bring a window to top at all. It's up to you to ask a follow up.

The only challenge here is selecting which mail.

Here's a sketch of what to do:

1. Get at the mail items folder:
Code:
#DEFINE olFolderInBox 6
Local loOutlook, loMapiNameSpace, loInbox
loOutlook = CreateObject('Outlook.Application')
loMapiNameSpace = loOutloook.GetNameSpace('MAPI')
loInbox = loMapiNameSpace.GetDefaultFolder(olFolderInbox)
* Now all mail items are in the collection loInbox.Items
* You can spot unread mail items, identify mail items by subject or attachment or whatever criteria you want.
* And a mail item has a SaveAs method, so you can fully automate saving as msg or eml or whatever format you like.
See faq184-3894 for many more useful snippets to get something from Outlook, without half automation by activation of a window and then using Sendkeys or such second best automation tricks. Outlook has an automation server to be able to automate it, so make use of it.

Chriss
 
Thanks, Gerrit and Chriss, I didn't need it yet to find a window by PID, but it's useful to know how it can be done.

Regards,
Manni

 
Hi Chriss,

My application saves the e-mail message into a MySQL database with a table for a lot of message specific fields, like sender, datetime sent, datetime received, subject, txt message, html message, attachments, etc.. Each e-mail is saved for a specific company (or private person) and the .msg file is only kept as a reference, with a link to the file in the database.

Once the e-mail is in my database I have another, larger app, that can search in all fields (including e-mail content), show the e-mail content, attachments, etc.. This works very well and works “easier” than searching in
Exchange Server.

E-mail concerning invoices can be archived for that specific invoice (or order). This is part of creating a good file in case legal steps are required to get an invoice paid.

When the mail is saved like this, the original mail can be deleted from Outlook (or Exchange Server).

Regards, Gerrit
 
That can all still be achieved, Gerrit.

I'm not telling ou to not use your MYSQL Server solution, I'm just telling you that you can fully automate the process to get from Outlook to there. And this doesn't need to bring a window to top.

I think along these lines, Gerrit: Why do you want to bring a window to top? Because that's helping the user 8perhaps you yourself) to act on this window or you use programmatic keyboard/mouse input to control that window. It could be outlook, it could be a mail of outlook, whatever. Perhaps you can use a tool that integrates into outlook as a plugin, I don't care. But with outlook automation you get at mail items too, and their single properties. So you could pull out anthing about the mail item and save it to MySQL yourself.

Chriss
 
Chriss,

The application we talked about is just 5% of en entire application suite built with VFP, PHP and MySQL (plus some third party components). We store everything that is digital or can be digitized in our database and we do that for nearly all business processes from sales, project management, document management, planning, tasks, procurement, stock, quotations, customers, suppliers, etc., etc..

I don’t tbink I would want to run ODBC connections to MySQL withing Outlook. What we do with the data is more than can be programmed in MS Office. It becomes even more problematic if you have to support everything from Office 2007 onward. I don’t even want to think about this…

I will leave this as it is now, as it has been working fine now for years and we have happy customers.

Regards, Gerrit
 
Who talked about ODBC from Outlook? When you have a mail item in VFP you can go from there. I think all I'm saying is misunderstood, so let's simply forget it.

Chriss
 
Hi Chriss,

I know what you mean, and that may be usefull for a single user. When working in a company with many Outlook users working with Exchange Server or Exchange Online (O365) there are other needs that go much further than can be accomplished with Outlook.

I know it's going off topic, but one again I thank you very much for your help. You really made my day1

Regards, Gerrit
 
Gerrit,

you just prove once more your misunderstanding. You said yourself, that you read mails from Outlook and delete them there.
Gerrit Broekhuis said:
I use this to archive e-mails from Outlook into MySQL
Gerrit Broekhuis said:
my project that archives a single e-mail message into a MySQL database and saves the .msg file to disk. The message can then be deleted from Outlook.

You can do exactly that, read a mail and delete it, fully with VFP and without any user interaction and without any visible additional window, by Outlook automation from VFP with VFP code. That's all I'm saying and pointing out.

Chriss
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top