|
J.B. wrote:
I have stumped through something that I think should be easy to do, but yet to make it work. Basically, I have a plan edit control (CEdit) which I want to make it un-editable, no text, space etc can be put it. The content will only be changeable by the app internally, using SetWindowText().
Then why not just use a static control? It satisfies all of your requirements.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Mr.Crow if you dont me mind saying that you shuold give a proper ans or nothing at all. Do you know that you cant have scrolling effect with the static control, Or horizontal scrolling with the static control. What if he just wants to display some long text that can only be viewed and not edited?? Did you consider this? or were you giving with some unwanted suggestion?
Any ways the solution to the problem is checking the Read-only in Styles of the edit box.
"When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
|
|
|
|
|
Goodness gracious, someone woke up on the wrong side of the bed this morning! Are you always so tactfulless on Thursdays?
Did you know that using the ES_READONLY style also has the side effect of graying the edit control? I suppose that's just as incorrect as my answer. Yes?
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Now, now, chaps. Let's have some decorum in here. Anyone would think you were all Java developers*
One possible solution is to use ES_READONLY, but handle the WM_CTLCOLORSTATIC message in the dialog, (or the reflection of it, in the control). The edit control sends this message, rather than WM_CTLCOLOREDIT, if it is either disabled, or read-only.
You could then return an appropriate HBRUSH value to change the grey/gray background accordingly.
Steve S
*Please, no flames about Java. I've just been told who my new line manager is, and he's an anti-MS pro-Java pro-linux man. Given that I work mainly in C++ using ATL on COM+ components, life is about to get more interesting, unless I find an alternative form of employment
|
|
|
|
|
ok what ever you think.
"When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
|
|
|
|
|
I think you'll find it much easier to make the control read-only and handle the drawing of the edit control to make it look like it's a non-read-only control. Handle WM_CTLCOLORSTATIC and do something like this:
LRESULT CMyDlg::OnCtlColorStatic
(WPARAM wParam, LPARAM lParam)
{
HDC hDC = (HDC)wParam;
HWND hwndCtl = (HWND) lParam;
UINT uCtrlId = ::GetDlgCtrlID (hwndCtl);
if (uCtrlId == IDC_MY_EDIT) {
CDC *pDC = CDC::FromHandle (hDC);
pDC->SetBkColor (RGB (255, 255, 255));
return (LRESULT) (HBRUSH) m_brushBkg.GetSafeHandle();
}
return Default();
} Of course, you should use GetSysColor() instead of the hardcoded constant RGB (255,255,255). You'll also need to create/destroy the background CBrush within your dialog.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Thanks Ravi, and the other guys who have posted to help,
really appreciate it.
Ravi's suggested method seems to work for my needs for now. In addition to the original codes, I also have to re-initialise the brush. Without doing that, the area that is outside the text rectangle area (depends on the font size that is set) will be all in black.
LRESULT MyDlg::OnCtlColorStatic(WPARAM wParam, LPARAM lParam)
{
HDC hDC = (HDC)wParam;
HWND hwndCtl = (HWND) lParam;
UINT uCtrlId = ::GetDlgCtrlID (hwndCtl);
m_brushBkg.DeleteObject();
m_brushBkg.CreateSolidBrush(RGB (255, 255, 255));
if (uCtrlId == IDC_LABEL_DISPLAY) {
CDC *pDC = CDC::FromHandle (hDC);
pDC->SetBkColor (RGB (255, 255, 255));
return (LRESULT) (HBRUSH) m_brushBkg.GetSafeHandle();
}
return Default();
}
|
|
|
|
|
I think you're better off creating/deleting m_brushBkg just once (outside the handler). That would be more efficient.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Thank you Ravi,
for this further suggestion.
Cheers
|
|
|
|
|
Hello
I want to create a small and simple AVI animation to be used by the CAnimateCtrl in a dialog. I have created the series of bitmaps that I want to use, but I can't find a small and simple tool (preferrably free since this is a one time problem) that does the job.
Since the dawn of DivX the web is bloated with information on AVIs that is useless for this simple job, and all the old postings I have found is from the mid-90's and I can't find the tools.
I have tried the CAVI32 program, but it changes the pink background to white, which makes all my whites transparent (with the effect ov having gray papers floating through the air).
Does anybody have a suggestion?
|
|
|
|
|
If you're using XP there's the included "Windows Movie Maker" which seems to let me put BMPs into the video timeline. Tried that?
|
|
|
|
|
The standard interfaces for soundcards (waveIO, DirectSound) only offer limited functionality (e.g. enumerating capabilities - sampling frequencies only enumerated up to 44k, or enabling the digital loopback that most cards offer)
Are there any other general/quasi-standard API's, or stuff for individual soundcards? Am I missing any?
Peter
Flirt harder, I'm a Coder
mlog || Agile Programming | doxygen
|
|
|
|
|
Well if you want to further down then i guess Createfile, writefile, and apis related to that is ur answer, For this i believe you need to know the specification of the Sound card that you intend to program.
Regards. "When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
|
|
|
|
|
Hi.
I'm having some troble overriding the HyperLink function in CHtmlEditCtrl.
In what format am I supposed to have my URL that I send into the Hyperlink function?
I've tried with http://www.bla.com
and some variations but it won't accept them, and I don't want to use the auto dialog for adding a link, I wan't to make my own. But then I have to know how to format the LPCTSTR correct.
Anyone who can help me?
Thanks in advance...
/Markus
|
|
|
|
|
I have developing over microsoft platform from the past 3 years. I am quiet a bit stucked in a task, which I would like to discusss with you.
Problem:
1)Read any .exe created on the microsoft platform using File IO operation
2)Store in in a buffer
3)Execute it from the bufffer
4) We donot have the option of writing this buffer to a file and then
execute it. The requirement is to run the executable in the buffer. i.e we cannot use shell commands like ShellExecute, Execv etc.
How do we go about it...? ) It appears to me that asking this question is like runnign a program
for which you may not have the valid permissions or for which you dont
want to leave any trace in the system logs about the file creation. but .. thats just my guess
Hope to see reply soon from forum people
Sincerest Regard's
Imran A. Baset
Imran A. Baset
|
|
|
|
|
Imran Abdul Baset wrote:
How do we go about it...?
You can't.
If the data already exists as a file, why bother reading it into a buffer? It's an EXE, so run it!
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
You can't. The EXE that starts a process must be on disk, because the OS loader uses the memory-mapped file APIs to get the contents of the EXE into memory.
And besides, if you could do what you're suggesting, how would the code in the buffer execute? Each EXE has its own process space.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
If my rhyme was a drug, I'd sell it by the gram.
|
|
|
|
|
I dont think any proper design of any software wants to do what you are looking for... Except you want to do what the operating system wants to do i.e first step towards writing a virus.
"When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
|
|
|
|
|
Didn't try it myself (and honestly don't see a need for that, creating temp file should work), but here is an idea.
You probably will need to use native api and repeat the steps the OS doing.
Look at ZwCreateSection (create pagefile backed section, map it, write you data there), ZwCreateProcess or NtCreateProcess, NtCreateThread... + some initialization.
The main problem here is the lack of documentation.
How the CreateProcess works:
http://www.microsoft.com/mspress/books/sampchap/4354a.asp
Or you can try to call CreateProcess and by hooking ZwCreateSection and ZwMapViewOfSection trick it into initializaing and executing executing the code in you buffer
Edward
|
|
|
|
|
I do as following:
Why not work?
>code>
HBRUSH cWaitDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// Create a hollow brush used in making static controls transparent
//Transparent static:
if( CTLCOLOR_STATIC == nCtlColor )
{
hbr = (HBRUSH)GetStockObject( HOLLOW_BRUSH );
pDC->SetBkMode( TRANSPARENT );
}
else //PROGRESS --???????? is not
if(pWnd->GetDlgCtrlID() == IDC_PROGRESS_BISY)
{
hbr = (HBRUSH)GetStockObject( HOLLOW_BRUSH );
pDC->SetBkMode( TRANSPARENT );
}
else
{
hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
}
return hbr;
}
thanks
|
|
|
|
|
What part of the progress bad do you want to make it transparent, its quite transparent already rite ?
"When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
|
|
|
|
|
Progress usually has just same background as
dialog,
but if drawn myself backgrounf of dialog,
I need to make Progress transparent "really".
that's what is need.
|
|
|
|
|
Is it possible to change the bitmap used by a button in the toolbar? I've had a look and it seems the Toolbar bitmap is made out of each of the button bitmaps, but I can't see how to change it during run time for an individual button.
Am I being stupid? Thanks for any help.
Cheers,
Ali
|
|
|
|
|
Use CToolBar::LoadBitmap() to load the toolbar bitmap and CToolBar::SetButtonInfo() to set index in the toolbar bitmap, which points to desired image.
Robert-Antonio
Love, truth and electric traction must gain victory over hate, lie
and diesel traction.
|
|
|
|
|
Thank you for taking the time to help me - at least now I've got a starting point .
I've looked at SetButtonInfo() and that seems to be the right direction to go in. I added it to the OnUpdate handler for the button like this:-
void CMainFrame::OnUpdateButtonModLevel(CCmdUI* pCmdUI) <br />
{<br />
UNREFERENCED_PARAMETER(pCmdUI);<br />
m_wndToolBar.SetButtonInfo(9, ID_BUTTON_MOD_LEVEL, TBBS_BUTTON, IDB_BITMAP_DOWN_ARROW );<br />
<br />
}
I'm definitely on the right lines because now the button is blank!
I think it maybe the last parameter that I've got wrong, the help says "New index for the button’s image within the bitmap." What I've put in is the ID of the bitmap.
Or perhaps I've put the code in the wrong place.
I'll keep trying, any ideas appreciated.
Thanks again.
Ali
|
|
|
|