Solved

Positiioning cursor from .eml file

Posted on 2004-10-20
4
235 Views
Last Modified: 2010-04-05
I am using FileExec in Delphi with MailTo:'filename.eml' and the .eml file correctly comes into a send message in Outlook Express. Is there code I can add to the .eml file to position the cursor at the end of the body text?  Or something else?
Thanks in advance
0
Comment
Question by:SantMarti
[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
4 Comments
 
LVL 1

Accepted Solution

by:
vacerose earned 250 total points
ID: 12366659
After loading the .eml file, you can enumerate the windows to locate the message window. Then you can send some windows message commands to focus the body and scroll to the bottom. I tested this code using OE 6 and Windows XP Pro.

add these enumeration functions to your app

function EnumChildProc(Handle: HWND; Info: Pointer): BOOL; stdcall;
var
  txt: array [0..255] of char;
  place:WindowPlacement;
  p:array[0..1] of WORD;
begin
  Result := True;
  GetClassName(Handle, txt, sizeof(txt)-1);
  if StrPas(txt)='Internet Explorer_Server' then
  begin
    GetWindowPlacement(Handle, @place);
    //Scroll to the bottom, this works
    PostMessage(Handle, WM_VSCROLL, SB_BOTTOM, 0);
    //focus and position cursor, simulates left mouse click
    p[0]:=0;
    p[1]:=place.rcNormalPosition.Bottom-place.rcNormalPosition.Top-10;
    PostMessage(Handle, WM_LBUTTONDOWN, 0, integer(p));
    PostMessage(Handle, WM_LBUTTONUP, 0, integer(p));
  end;
end;

function EnumWindowsProc(Handle: HWND; Info: Pointer): BOOL; stdcall;
var
  txt: array [0..255] of char;
begin
  Result := True;
  GetClassName(Handle, txt, sizeof(txt)-1);
  if StrPas(txt)='ATH_Note' then
  begin
    Result:=false;
    EnumChildWindows(Handle, @EnumChildProc, 0);    
  end;
end;


call the primary windows enumeration after the .eml has been loaded. it may be necessary to pause the app to give OE time to load...
procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
  EnumWindows(@EnumWindowsProc, 0);
end;
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses
Course of the Month4 days, 5 hours left to enroll

630 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