|
Hi all .
I have handle of a window . How I can change background color of it .
Thanks .
|
|
|
|
|
I had problems with this long ago when trying to use a HWND. I'm sure its possible though.
The way I know of is to overide this;
Enjoy Colin
BOOL CSampleView::OnEraseBkgnd(CDC* pDC)
{
// Set brush to desired background color.
CBrush backBrush(RGB(255, 128, 128));
// Save old brush.
CBrush* pOldBrush = pDC->SelectObject(&backBrush);
CRect rect;
pDC->GetClipBox(&rect); // Erase the area needed.
pDC->PatBlt(rect.left, rect.top, rect.Width(),
rect.Height(), PATCOPY);
pDC->SelectObject(pOldBrush);
return TRUE;
}
|
|
|
|
|
Thanks for your notice . My problem is that I have only a handle of that window and no it's class . I find its handle with FindWindow API then I can't use OnEraseBkgnd method .
|
|
|
|
|
Follow the sequence
Startup->programs->NortonAntivirus
How to delete Norton antivirus item from Program list?
|
|
|
|
|
Arul Joseph wrote: How to delete Norton antivirus item from Program list?
Right click on "NortonAntivirus" and select Delete from the context menu.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
How to delete the icon from TaskBar Permenantly? for example Mcafee virus is opened? The Virus Icon is displayed in the Tray of the Task bar.
|
|
|
|
|
Go to the program's settings and uncheck the box that says "show tray icon in taskbar" or whatever.
Another way is to uninstall Mcafee
Mark
|
|
|
|
|
hi,
I have created a active x control using MFC.
i want to know how to set or create a property page for a activex control created using MFC.
zari
|
|
|
|
|
My GUI looks not good, what can i do for looking some flashy or classical looks?
|
|
|
|
|
Use picture in background of your wins.
|
|
|
|
|
Hi
In my program, i use read/write mode for file operation. But it not working properly. Code as follows
fstream f("temp.txt",ios::app | ios::in )
kindly help
thanks
KK
|
|
|
|
|
kk.in wrote: But it not working properly
Fine, and we are supposed to guess what is going wrong ? And what you are expecting ?
kk.in wrote: ios::app | ios::in
You know that you will only be able to read the file (and I don't know why you used ios::app here, this is only usefull when writing to the file).
|
|
|
|
|
Hi
The real problem is
I have a text file with some data, I want to edit data from a particular position,it without using temperory file. I try to edit the data and it will added to end of the file ?
thanx
KK
|
|
|
|
|
You need to use the ios::out flag if you want to write something to the file (otherwise it is read-only)
kk.in wrote: I have a text file with some data, I want to edit data from a particular position,it without using temperory file.
You can't do that, you cannot insert data at a certain position (only write on it but you won't be able to insert extra characters).
|
|
|
|
|
kk.in wrote: I have a text file with some data, I want to edit data from a particular position,it without using temperory file.
While you can certainly change text (e.g., replace dog with cat)without using a temporary file, you cannot make the file any smaller/larger without using a temporary file (there are a few exceptions to this).
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
i think you need to use fstream f("temp.txt",ios::out | ios::in ), then it will work i think
mpk1979
|
|
|
|
|
I started a thread to perform some decoding function. This is to circumvent the problem of the windows not being able to be updated while the decoding is in progress. The code runs perfect for the first run i.e. it went through the file selection process to the completion of the decoding process.
However, when I want to decode a second file, an assetion failure occurred during or start of the decoding process. I narrowed down the bug to the 'decode' function in the thread function. Everything runs well second or third time with it commented.
Now I know that it is this function causing the problem. This piece of function was running fine when separately called and I went through it many times.
Appreciate if you could give advise on this issue. Any comment will be good.
Snippets of my code:
completed=false;
AfxBeginThread(DecodeThreadProc,pfilename,THREAD_PRIORITY_NORMAL,0,0,NULL);
while(!completed)
{
// Perform the windows update.
}
UINT DecodeThreadProc(LPVOID Paramfilename)
{
decode((char *)Paramfilename);
completed=true;
return 0;
}
searcher08
|
|
|
|
|
pFileName passed in to AfxBeinThreadProc must remain constant the entire time the thread is using the variable.
I suspect it might have been local to some other function calling AfxBeginthread, so you got into trouble there - it was invalid by the time the thread executed and tried to read it.
Any sufficiently gross incompetence is nearly indistinguishable from malice.
|
|
|
|
|
Thanks.
The pFileName was not amended by any function after the AfxBeginThread was called. Can I amend it in the Thread program.
I also noticed from the Memory usage monitor that the some memory was not released after the thread ended. I checked the code for errors in freeing pointers and there was no issue. Is there any way of releasing any memory used by the thread?
The thread was running fine for the first time. The problem only arises when it was loaded the second time.
|
|
|
|
|
It does not matter if pFileNAme is amended or not, I was concerned its lifetime did not outlast the thread.
Depending upon how a thread is called, especially in MFC, you might need to delete the CWinThread object after the thread has terminated, unless you set it to automatically delete itself.
Any sufficiently gross incompetence is nearly indistinguishable from malice.
|
|
|
|
|
I did not do anything to the object. From the MSDN, I understand there is no requirement to end the thread as long as it is completed normally. I will heed your advise and proceed with the delete of the CWinThread Object.
Is this what it is suppose to look like?
CWinThread* ThreadHD = AfxBeginThread(DecodeThreadProc,pfilename,THREAD_PRIORITY_NORMAL,0,0,NULL);
delete(ThreadHD);
ThreadHD=NULL;
Many thanks for your advise. Greatly appreciated!
|
|
|
|
|
Yes, unless you set the auto delete member function.
This is safer...
CWinThread* ThreadHD = AfxBeginThread(DecodeThreadProc,pfilename,THREAD_PRIORITY_NORMAL,0,CREATE_SUSPENDED,NULL);<br />
<br />
ThreadHD->m_bAutoDelete = TRUE;<br />
ThreadHD->ResumeThread();
This way, you don't have to wait for thread to exit before deleting ThreadHD yourself.
Any sufficiently gross incompetence is nearly indistinguishable from malice.
|
|
|
|
|
I tried the method as advised. However, an error occurred at the delete(ThreadHD) line. I think that if the thread has exited, there should not be a need to delete it. Please advise. Thanks.
CWinThread* ThreadHD = AfxBeginThread(DecodeThreadProc,pfilename,THREAD_PRIORITY_NORMAL,0,CREATE_SUSPENDED,NULL);
ThreadHD->m_bAutoDelete = TRUE;
ThreadHD->ResumeThread();
.
.
.
delete(ThreadHD);
ThreadHead=NULL;
|
|
|
|
|
The ThreadHD will delete itself! So you don't have to do it, that is why you got the assertion.
You only need these lines...
CWinThread* ThreadHD = AfxBeginThread(DecodeThreadProc,pfilename,THREAD_PRIORITY_NORMAL,0,CREATE_SUSPENDED,NULL);
// m_bAutoDelete = TRUE allows a CWinThread to delete itself when the thread function exits
ThreadHD->m_bAutoDelete = TRUE;
ThreadHD->ResumeThread();
and REMOVE these lines from your code and the assertion will be gone...
delete(ThreadHD);
ThreadHead=NULL;
Any sufficiently gross incompetence is nearly indistinguishable from malice.
|
|
|
|