Click here to Skip to main content
15,887,392 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionC++ Pin
Naveenkumarreddy Ramireddy6-Feb-22 6:44
Naveenkumarreddy Ramireddy6-Feb-22 6:44 
AnswerRe: C++ Pin
trønderen6-Feb-22 8:00
trønderen6-Feb-22 8:00 
AnswerRe: C++ Pin
Victor Nijegorodov6-Feb-22 8:50
Victor Nijegorodov6-Feb-22 8:50 
AnswerRe: C++ Pin
Artem Moroz8-Feb-22 9:19
Artem Moroz8-Feb-22 9:19 
QuestionRichEdit Streamin SF_TEXT not appearing Pin
ForNow30-Jan-22 14:58
ForNow30-Jan-22 14:58 
AnswerRe: RichEdit Streamin SF_TEXT not appearing Pin
Victor Nijegorodov30-Jan-22 20:43
Victor Nijegorodov30-Jan-22 20:43 
GeneralRe: RichEdit Streamin SF_TEXT not appearing Pin
ForNow30-Jan-22 20:48
ForNow30-Jan-22 20:48 
GeneralRe: RichEdit Streamin SF_TEXT not appearing CODE POSTED !!!!! Pin
ForNow31-Jan-22 1:32
ForNow31-Jan-22 1:32 
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

C++
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

C++
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

C++
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

C++
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_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
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 | WS_VISIBLE, 45,106,494,314  THE RICH EDIT
    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

GeneralRe: RichEdit Streamin SF_TEXT not appearing CODE POSTED !!!!! Pin
Victor Nijegorodov31-Jan-22 1:45
Victor Nijegorodov31-Jan-22 1:45 
GeneralRe: RichEdit Streamin SF_TEXT not appearing CODE POSTED !!!!! Pin
ForNow31-Jan-22 2:11
ForNow31-Jan-22 2:11 
GeneralRe: RichEdit Streamin SF_TEXT not appearing CODE POSTED !!!!! Pin
Victor Nijegorodov31-Jan-22 2:17
Victor Nijegorodov31-Jan-22 2:17 
GeneralRe: RichEdit Streamin SF_TEXT not appearing CODE POSTED !!!!! Pin
ForNow31-Jan-22 2:31
ForNow31-Jan-22 2:31 
GeneralRe: RichEdit Streamin SF_TEXT not appearing CODE POSTED !!!!! Pin
Victor Nijegorodov31-Jan-22 10:34
Victor Nijegorodov31-Jan-22 10:34 
GeneralRe: RichEdit Streamin SF_TEXT not appearing CODE POSTED !!!!! Pin
ForNow31-Jan-22 10:39
ForNow31-Jan-22 10:39 
GeneralRe: RichEdit Streamin SF_TEXT not appearing CODE POSTED !!!!! Pin
Victor Nijegorodov31-Jan-22 10:52
Victor Nijegorodov31-Jan-22 10:52 
GeneralRe: RichEdit Streamin SF_TEXT not appearing CODE POSTED !!!!! Pin
ForNow31-Jan-22 11:00
ForNow31-Jan-22 11:00 
GeneralRe: RichEdit Streamin SF_TEXT not appearing CODE POSTED !!!!! Pin
Victor Nijegorodov31-Jan-22 11:10
Victor Nijegorodov31-Jan-22 11:10 
GeneralRe: RichEdit Streamin SF_TEXT not appearing CODE POSTED !!!!! Pin
ForNow31-Jan-22 11:16
ForNow31-Jan-22 11:16 
GeneralRe: RichEdit Streamin SF_TEXT not appearing commented out one control and it displayed pated .rc Pin
ForNow1-Feb-22 14:14
ForNow1-Feb-22 14:14 
GeneralRe: RichEdit Streamin SF_TEXT not appearing commented out one control and it displayed pated .rc Pin
Victor Nijegorodov2-Feb-22 0:24
Victor Nijegorodov2-Feb-22 0:24 
GeneralRe: RichEdit Streamin SF_TEXT not appearing commented out one control and it displayed pated .rc Pin
ForNow2-Feb-22 1:18
ForNow2-Feb-22 1:18 
GeneralRe: RichEdit Streamin SF_TEXT not appearing commented out one control and it displayed pated .rc Pin
Victor Nijegorodov2-Feb-22 1:54
Victor Nijegorodov2-Feb-22 1:54 
Questioncontrol RESOURCE definition Pin
ForNow25-Jan-22 17:16
ForNow25-Jan-22 17:16 
QuestionRe: control RESOURCE definition Pin
Richard MacCutchan25-Jan-22 21:57
mveRichard MacCutchan25-Jan-22 21:57 
AnswerRe: control RESOURCE definition Pin
Stefan_Lang25-Jan-22 23:25
Stefan_Lang25-Jan-22 23:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.