|
please help me..
I've develop something.
First I made a txt file that contains just some word "Hello, Bye, etc.." and then load it on the IE.
Second check the text on the IE, and then compare the text with some pattern like "Hello".
Third I add some html cord. The function of cord would change background color of the text "Hello" and hand cursor shape, if the pattern is same.
OK. Now I want to add some more function.
1. If I click the text that was already changed background color, and some more things,
('couse same with some pattern like "Hello")
then I want to make pop up my Dialog box(modal) on the IE. The box name is IDD_POPUP.
2. Next, the IDD_POPUP has a static text. I want to show the "Hello" on the static box of IDD_POPUP.
That's all.. plz help me~
------------------------------------------------------------------------------------------------
void CABC::RegexHighlight(CComPtr<ihtmldocument2> spHTML)
///reference - http://www.codeproject.com/miscctrl/chtmlview_search.asp
{
static IRegExpPtr regExp( __uuidof(RegExp) );
static IRegExpPtr regExp_1( __uuidof(RegExp) );
LPCTSTR lpszPattern = " Hello /*some pattern*/ ";
regExp->Pattern = lpszPattern;
regExp->put_Global(VARIANT_TRUE);
IMatchCollectionPtr matches;
IMatchPtr match, tempMatch;
long m_cnt;
int i;
long startPoint, strLength;
IHTMLElement *lpBodyElm;
IHTMLBodyElement *lpBody;
IHTMLTxtRange *lpTxtRange;
bool bFound;
spHTML->get_body(&lpBodyElm);
lpBodyElm->QueryInterface(IID_IHTMLBodyElement,(void**)&lpBody);
lpBody->createTextRange(&lpTxtRange);
CString cstr;
BSTR bstr, tmpbstr;
BSTR bmark;
VARIANT_BOOL ret;
lpTxtRange->get_text(&bstr);
lpTxtRange->getBookmark(&bmark);
cstr = bstr;
matches = regExp->Execute(bstr);
m_cnt = matches->Count;
CString chkStr[1000];
long c_cnt = 0;
bool isChk = false;
for (i = 0; i < m_cnt; i++) {
match = matches->Item[i];
startPoint = match->FirstIndex;
strLength = match->Length;
match->get_Value(&tmpbstr);
CString searchText = tmpbstr;
CComBSTR html;
CComBSTR newhtml;
CComBSTR search(searchText.GetLength()+1,(LPCTSTR)searchText);
while(lpTxtRange->findText(search,0,2,(VARIANT_BOOL*)&bFound),bFound) //lFlags = 2 or 0
{
newhtml.Empty();
lpTxtRange->get_htmlText(&html);
//change the background color, etc..
newhtml.Append(" <span id='regexnum' style='color: Black; background-color: yellow'><font style='cursor:hand'>");
newhtml.AppendBSTR(html);
newhtml.Append("dssd");
lpTxtRange->pasteHTML(newhtml);
}
lpTxtRange->moveToBookmark(bmark, &ret);
}
}
|
|
|
|
|
Hi
How do we insert an image or an icon in a dialog?
/\|-||\/|/\|)
|
|
|
|
|
Just add a picture control to the dialog's template. Change it's type to either Icon or Bitmap. In the Image: combobox, select the id of the image (it must already exist) you want.
If you'll create a temporary dialog-based project that has an About box, you'll see how the icon on the About dialog template looks.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
DavidCrow wrote:
Just add a picture control to the dialog's template. Change it's type to either Icon or Bitmap.
how do i do that by code?
/\|-||\/|/\|)
|
|
|
|
|
Click on the Picture Control icon in the Toolbox window and then click in the dialog's template where you want the control placed. It's just like adding any other control (e.g., button, listbox).
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
how can i do that by code
/\|-||\/|/\|)
|
|
|
|
|
Exactly what do you mean "by code?" What I showed you will modify your project's .RC file, which is code your project needs in order to run.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
i mean i nedd to create this image dynamically at run time so i need to write physically the code not using the rc interface
/\|-||\/|/\|)
|
|
|
|
|
Check out:
CBitmapButton
CButton::SetIcon()
CButton::SetBitmap()
CStatic::SetIcon()
CStatic::SetBitmap()
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Ok thx i have just discovered how using setbitmap
/\|-||\/|/\|)
|
|
|
|
|
hi again
Ok i need now to move the picture i have created in runtime how do i do that?
/\|-||\/|/\|)
|
|
|
|
|
How about MoveWindow() or SetWindowPos() ?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I can't use them with my image i have tried
how can i associate ID_image to be able to move it
/\|-||\/|/\|)
|
|
|
|
|
Halawlaws wrote:
I can't use them with my image i have tried
But since you have not shown what code you tried with, how can I determine if you did it correctly or not?
Halawlaws wrote:
how can i associate ID_image to be able to move it
Based on what little I know of your problem, I'd start with GetDlgItem() .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
i cant use them
i dont have a class or a struct to call them all i have is the id of the image:ID_IMAGE
/\|-||\/|/\|)
|
|
|
|
|
Halawlaws wrote:
i dont have a class or a struct to call them...
What does having a class or struct have to do with being able to use MoveWindow() or SetWindowPos() ?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
DavidCrow wrote:
What does having a class or struct have to do with being able to use MoveWindow() or SetWindowPos()?
If u dont have a class and u use MoveWindow() the only thing that will move is the dialog u must specify that u want the image.
how do u do that?
/\|-||\/|/\|)
|
|
|
|
|
Perhaps you are confused as to what MoveWindow() does. It changes the position and dimensions of the specified window, whether that window is a dialog, control, or a frame. If the window in which you are wanting to move has child windows (e.g., dialog having controls), all of them are moved too.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi guys,
Can anybody give me a explicit explanation about what is a HWND(handle to a window) , what does it differ from a CWnd object ?? Please provide examples if you can.
I've searched in MSDN but could not get enough information
Regards ,
Nick
|
|
|
|
|
I think it's like this: An HWND is a number (handle) to a window (dialog, edit box, etc) that is used by the Windows operating system to refer to the window specifically. CWnd is just an MFC class that encapsulates a registered window class and its handle. You could just as easily make up a class called CMyWindow and in the constructor have it call the Windows API to create a window of the type you want (button, for instance) in your class's constructor, then have the HWND be a property of your class. CWnd is just an encapsulating class, as is CListBox, CComboBox, etc.
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
Thanks for reply,
So is a HWND smth like : "CWnd object - template resource" .
Does it mean that if i have a handle to a window ,
i can use all methods declared in a CWnd for this window???
sorry i don't get it
|
|
|
|
|
Well, CWnd is an MFC class. You can get an HWND to a window just using the Windows API to create a window, then registering it. If you're using a CWnd class, you can just use the methods of the class; it takes care of all the HWND stuff for you (usually). So if you're using a CWnd-derived object, you probably don't need to use an HWND
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
A handle is nothing more than a token that an application can use to identify and access an object such as a device, a file, a window, or a dialog box.
See here for what CWnd is and is not.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
You can get the CWnd (or the corresponding class) pointer from the handle by using FromHandle(HWND hWnd) so you'll be able to use the advantages from the 2 ways.
Marc.
|
|
|
|
|
CWnd is wraps the Window handle and window handle related API's into a single Class.
suhredayan There is no spoon.
|
|
|
|