|
try overriding the WM_ERASEBKGND message with an empty function.
The default operation of the framework is to clear the window with its background colour when this message is recieved, which is probably what's causing the nasty flickering
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
thanks, but thats not that kind of flickering, I already override the erase bg the problem is that windows scroll the DC and thats what I want to prevent.
thanks anyway.
BishGada.
|
|
|
|
|
hi,
what method do you use to terminate a thread?
i am in a situation that after few thousands of restart a thread? it failed for me to create thread for me with AfxBeginThread().
i used TerminateThread() to terminate thread from the main program, in msdn, it is not a good method to terminate a thread.
i guess it leads to the problem that i can't create thread when restart.
do you have any good method to terminate thread?
thanks,
jim
|
|
|
|
|
You can usually end your thread from within the thread with Afxenthread(); If you want to do that remotedely from outside the thread, just use an event to tell your thread to end.
~RaGE();
|
|
|
|
|
hi,
i found that the thread would not terminate immediately after call AfxEndThread(). since i used TerminateThread() to terminate another thread at the same time, so i can observe such difference.
is it normal?
thanks,
jim
|
|
|
|
|
|
There are couple of ways to terminate thread safely based on the problem
here is the event approach,
- CreateEvent() (named event to use across process'es)
- CreateThread (or AfxBEginThread) and pass event as Thread Param
- Keep listening to Event Signaling at application atomic times (WaitForSingleObject).
- when Event is signaled or job is done, just return (use AfxEndThread() with AfxBeginThread() - MFC way)
From main/any thread signal the event, when u want to stop the thread safely.
To brutally kill the thread use: TerminateThread()
Refer to samples in codeproject.com OR codeguru.com.
Hth,
Ramu
|
|
|
|
|
Ramu,
thank you! your information is so useful.
currently, i am using a TerminateThread() to kill a thread.
due to some reasons, i need to restart the threads few mins once. after few days running, it failed to to create thread with AfxBeginThread(). i doubted that related to using TerminateThread() to kill a thread. so, i am trying other methods.
anyway, your information is useful and let me check with it!
thanks,
jim
|
|
|
|
|
does anyone know how can i use the MFC'S CBitmapButton?
thanx
|
|
|
|
|
CBitMapButton myBitMapButton;
You are now using CBitMapButton. You didn't say what you wanted to do with it, but there are only 2 methods, so it can't be hard to figure out. Look up CBitMapButton in MSDN.
http://msdn.microsoft.com/
|
|
|
|
|
I'm working with a class(CSizingControlBar, or CSCBar) derived from CControlBar, and I want to place CSCBar at a MDI's child Frame, such as the main view window. But these CSCBars can be placed anywhere of the screen, i don't like it. i want to the SCBBar behave like the child Dialog.
how to realize? thank you. ;)
Best Regards!
|
|
|
|
|
Hi
Is it possible to start windows application like Notepad.exe or Calc.exe in my mdi-program?
I want the exe-application opened like normal MDI document im the MDI program window.
If this is possible please show example!
JK
|
|
|
|
|
|
Does anybody here use InstallShield ? (for VisualStudio 6.0)
I need to set up registry value, which is longer than 255 characters, but compiler writes error : string literal exceeds 255 characters (althought in help is written than STRING limit is 512 chars for 16-bit setups and 1024 chars for 32 bit) . How to writre longer string ?
Thanks
rrrado
|
|
|
|
|
solved
x = "aaaaaaaa" (<255 chars)
x = x ^ "aaaaaa" (<255 chars)
InstallShield seems to be stupid.........
rrrado
|
|
|
|
|
I have a little mfc dialog based application.
Some text in this dialog uses a diameter sign.
Font Arial, ASCII value 216 -> printf("\330")
Everything works fine under Windows NT 4 english but not under Windows 98 traditional chinese.
Can anybody help me??
Thanks
Martin
|
|
|
|
|
I want to add in the standard help file for my VB/VC++ application. Any VB6.0/VC++6.0 built-in tools can be used for this purpose? If not, any alternative can I choose?
Thanks
DJ
|
|
|
|
|
You can use Microsoft Help Workshop
Look under this folder:-
%Program Files%\Microsoft Visual Studio .NET\Common7\Tools
Filename :- hcw.exe
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
|
|
|
|
|
Thanks alot. But I am using VB6.0 or VC++6.0.
any more ideas?
DJ
|
|
|
|
|
DengJW wrote:
Thanks alot. But I am using VB6.0 or VC++6.0.
any more ideas?
In that case look for a slightly older version of the same file under :-
%Program Files%\Microsoft Visual Studio\Common\Tools
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
|
|
|
|
|
|
hi
i have wrote a function in vc++ not to allow any special characters in flex grid except alphabets &"_".
but if the shift key is pressed and the other keys are pressed it is allowing the special characters.(foe eg '@','#','$')
can u please suggest what is wrong with this code and clear my doubt.
yours friendly
magesh.s
BOOL CCharacterEdit::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->hwnd != NULL && pMsg->message == WM_KEYDOWN)
{
WORD ch =0;
ch = LOWORD(pMsg->wParam);
EnableEditOptions(this,pMsg);
if( !(GetStyle() & ES_NUMBER))
{
CString sEdText;
GetWindowText(sEdText);
if ( ( ( ch >= 48 ) && ( ch <= 57 ) ) ||
( ( ch >= 65 ) && ( ch <= 90 ) ) || // ascii code To allow only alphabets & '_'
( ( ch >= 97 ) && ( ch <= 122) ) ||
( ch == 45 )
);
else if( (ch >= VK_LEFT && ch <= VK_DOWN) || (ch == VK_BACK || ch == VK_DELETE|| ch==VK_TAB))
return FALSE; // allow arrow keys and backspace.
else
{
pMsg->wParam = MAKEWPARAM(0,HIWORD(pMsg->wParam));//make the char value as 0
TRACE("\n After changing char = %d ",pMsg->wParam);
}
}
}
return GetParent()->PreTranslateMessage(pMsg);
}
magesh.s
|
|
|
|
|
How can I get info about printer paper tray alignment under W2k, XP ? It was possible to do it (Win98, 95, ME) using DeviceCapabilities with DC_BINADJUST parameter, but this one is now not supported. I need to know it when printing on custom-size paper to set starting offset.
Thanks
LK
|
|
|
|
|
What Is the Best Way of automating legacy Applications ? I know hooking , Tried to record the windows messages and playing then back. But It has some limitatons ..is there any other nice solution ? My Legacy applications are Windows based applications.
VIKS
|
|
|
|
|
Hi,
I have a tree control and I am handling in place edit by overriding the methods OnBeginLabelEdit() and OnEndLabelEdit(). Before editing, I am storing the current name in a member variable "m_strPrevName". While editing, when I press Esc key, I am setting the previous name as shown below.
CMyTreeCtrl::OnEndLabelEdit(NMHDR* NMHDR, LRESULT* Result)
{
if (pTVDispInfo->item.pszText == NULL)
{
// yes. User pressed Esc key. Set the previous name
SetItemText(childItem, m_strPrevName);
*Result = 1;
}
}
The SetItemText() method is returning true, but the treeitem is not updated and it is NULL. How can I set the previous name??
sreenivas
|
|
|
|