|
>No - the 'bottomless' rich-edit control is one that sends notifications to its parent >that it needs to be resized when the text it contains changes enough that the control >can't contain it all any more.
I thought just issuing the editctrl.RequestResize(); sends the EN_REQUESTRESIZE to the parent with REQSIZE structure containing the new demissions it ( child rich edit control) would like
>To receive EN_REQUESTRESIZE notification messages, you must enable the notification by >using the EM_SETEVENTMASK message.[^]
I did that I think the problem might be the named I choose foor the notification Handler "OnRequestResize"
I made a prototype of the function in the Dialog Class since thats the parent that will receive the notification
However I when try to set as Break point I get message "No code associated with this Location"
When I try to see the assembler code generated none is for the first part of the method
Could it be that the name I choose for the Event handle OnRequestResize is Similar to a protected method call onRequestResize (lower case o )thats giving me problems ??
I'll try to change the name ..
|
|
|
|
|
I've just added a rich-edit control to a sample MFC dialog app.
In the OnInitDialog handler, I added this:
UpdateData();
richEd.SetEventMask(ENM_REQUESTRESIZE);
Here's the message map entry
ON_NOTIFY(EN_REQUESTRESIZE, IDC_RICHEDIT21, &CmfcdialogDlg::OnEnRequestresizeRichedit21)
Here's the notification handler
void CmfcdialogDlg::OnEnRequestresizeRichedit21(NMHDR *pNMHDR, LRESULT *pResult)
{
REQRESIZE *pReqResize = reinterpret_cast<reqresize>(pNMHDR);
*pResult = 0;
}</reqresize>
I request the resize with
richEd.RequestResize();
in a 'button click' event handler.
My EN_REQUESTRESIZE handler gets called.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
TODO: The control will not send this notification unless you override the // CDialog::OnInitDialog() function to send the EM_SETEVENTMASK message // to the control with the ENM_REQUESTRESIZE flag ORed into the lParam mask.
This accomplished in the OnInitDialog function issuing
richED.SetEventMask(ENM_REQUESTRESIZE);
I dont actually have to do a
CmfcdialogDlg::SendMessage(EM_SETEVENTMASK,0,(LPARAM)ENM_REQUESTRESIZE);
thankx
|
|
|
|
|
Hi,
thankx for all your all I see that you are in the UK 5 hours ahead of me as I am in the states on the East Coast
I got requestresize exit working (excuse me for my use of words "exit") as I Work as A MainFrame programmer
I have a couple of more general questions
the porpouse of the Bottomless Rich edit control is to get a perfect fit in Height and with for the Text
Depending on the amount of text and where you would like to break up the text is Where the Notfication Handler
will help
Last question I have been using WM_SETTEXT to get text to the Rich edit is the Steamin method a better way of doing
this
thankx again
|
|
|
|
|
ForNow wrote: Last question I have been using WM_SETTEXT to get text to the Rich edit is the Steamin method a better way of doing this
If the text is large (megabyte+) or is actually RTF (contains markup), yes. I've seen a couple of pages that suggest you should always use EM_STREAMIN because WM_SETTEXT is unreliable with rich edit controls - but if it's working for you...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
|
when excuting this (procID is a control panel applet)
HANDLE lView=OpenProcess(PROCESS_ALL_ACCESS,false,procID);
if (lView)
{
if ( !LookupPrivilegeValue(NULL,SE_DEBUG_NAME,&tokenLuid ) )
j=GetLastError();
tokenPriv.PrivilegeCount = 1;
tokenPriv.Privileges[0].Luid = tokenLuid;
tokenPriv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
tokenHandle=NULL;
if (!OpenProcessToken(lView,TOKEN_ADJUST_PRIVILEGES,&tokenHandle))
j=GetLastError();
if ( !AdjustTokenPrivileges(tokenHandle,FALSE,&tokenPriv,sizeof(TOKEN_PRIVILEGES) , (PTOKEN_PRIVILEGES) NULL, (PDWORD) NULL) )
j=GetLastError();
// Allocate virtual memory for ListView
LVITEM *_lvi=(LVITEM*)VirtualAllocEx(lView, NULL, sizeof(LVITEM),MEM_COMMIT, PAGE_READWRITE);
if (!VirtualQueryEx(lView,_lvi,&memBasicInfo,sizeof(MEMORY_BASIC_INFORMATION)))
j=GetLastError();
no errors are triggered, memBasicInfo returns the correct parameters, ie i have full access to the allocated memory. But if i follow it up by:
if (WriteProcessMemory(lView, _lvi, &lvi, sizeof(LVITEM),&byteCount))
j=GetLastError();
i still get error 5, but bytecount gives the correct count. I disabled the antivirus scanner, so it's not interfering
I am flabbergasted.
|
|
|
|
|
Why are you calling GetLastError on WriteprocessMemory success?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
the call doesn't complete..... The bytecount written is correct, but the memory addressed by the call stays empty.
Also in MSDN is stated that a Write call my fail whilst still returning no fail error code.
After doing a sendmessage LVM_GetItemState to listView, the call returns empty as well.
So the memory location seems to be inacessible, which is bizarre because i also have this:
lvi.pszText=_item;
WriteProcessMemory(lView, _lvi, &lvi, sizeof(LVITEM), NULL);
SendMessage(listView, LVM_GETITEMTEXT, NULL, (LPARAM)_lvi);
ReadProcessMemory(lView, _item, item, 512, NULL);
and that returns with the correct itemtext......
|
|
|
|
|
GetLastError() returns the last error that occurred, which didn't necessarily happen in the last function call. That is way it is called GetLastError() and not GetError().
You normally want to stop a sequence of operations at the first error, so you could and should structure your code like this:
result=callFunction1();
if (result==OK) result=callFunction2();
if (result==OK) result=callFunction3();
if (result!=OK) log("it went wrong; error = ", GetLastError());
|
|
|
|
|
tnx for the input, but the original code is spiked with GetLastErrors, took some out to shorten code for viewing.
|
|
|
|
|
Yeah, great. When the error handling code indicates some problem, show us fictitious code. Someone will make the right guess anyhow?
|
|
|
|
|
They must protect their brilliant code against industrial espionage, my friend.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
found it:
Microsoft Windows Vista and later. When a message is blocked by UIPI the last error, retrieved with GetLastError, is set to 5 (access denied).
took me a full week to discover this tidbit. Tnx MS
|
|
|
|
|
Good: tenacity wins, eventually.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I need help with a programto keep records and perform statistical analysis for a class of students.
the class has 40 students, there are 5 quizzes, and each student identified by a 4 digit student number
|
|
|
|
|
This is homework, the rules of the homework game, here, are:
- we don't do homework.
- Try to do some work yourself.
- If you're stuck, try harder.
- If point (3) did'n work for you, read carefully post guidelines [^] and then post in this forum.
[added]
Mr.Univoter deadlock on point (3).
[/added]
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
modified on Wednesday, April 29, 2009 12:44 PM
|
|
|
|
|
biggiant22000 wrote: I need help with a programto keep...
Change this to "program to" and you should be good to go. Thanks for allowing us to help.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi all,
I have written a CMS that uses the CHTMLEdView class as a HTML editor. The CMS also has a number of additional edit controls for things like a button name, a tooltip etc. When the CHTMLEdView has focus, and I click on one of the other Edit controls, then the cursor is hidden, which is a hassle for editting. When I then click on any of the other edit controls, the cursor re-appears, In other words, I always need to click two different edit controls after using the HTML editor before the cursor appears again. I have tried ShowCursor(TRUE) and ShowCaret() on the edit controls, but nothing seems to help. Has anybody got any ideas on the subject? Would be greatly appreciated.
Regards,
William
|
|
|
|
|
hi!
I want to use a C++ function which applies minimization on a math formula ( http://www.codecogs.com/d-ox/maths/optimization/nelder.php ) but I dont understand how to pass my formula as the first parameter.
There is even an example but I dont understand it...
double f(double *x) {
double r = sqrt(x[0] * x[0] + x[1] * x[1]);
return ABS(r) < 1E-12 ? 1 : sin(r) / r;
}
I dont know what's the unknown. "x"? "r"? Both?
My formula is: http://personal.telefonica.terra.es/web/episodio1/text3.gif
This is what I've made:
for (i=1;i<=numberOfAnchors;i++)
{
errorsquare+= pow( abs( x[i] - xestim + y[i] - yestim ) - distance[i] ) , 2 );
}
errorsquare=errorsquare/numberOfAnchors;
2 unknowns: "xestim" and "yestim".
My question is: how should I code/declare my formula so it is accepted by the C++ function ?
Thanks.
|
|
|
|
|
Well, supposing both your xestim and yestim are independent, you may rearrange your function such a way:
xestim -> z[0]
yestim -> z[1]
so that you'll get
double f (double * z)
{
errorsquare = 0.0;
for (i=1;i<=numberOfAnchors; i++)
{
errorsquare+= pow( abs( x[i] - z[0] + y[i] - z[1] ) - distance[i] ) , 2 );
}
return errorsquare;
}
Now you have the f parameter of the nelder function..
dim is 2 (as you may guess).
The starting simplex points p are up to you (you've to provide, as in the example a 2x3 array), like the eps value and the maxit .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks, Cpallini...
I guess u removed by mistake...
errorsquare=errorsquare/numberOfAnchors ;
)
|
|
|
|
|
Episodio1 wrote: I guess u removed by mistake...
Of course I forgot it, but you know, such a operation has no influence in finding minimum (you may drop it).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Cpallini, do you know about NelderMead algorithm?
Cause I dont know what initial points to use. I mean...
In that C++ function Points are 2x3 (3 points x-y).
But this function is payware, so I got this one: http://people.sc.fsu.edu/~burkardt/cpp_src/asa047/asa047.html
In this last one initial points are only 1x2, which I dont know what represents.
Code it's already running but I dont get valid points for any initial points.
EDIT: It's OK now. There would be 1 and only initial point. And it should be close to region in which I want to find a minimum. ^^
modified on Monday, April 27, 2009 7:10 PM
|
|
|
|
|