|
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
|
|
|
|
|
u put the index of the image within the imagelist ... i guess if its a single image image list then use 0
"there is no spoon" biz stuff about me
|
|
|
|
|
I know the use of ShellExecuteEx to show the properties of one item.
It is all nice and handy but what about selecting and showing the properties of multiple files as in windows explorer?
The SHELLEXECUTEINFO lpFile field can only accept one path and I could not find anything about multiple files with ShellExecuteEx in MS documentation.
please help if you have any idea.
Thanks.
avivhal
|
|
|
|
|
I'm trying to create a push button such that when it's clicked on the text on the button changes and the button is depressed. If the button is clicked on again then it gets back to its original state.
Here's the code that I've written:
if(BM_CLICK)
{
//if button depressed return to original state
if(SendMessage(hwnd[ID_BUTTON_START], BM_GETSTATE, 0, 0) == BST_PUSHED)
{
SendMessage(hwnd[ID_BUTTON_START], BM_SETSTATE, 0, 0);
SetWindowText(hwnd[ID_BUTTON_START], TEXT("start"));
}
//else depress button and change button text
else
{
SendMessage(hwnd[ID_BUTTON_START], BM_SETSTATE,1 , 0);
SetWindowText(hwnd[ID_BUTTON_START], TEXT("Pause"));
}
}
My problem is that I can't get the button to get to it's original state. What am I doing wrong here?
|
|
|
|
|
Hi,
Take a CheckBox and set under the properties the 'Push-like' style and try:
void CMyProject::OnMyCheckBox()<br />
{<br />
m_bPushed = !m_bPushed;<br />
if(m_bPushed)<br />
GetDlgItem(IDC_CHECK_BTN)->SetWindowText(_T("Pause"));<br />
else<br />
GetDlgItem(IDC_CHECK_BTN)->SetWindowText(_T("Start"));<br />
}
Hope its helpful
P.
|
|
|
|