Solved

Positiioning cursor from .eml file

Posted on 2004-10-20
4
234 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

Suggested Solutions

Title # Comments Views Activity
Comparing dates in Delphi. Greater than/ Less than 3 368
Dynamically Created Query 3 80
FMX TEdit KeyUp handler detecting  "enter" key 4 63
Broadcast a message using ICS 2 50
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

739 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