Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. RichEdit Streamin SF_TEXT not appearing

RichEdit Streamin SF_TEXT not appearing

Scheduled Pinned Locked Moved C / C++ / MFC
18 Posts 2 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F ForNow

    i'LL POST THREE pieces 1) the oninitdialog of the parent Cdialog 2) the Steamin 3) resource file Tell me if you want to see more thanks you

    BOOL CStorge::OnInitDialog()
    {
    int numolines;

    storagepointer = new CRichEditCtrl;
    
    
    CDialog::OnInitDialog();
    
    CHARFORMAT cf2 = { 0 };
    
    
    STREAMIN((WPARAM)storage\_ptr, (LPARAM)storagelen);
    storagepointer->SetSel(0, -1);
    cf2.cbSize = sizeof(cf2);
    cf2.dwMask = CFM\_FACE | CFM\_PROTECTED;
    cf2.dwEffects = CFE\_PROTECTED;
    memcpy(&cf2.szFaceName\[0\], "Courier New",12);
    storagepointer->SetSelectionCharFormat(cf2);
    storagepointer->SetSel(0, 0);
    storagepointer->ShowWindow(SW\_SHOW);
    ShowWindow(SW\_SHOW);
    return TRUE;
    

    }

    call to setup STREAMIN

    LRESULT CStorge::STREAMIN(WPARAM mywparam, LPARAM mylparam)
    {
    char *sendptr;
    sendptr = (char*)mywparam + 4;
    streaminparm parms;
    parms.storpointer = (char *)sendptr;
    parms.storlen = (int)mylparam;

    EDITSTREAM STORAGESTREAM;
    STORAGESTREAM.pfnCallback = storagestreamin;
    STORAGESTREAM.dwCookie = mywparam;
    STORAGESTREAM.dwCookie = (DWORD\_PTR) &parms;
    

    long numstream = storagepointer->StreamIn(SF_TEXT,STORAGESTREAM);

    return TRUE;
    

    }

    the Streamin function

    DWORD storagestreamin(DWORD_PTR dwCookie,
    LPBYTE pbBuff,
    LONG cb,
    LONG* pcb)

    {

    static BOOL flag = 0;
    if (flag == 0)
    	flag = 1;
    else
    {
    	\*pcb = 0;
    	flag = 0;
    	return 0;
    }
    int i;
    streaminparm\* inparms = (streaminparm \*)dwCookie;
    void\* holdptr = inparms->storpointer;
    char\* holdptr1 = (char\*)pbBuff;
    	int totalen = inparms->storlen;
    	memcpy((char \*)pbBuff, "This is a test\\r\\n",16);
    	\*pcb = 16;
    return 0;
    
    	for (i = 0; i < totalen; i += storageline)
    	{
    		memcpy(holdptr1, holdptr, storageline);
    		holdptr = (char\*)holdptr + storageline;
    		holdptr1 = (char\*)holdptr1 + storageline;
    		\*holdptr1 = '\\r';
    		holdptr1 = (char\*)holdptr1 + 1;
    		\*holdptr1 = '\\n';
    		\*pcb += 74;
    	}
    
    	return 0;
    

    }

    the Dataexchange member to create the rich edit HWND

    void CStorge::DoDataExchange(CDataExchange* pDX)
    {
    CDialogEx::DoDataExchange(pDX);

    DDX\_Text(pDX, IDC\_ASID, asidstr);
    DDX\_Text(pDX, IDC\_SP, spstr);
    DDX\_Text(pDX, IDC\_TCB, tcbstr);
    DDX\_Text(pDX, IDC\_FP, fpstr);
    DDX\_Control(pDX, IDC\_EDIT2, (CWnd&) \*storagepointer);
    

    }

    The resource indentfier of the cdialog with richedit

    IDD_DIALOG10 DIALOGEX 0, 0, 769, 429
    STYLE DS_SETFONT | DS_MODALFRAM

    V Offline
    V Offline
    Victor Nijegorodov
    wrote on last edited by
    #5

    ForNow wrote:

    CDialog::OnInitDialog(); CHARFORMAT cf2 = { 0 }; STREAMIN((WPARAM)storage_ptr, (LPARAM)storagelen);

    What is storage_ptr? Its type and value?

    F 1 Reply Last reply
    0
    • V Victor Nijegorodov

      ForNow wrote:

      CDialog::OnInitDialog(); CHARFORMAT cf2 = { 0 }; STREAMIN((WPARAM)storage_ptr, (LPARAM)storagelen);

      What is storage_ptr? Its type and value?

      F Offline
      F Offline
      ForNow
      wrote on last edited by
      #6

      you think thats the problem I should make it a CRicheditrl * BTW I did Call AfxRichEditInit and I did observer that storage__ptr had a Hwnd after the DoDataExange

      void* storage_ptr;

      V 1 Reply Last reply
      0
      • F ForNow

        you think thats the problem I should make it a CRicheditrl * BTW I did Call AfxRichEditInit and I did observer that storage__ptr had a Hwnd after the DoDataExange

        void* storage_ptr;

        V Offline
        V Offline
        Victor Nijegorodov
        wrote on last edited by
        #7

        ForNow wrote:

        C++Copy Code void* storage_ptr;

        You mean you pass an uninitialized pointer into your STREAMIN method? BTW, did you debug your code (and, particularly, this STREAMIN method)?

        F 1 Reply Last reply
        0
        • V Victor Nijegorodov

          ForNow wrote:

          C++Copy Code void* storage_ptr;

          You mean you pass an uninitialized pointer into your STREAMIN method? BTW, did you debug your code (and, particularly, this STREAMIN method)?

          F Offline
          F Offline
          ForNow
          wrote on last edited by
          #8

          The Ponter I pass to the streamin is 1) the data ptr and 2) the length of it I did debug it and it passed the value back that I wanted in pBuff and *pcb storage_ptr should be of type CrRicheditCtrl * instead of void * but it does a value and After the Call Cdialog::OnInitDialog it Called my DoDataExchage and had a valid HWND In in fact if you look at that small test when I pass "this is a test\r\n" back to pBuff and *pcb = 16 that doesn't display When I type any chanarcter in the rich edit for example a D this is a test follow it for example looks like this DThis is a test thanks

          V 1 Reply Last reply
          0
          • F ForNow

            The Ponter I pass to the streamin is 1) the data ptr and 2) the length of it I did debug it and it passed the value back that I wanted in pBuff and *pcb storage_ptr should be of type CrRicheditCtrl * instead of void * but it does a value and After the Call Cdialog::OnInitDialog it Called my DoDataExchage and had a valid HWND In in fact if you look at that small test when I pass "this is a test\r\n" back to pBuff and *pcb = 16 that doesn't display When I type any chanarcter in the rich edit for example a D this is a test follow it for example looks like this DThis is a test thanks

            V Offline
            V Offline
            Victor Nijegorodov
            wrote on last edited by
            #9

            I could not test your "code" because there is a lot of problems with: undeclared identifier undeclared identifier cannot convert from 'DWORD (__cdecl *)(DWORD_PTR,LPBYTE,LONG,LONG *)' to 'EDITSTREAMCALLBACK' ... and so on. Could you post a code (sample project) that would reproduce your problem?

            F 1 Reply Last reply
            0
            • V Victor Nijegorodov

              I could not test your "code" because there is a lot of problems with: undeclared identifier undeclared identifier cannot convert from 'DWORD (__cdecl *)(DWORD_PTR,LPBYTE,LONG,LONG *)' to 'EDITSTREAMCALLBACK' ... and so on. Could you post a code (sample project) that would reproduce your problem?

              F Offline
              F Offline
              ForNow
              wrote on last edited by
              #10

              is there anywhere I could zip it if not the total project is 6 .cpp files with 6 headers and resource file thanks you are really nice

              V 1 Reply Last reply
              0
              • F ForNow

                is there anywhere I could zip it if not the total project is 6 .cpp files with 6 headers and resource file thanks you are really nice

                V Offline
                V Offline
                Victor Nijegorodov
                wrote on last edited by
                #11

                Sorry! I don't know. But if you won't find a way to do that then you could repost your question in [Visual C++ Programming](https://forums.codeguru.com/forumdisplay.php?7-Visual-C-Programming) Or just email it to me: at

                F 1 Reply Last reply
                0
                • V Victor Nijegorodov

                  Sorry! I don't know. But if you won't find a way to do that then you could repost your question in [Visual C++ Programming](https://forums.codeguru.com/forumdisplay.php?7-Visual-C-Programming) Or just email it to me: at

                  F Offline
                  F Offline
                  ForNow
                  wrote on last edited by
                  #12

                  Ill take the latter thanks but this mini project is a tcp/ip application that gets data into the RichEdit from a z z/os machine let me see if I can somehow segregate it The rich edit portion that is causing the problems and then get a clean build and i'll send it over thanks you are very nice

                  V 1 Reply Last reply
                  0
                  • F ForNow

                    Ill take the latter thanks but this mini project is a tcp/ip application that gets data into the RichEdit from a z z/os machine let me see if I can somehow segregate it The rich edit portion that is causing the problems and then get a clean build and i'll send it over thanks you are very nice

                    V Offline
                    V Offline
                    Victor Nijegorodov
                    wrote on last edited by
                    #13

                    You have to simplify your project code until it will reproduce the problem. Just make a very simple project with your RichEdit without any TCP/IP and other IPCs. Test it. If you won't find the reason of the trouble while debugging this test project then post it to me or/and to the community.

                    F 1 Reply Last reply
                    0
                    • V Victor Nijegorodov

                      You have to simplify your project code until it will reproduce the problem. Just make a very simple project with your RichEdit without any TCP/IP and other IPCs. Test it. If you won't find the reason of the trouble while debugging this test project then post it to me or/and to the community.

                      F Offline
                      F Offline
                      ForNow
                      wrote on last edited by
                      #14

                      Will do thank you

                      1 Reply Last reply
                      0
                      • V Victor Nijegorodov

                        No idea until we will see your actual code.

                        F Offline
                        F Offline
                        ForNow
                        wrote on last edited by
                        #15

                        Victor commented out IDC_EDIT1 and the stream out worked you are very nice guy for your offer

                        IDD_DIALOG10 DIALOGEX 0, 0, 769, 429
                        STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
                        CAPTION "Storage View / Change"
                        FONT 8, "MS Shell Dlg", 400, 0, 0x1
                        BEGIN
                        CTEXT "",IDC_TCB,45,30,47,8
                        CTEXT "OwnIng TCB",IDC_STATIC,41,13,58,8
                        CTEXT "",IDC_SP,164,28,43,8
                        CTEXT "Storage SubPool",IDC_STATIC,162,12,55,8
                        CTEXT "",IDC_ASID,265,26,32,8
                        CTEXT "Asid",IDC_STATIC,269,9,31,8
                        CTEXT "",IDC_FP,399,31,19,8
                        CTEXT "Fetch Protect Key",IDC_STATIC,392,15,63,8
                        CONTROL "",IDC_CUSTOM5,"PieCOntrol",WS_TABSTOP,617,99,109,109
                        COMBOBOX IDC_COMBO1,491,236,48,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
                        CONTROL "",IDC_EDIT2,"RichEdit20A",ES_MULTILINE | WS_BORDER | WS_TABSTOP,45,106,494,314
                        // EDITTEXT IDC_EDIT1,45,110,494,314,ES_AUTOHSCROLL
                        COMBOBOX IDC_COMBO2,637,244,67,16,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
                        LISTBOX IDC_LIST2,641,310,68,11,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
                        END

                        V 1 Reply Last reply
                        0
                        • F ForNow

                          Victor commented out IDC_EDIT1 and the stream out worked you are very nice guy for your offer

                          IDD_DIALOG10 DIALOGEX 0, 0, 769, 429
                          STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
                          CAPTION "Storage View / Change"
                          FONT 8, "MS Shell Dlg", 400, 0, 0x1
                          BEGIN
                          CTEXT "",IDC_TCB,45,30,47,8
                          CTEXT "OwnIng TCB",IDC_STATIC,41,13,58,8
                          CTEXT "",IDC_SP,164,28,43,8
                          CTEXT "Storage SubPool",IDC_STATIC,162,12,55,8
                          CTEXT "",IDC_ASID,265,26,32,8
                          CTEXT "Asid",IDC_STATIC,269,9,31,8
                          CTEXT "",IDC_FP,399,31,19,8
                          CTEXT "Fetch Protect Key",IDC_STATIC,392,15,63,8
                          CONTROL "",IDC_CUSTOM5,"PieCOntrol",WS_TABSTOP,617,99,109,109
                          COMBOBOX IDC_COMBO1,491,236,48,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
                          CONTROL "",IDC_EDIT2,"RichEdit20A",ES_MULTILINE | WS_BORDER | WS_TABSTOP,45,106,494,314
                          // EDITTEXT IDC_EDIT1,45,110,494,314,ES_AUTOHSCROLL
                          COMBOBOX IDC_COMBO2,637,244,67,16,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
                          LISTBOX IDC_LIST2,641,310,68,11,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
                          END

                          V Offline
                          V Offline
                          Victor Nijegorodov
                          wrote on last edited by
                          #16

                          Does it mean that your text was under the IDC_EDIT1 control? Or what???

                          F 1 Reply Last reply
                          0
                          • V Victor Nijegorodov

                            Does it mean that your text was under the IDC_EDIT1 control? Or what???

                            F Offline
                            F Offline
                            ForNow
                            wrote on last edited by
                            #17

                            No just commented out that control maybe it overlaid IDC_EDIT Thank you

                            V 1 Reply Last reply
                            0
                            • F ForNow

                              No just commented out that control maybe it overlaid IDC_EDIT Thank you

                              V Offline
                              V Offline
                              Victor Nijegorodov
                              wrote on last edited by
                              #18

                              ForNow wrote:

                              maybe it overlaid IDC_EDIT

                              Yes, it is what I meant in my previous post. :)

                              1 Reply Last reply
                              0
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              • Login

                              • Don't have an account? Register

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • World
                              • Users
                              • Groups