Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Positiioning cursor from .eml file

Posted on 2004-10-20
4
Medium Priority
?
238 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
4 Comments
 
LVL 1

Accepted Solution

by:
vacerose earned 1000 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

Industry Leaders: 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!

Question has a verified solution.

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

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Screencast - Getting to Know the Pipeline
Suggested Courses

971 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