PocketPC html selected text

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
I have an html viewer control (from opennetcf.org) in my app on pocketpc. My problem is that i cannot get hold of the text that has been selected by a user. I can use the DTM_ISSELECTION message to determine whether or not there is any text selected, but then can not get hold of said text. I have tried using DTM_COPYSELECTIONTONEWISTREAM message (in EVC dll as cannot work out how to marshall istream), but to no avail. Have also tried sending simple copy WM_COMMAND with no success. There must be a way to do this, but how??
Any help would be appreciated
Adam
 
Hello Adam,

Based on my understanding, now the question is: How to get the selected
text in HTML viewer control, right?

There is seldom info on DTM_COPYSELECTIONTONEWISTREAM currently. I find one
google link which demonstrates a way to achieve it. Please refer to this
link:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=c5fea3ba
.0210140345.2abe53ff%40posting.google.com&rnum=4&prev=/groups%3Fhl%3Den%26lr
%3D%26ie%3DUTF-8%26oe%3DUTF-8%26q%3DDTM_COPYSELECTIONTONEWISTREAM%26sa%3DN%2
6tab%3Dwg

From: POCEH ([email protected])
Subject: copy selected text from PIE & HtmlView
Newsgroups: microsoft.public.win32.programmer.wince
Date: 2002-10-14 04:45:24 PST

The author posted sample code there. Please test the code to see whether it
works for you or not.

Also, I noticed that you mentioned html view control from opennetcf.org. Do
you mean the control at http://www.intelliprog.com/netcf/htmlctl.html? I
only searched that in opennetcf.org. If so, I suggest you also send the
question as http://www.intelliprog.com/support/index.html mentioned. :)

Thanks very much.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

This response contains a reference to a third-party World Wide Web site.
Microsoft is providing this information as a convenience to you. Microsoft
does not control these sites and has not tested any software or information
found on these sites; therefore, Microsoft cannot make any representations
regarding the quality, safety, or suitability of any software or
information found there. There are inherent dangers in the use of any
software found on the Internet, and Microsoft cautions you to make sure
that you completely understand the risk before retrieving any software from
the Internet.
 
Hello Adam,

Is the problem resolved? If there is anything unclear, please feel free to
post here. Thanks very much.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Windows Mobile 5 Select to the Clipboard DTM_COPYSELECTIONTOISTREAM

This code works:

extern "C" WM5SELECT_API int SelectionToClipboard(HWND hWndHtml)
{
ULONG ulNumChars = 0;
LPWSTR pSelectedText = NULL;
LPSTREAM pStream = 0;
DWORD rsd = 0;
HGLOBAL hglbCopy;
LPTSTR lptstrCopy;
if (!OpenClipboard(NULL))
{
return -2;
}
__try
{
SendMessage(hWndHtml, DTM_COPYSELECTIONTONEWISTREAM, (WPARAM)&rsd, (LPARAM)&pStream);

if(pStream)
{
STATSTG stat = { 0 };
if (SUCCEEDED(pStream->Stat (&stat, STATFLAG_NONAME)))
{
pSelectedText = (LPWSTR)LocalAlloc(LPTR,(ULONG)stat.cbSize.QuadPart + 4);
if (pSelectedText)
{
HRESULT hr = pStream->Read(pSelectedText, (ULONG)stat.cbSize.QuadPart, &ulNumChars);
if( SUCCEEDED(hr) )
{
{

EmptyClipboard();
hglbCopy = GlobalAlloc(GMEM_MOVEABLE, ulNumChars+2);
if( hglbCopy != NULL )
{
lptstrCopy = (LPTSTR) GlobalLock(hglbCopy);
memcpy(lptstrCopy, pSelectedText, ulNumChars);
GlobalUnlock(hglbCopy);
SetClipboardData(CF_UNICODETEXT, hglbCopy);
}
}
}
LocalFree(pSelectedText);
}
}

pStream->Release ();
}


}
__except(EXCEPTION_EXECUTE_HANDLER)
{
if( pStream != NULL )
pStream->Release();
if( pSelectedText != NULL )
LocalFree(pSelectedText);
if( hglbCopy != NULL )
GlobalFree(hglbCopy);
CloseClipboard();
return -1;
}
CloseClipboard();
return ulNumChars;
}
 
Add details of platform

Hello everyone,

Though this topic is not hot now, I would like to implements the above copy function in VB.Net compact framework. I can get the pStream by sending a DTM_COPYSELECTIONTONEWISTREAM message. It is very appreciate if you could tell me how to read the stream in VB.Net. Thanks in advance.
PS. platform is VS2005, WM5 or WM6
 
Last edited:
Back
Top