Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 436
  • Last Modified:

'RichEdit20W' class is blank

  Load "Outlook Express version 6.0" and open an email.
   There are four items above the email body: "From:", "Date:", "To:", "Subject:".

   Using "Spy++" each of these fields were identified as a 'RichEdit20W' class.

   However, using the API call GetWindowText() only the "Date:" and "Subject:" fields return any information.  The "From:" and "To:" fields are blank.

   Any idea where Outlook Express hides the "From:" and "To:" information?

0
EasyAim
Asked:
EasyAim
  • 7
  • 4
1 Solution
 
Richie_SimonettiIT OperationsCommented:
don't use that API, try with SendMessage API WM_GETTEXT parameter.
0
 
Richie_SimonettiIT OperationsCommented:
if i remember well:

dim buff as string * 255
SendMessage hwnd,WM_GETTEXT,255,byval buff
Buff should contains the captured text
0
 
Richie_SimonettiIT OperationsCommented:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_GETTEXT = &HD

sub test
Dim buff As String * 255
'hwnd is the handle to 'RichEdit20W' window
SendMessage hwnd, WM_GETTEXT, 255, ByVal buff
'Buff should contains the captured text
msgbox Left$(buff, InStr(1, buff, Chr$(0), vbTextCompare) - 1)
end sub
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
EasyAimAuthor Commented:
Good answer but that isn't it either.  I went back through my code and I was already using your suggested "SendMessage(hWnd, WM_GETTEXT, ....)" to no avail.

What's interesting is that using

iNumLines = SendMessage(hWnd, EM_GETLINECOUNT, 0&, 0&)

 I get "1" returned.  But I can't seem to extract the text that shows up in the Outlook Express "From:" field.
0
 
Richie_SimonettiIT OperationsCommented:
OK. As you said, those fields are diffrent from the others:
Use Spy++ and see Style value ;)
Maybe changing the style of that fields we could use those other API.
0
 
EasyAimAuthor Commented:
I'm not sure how "Style" would help.
Here's another hint:  When the "To:" field has multiple email addresses, the only thing that shows up in the 'RichEdit20W' extracted text is a row of semi-colons.  The actual email addresses are missing.
0
 
Richie_SimonettiIT OperationsCommented:
well, not the best approach but:

Option Explicit

Private Const EM_SETSEL = &HB1
Private Const WM_COPY = &H301

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Dim h As Long
Private Sub Form_Click()
Dim ret As Long
SendMessage h, EM_SETSEL, 0&, 0&
SendMessage h, WM_COPY, 0&, 0&
Dim v as boolean
v = Clipboard.Getformat(vbCFText)
if v then
   msgbox Clipboard.GetText(vbCFText)

end if
 
End Sub

Private Sub Form_Load()
h = 460092
End Sub
0
 
EasyAimAuthor Commented:
Richie,
   Another good idea but unfortunately, it didn't work either.   Again, it has very strange behavior in that it shows up as a "RichEdit20W" and it is readable on the form but the 'WM_GETTEXT' command returns nothing and attempts at 'EM_SETSEL' fail also (the SendMessage function is returning a zero).

   Also:  When you go to the "To:" field and select the name there (say "John Doe") and 'Copy' it to the clipboard and then paste it to Notepad it returns  "John Doe  <jdoe@trash.com>"

0
 
Richie_SimonettiIT OperationsCommented:
But i tested and it works! I did the same test as yours and everything works fine. Did you change the hwnd number from my example, didn't you?
I tested with "To:" field from a message.
0
 
EasyAimAuthor Commented:
oops, I stand corrected.... you're right it does work.  My first attempt failed for some reason.   The cut/paste method is clunky but I'm happy to get it any way I can.  I'll continue researching a more graceful method.

Thanks Richie!
0
 
Richie_SimonettiIT OperationsCommented:
Thanks to you.
As i said, "well, not the best approach but:" ...it works.
I got several GPF (in VB and in OE but, strange, not in both at same time :D) before got this way.
If your want continue crashing your pc, check a list of this Riched constants for sendmessage:

http://www.networkdynamics.net/forum/viewtopic.php?TopicID=66
0

Featured Post

Independent Software Vendors: 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!

  • 7
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now