How to Add Link Some Text in RichEdit Control in MFC

I need to add some Text with Link to RichEdit, thats all.
for example,
my String is,
line 1 : PASS
line 2 :  FAIL
line 3 : PASS
line 4 : FAIL
line 5 : FAIL
now i want to add this String into RichEdit. and add a Link to Only FAIL text. when i click the FAIL Text(ie, line2,line4,line5) it show some message using Message Box or AfxMessageBox.

I decided to give it a go and wow it was way harder than I thought it should be.  Here is what I ultimately did. (you can try playing with ITextDocument2, ITextRange2::SetURL, but I didn't get that to work like I wanted.  I finally resorted to
directly injecting RTF into my RichEdit control.  Here is a brief example (there is a little MFC in here to save time, but the relevant stuff is pure Win32 and the MFC is trivially convertable to Win32).
m_rich.Create(WS_VISIBLE | WS_CHILD | ES_MULTILINE, CRect(10, 10, 200, 200), this, 1000);
// TODO: Add extra initialization here
m_rich.SetWindowText(L"This is a test ");
m_rich.SetSel(-1, -1);
m_rich.SetEventMask(ENM_LINK);
std::string dataStr = R"({\rtf1{\field{\*\fldinst{ HYPERLINK http://example.com }}{\fldrslt{DisplayText}}}}.)";
std::list<char> dataList(dataStr.begin(), dataStr.end());
EDITSTREAM es = {
reinterpret_cast<DWORD_PTR>(&dataList),
0,
[](DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb) -> DWORD {
auto &list = *(reinterpret_cast<std::list<char> *>(dwCookie));
*pcb = 0;
while (*pcb < cb && !list.empty()) {
pbBuff[*pcb] = list.front();
list.pop_front();
(*pcb)++;
return 0;
auto r = m_rich.SendMessage(EM_STREAMIN, SF_RTF | SFF_SELECTION, reinterpret_cast<LPARAM>(&es));

Similar Messages

  • How to add linked button in grid?

    Hi,
    Does anyone know how to add linked button in a grid? I can't find it but i saw someone ask similar question but seems none of them works.
    Thanks a lot!
    P.S. For some reason, i can't use matrix because the data is from a SQL query.
    Lan

    Hi,
    as far as I know it is not possible, since this adjustment is made for the whole column. I have created a grid and I open the shown document by double clicking the row header. In the grid I can see if it is sales or purchase and so I use a workaround by opening the specific system form (e.g. sales invoice) in find mode and search the document by document number (also shown in the grid).
    Sample:
    oSBOapp.ActivateMenuItem("2053"); //sales invoice
    oForm = oSBOapp.Forms.ActiveForm;
    oForm.Mode = SAPbouiCOM.BoFormMode.fm_FIND_MODE;
    oEdit = (SAPbouiCOM.EditText)oForm.Items.Item("8").Specific;
    oEdit.Value = Convert.ToString(dNum);
    oForm.Items.Item("1").Click(SAPbouiCOM.BoCellClickType.ct_Regular);
    By the click event, you get the specific row number. Hope it helps...
    Regards
    Sebastian

  • How to add a scrolling text in portrait with iMovie

    how to add a scrolling text in portrait with iMovie

    This is how i was able to do it. Edit html source.
    <div align="center"><marquee id='scroll_news4' bgcolor=#ff9966 "><font color="#000000" size="+1" ><strong>Outlook is down! IT is working on it! </strong></font></marquee></div>
    <input type='Button' value='Stop' id ='b1' onClick='button_click()';>
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    function button_click()
    if(document.getElementById('b1').value=="Start"){
    document.getElementById('b1').value="Stop";
    document.getElementById('scroll_news4').start();
    }else{
    document.getElementById('b1').value="Start";
    document.getElementById('scroll_news4').stop();
    // End -->
    </script>

  • How do you link 2 text boxes in new pages

    How do you link two text boxes in the new pages.  The old one was much easier to use.

    I think this is impossible! Ive been trying today and I couldnt do it. Then I opened up an old document that had text linking in it and I got a message telling me that the text boxes were now unlinked!  Why would you remove that? For me this software is now useless. How on earth do I get my old version back?
    <Edited by Host>

  • Who knows how to add emoticons to texts on iphone 4s

    who knows how to add emoticons to text messages on iphone 4s?

    Keep in mind that the Emoji keyboard uses an Apple font. It doesn't always play well with non-Apple devices, Using Emoji when sending a text to an iPhone user can result in weird characters. You're better off using real emoticons:
    smile :-)
    wink ;-)
    And so forth. Android phones will convert them into the proper cutsey symbols.

  • How to add an image to an IMAGE control in Java WebDynpro

    hi
    How to add an image to an IMAGE control in Java WebDynpro.
    Please give me the steps to assign an image to an IMAGE control.
    Advanced Thanks
    brahma

    Thank You Mathan MP,
    i tried these steps, but whenever i selected the source property of image UI control, it opens a context window, but this context window does't contain any thing for selection.
    so how to solve this problem ?
    the link whatever u provided is not opened, please send the correct link.
    http://127.0.0.1:1284/help/index.jsp?topic=/com.sap.devmanual.doc.user/f3/1a61a9dc7f2e4199458e964e76b4ba/content.htm
    Thanks in Advance
    brahma

  • How do I put some kind of parental controls on my ipad 2? My 7 year old daughter just purchased, without my permission, $275 worth of in app purchases in Mall Stars game.  Any tips on how to reverse that purchase?

    How do I put some kind of parental controls on my ipad 2? My 7 year old daughter just purchased, without my permission, $275 worth of in app purchases in Mall Stars game.  Any tips on how to reverse that purchase?

    You can also contact itunes support and ask for a refund.
    expresslane.apple.com
    https://expresslane.apple.com/Issues.action

  • How to add Gap between dropdown List Items - ComboBox in MFC VC++

    How to add Gap between dropdown List Items - ComboBox in MFC VC++

    Did you tried SetItemHeight() inside your App .
    Thanks
    Rupesh Shukla

  • How to add full screen text w/out losing audio. I have premier elements 12

    I am creating a language tutorial. Am trying to add full screen text without losing the audio explanation of the text. How do I make this edit and not lose the audio that coincides with the full screen text?

    Roberto
    Thanks for the details.
    Variable - Constant Frame Rate Explanation
    First, the variable frame rate mention and any problems that might be expected if your iPad video was recorded with a variable rather than constant frame rate. Some cameras (such a cell phone, iPod, probably iPad) record video not at one frame rate across the whole video recording. Instead, they record with a variable frame rate depending usually on the lighting conditions during video recording. One way to know what your recording device is using is to view the MediaInfo video audio properties readout. If you have a constant frame rate, you will see just one frame rate listed. If variable, you should see 3 frame rates listed minimum, maximum, and mid range frame rate.
    MediaInfo - Free download and software reviews - CNET Download.com
    This situation may or may not cause problems for you in Premiere Elements. The signs of problems are usually out of sync audio and you just cannot import the video into the project. If this type of problem, then you take your video into a program such as HandBrake to generate a file with a constant rather than variable frame rate. Then you import the file with the constant frame rate into your Premiere Elements project. http://handbrake.fr/
    Again, this may or may not create problems.
    The Generalized Project Workflow
    There is no problem to setup up your Timeline physically. The iPad video with go to Video Track 1 and Audio Track 1. The video is imported into the project linked to it audio portion. And, the Full Screen Text Files will be on Video Track 2 directly above the related content. Now here is the part that I am not yet clear on. Is the Full Screen Text for a given portion of video supposed to synchronize word for word with what you are saying in the audio on Audio Track 1? That will involve a mapping out part with regard to duration of each of the Full Screen Text files. Will these Full Screen Text files be readable against the video representing the background? Font style and size and color will be major considerations as well as getting the text file to be on screen long enough to be readable even with Font style, size, and color considerations.
    The fact that you focus on audio loss in all this makes me wonder if I am missing a vital part of what you want to do. The loss of audio concern that you mention does not seem like a prime factor unless you are referring to sync between the texts and what it is supposed to correspond to in the audio of the video.
    Please review and consider and then, based on your reply, I will offer a mini demo to see if we are OK on the details.
    Thanks.
    ATR

  • How can i link a text to a photo into a slideshow?

    hello, need some help please! i want to link a text to a specified photo into a slideshow, another word to another photo and so on...I've tried any slideshow, and composition with anchor points and it doesn't work. How can i realize that please?

    There's no support within Muse to cause click on a word within a flow of text to result in a slideshow turning to a specific image.
    A composition widget can be used to have clicking on or rolling over a trigger object cause a target container to appear.

  • How to add box around text in s:TextArea?

    Hi,
    What I want to do is I want a red box to appear around some text in my s:TextArea, which is editable.
    Well, I can add a red box by putting the following after my text area.
      <s:Graphic>
        <s:Rect x="20" y="110" width="20" height="20" >
             <s:stroke>
                  <s:SolidColorStroke color="0xFF8888"/>
             </s:stroke>
        </s:Rect>
      </s:Graphic>
    However the user will edit the text, and the text position will change. Also the user will scroll the text area up and down.
    So the location of the box should move to still be located around the text.
    How can I track the position of the text? Is this a good idea? to track the position of the text and to keep moving the box to keep it on top of the text?
    Thanks, Philip

    Philip,
    How about something like this?
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
            xmlns:s="library://ns.adobe.com/flex/spark"
            xmlns:mx="library://ns.adobe.com/flex/halo">
        <s:TextArea id="txtArea"
                horizontalCenter="0" verticalCenter="0">
            <s:content>
                <s:p>The quick brown fox jumps <s:span backgroundColor="0xFF0000" backgroundAlpha="0.8">over</s:span> the lazy dog.</s:p>
            </s:content>
        </s:TextArea>
    </s:Application>
    Peter

  • How to add customer specific text in MEDRUCK form?

    Hi ALL,
            I am new to sap script area. I have done more analysis for my query.
    Question: How can we add some text for particular customer? I have tried on calling subroutines and tried for includes via S010 entries.. but i am failed to add the text. So if you can give me valuable suggestion it is really much appreciated.
    Thanks in advance.
    Partha Sarathi Reddy.

    Hi Kishan,
        Thanks for Reply. Actually the requirement is the specific customer(vbpa-kunnr) wants to add one small note like " This is computer gernerated copy, no singnature required" bottom of the footer or just before footer.
    1)  I have created that note in S010 entries and called via include directly in window itself. It is not working.
    2) Tried with PERFORM statement and written piece of code in main programme and called via form. It is also not working.
      Where we can validate that particular customer like in forms? or in progarmme? ( please consider me as a new developer in scripts).
       Please give me more details regarding my issude , so that i can go ahead with your suggestions.
    Thanks in advance.
    Partha.

  • How to add info record text into Schedule agreement

    Dear,
    how can I put the info record text into Schedule Agreement. normally it can contains the short text , but in my company, it needs  some more specific description.so we want to add info record text on it.
    via ME32L ? or ...
    thanks for your kind help
    Meng HM

    Hi,
    In the inforecord trasnaction code ME11,go to  info record text and double click on  'Info record note' -
    Now system will open word document & put whatever text you needed(more) & save.
    With Regards,
    Jaheer

  • How can I put some text on a circular shape and make it visible in a Picture?

    I work with LabVIEW 5.1.1 (FDS), the Picture Control Toolkit and IMAQ 4.1.1.
    I'd like to make some text to flow on a circular shape of given radius just like I can do with the most common graphic programs like CorelDraw!
    How can I do?

    A new overlay VI was developed to address the need to add text to an image easily.
    IMAQ Overlay Text (Functions >> Vision Utilities >> Overlay).
    - It is available in IMAQ Vision 6.0 (which requires LabVIEW 5.1 or greater).
    It will allow you to rotate text, but it currently does not support circular shapes.

  • How to add links and rollovers from an exported Edge Reflow HTML in Dreamweaver?

    Hi,
    Thanks to the very helpful community I have found the way to get my HTML file from Edge Reflow.
    Upon opening the HTML file in Dreamweaver, the CSS, Java scripts are wonderfully linked. However, I am not experienced enought to manipulate the divs to get a rollover or add links to the layout.
    Eg. Sticky Navigation bar on the top, how do you add rollovers and links?
    All help is very much appreciated.
    Thank you for your help in advance!

    Hi Chris,
    your plan for Reflow sounds good. Versioning is probably the most adaptable way to integrate it with the rest of the workflow.
    What I think is still missing, on the simple side, is link creation and management inside Reflow.
    Of course, considering you have just introduced multiple pages, this feature shouldn't be far...
    About Dreamweaver, I've been a faithful user for years but now it's definitely old for some uses.
    Just to say, if I open the responsive page I just created in Reflow with DWCC in Live View, something basic as background gradients are completely missing. Well, I'm not going to use it for this kind of work.
    Do you know for what DW is still a great tool? Email Newsletters, since they still have to respect old standards that no one else uses anymore.
    For all the rest I definitely prefer the editor/IDE way: SublimeText and other tools.
    They're faster, more apt to the task and, similarly to the Adobe Edge line of products, made with the same technologies they help to work with.
    In the future, who knows... Maybe, you should put in development a "Dreamweaver Edge" version and drop the old one, a little clunky even if recently revarnished  ;-)

Maybe you are looking for