|
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
|
|
|
|
|
vasu wrote:
The SetItemText() method is returning true, but the treeitem is not updated and it is NULL
In this case, you have probably set the text for the wrong item ... check if the handle (childItem in your code) is really the good one. Be careful to the difference between Item index and handle.
~RaGE();
|
|
|
|
|
Hello,
First of all, I want to sorry about my terrible English.
Next, please show me the way to get the information of the printer.
Ex: When the user print his/her document (or anything else), my program catches this event and determining the total of printed pages for calculating cost.
If applicable, please give me the VC++ source code.
Thank you very much.
|
|
|
|
|
What kind of info do you want? Some information is harder to get then others.
Joel Lucsy (jjlucsy@ameritech.net)
|
|
|
|
|
I only want the total of printed pages.
Ex: My program will start automatically every time Windows loads. During the Windows session, when user print his/her documents, my program will show the total of printed pages and the total cost of them.
Here is an output example:
Print time: 12:22:00
Document: letter.doc
Cost per page: 5
Total page(s): 3
Total cost: 15
|
|
|
|
|
ok, I'm working in win32 here, no MFC, when trying to create a listview control in a class I get the following err:
First-chance exception in pool.exe (COMCTL32.DLL): 0xC0000005: Access Violation.
Now, this err is on Win98 with IE 5.01
the code works fine on WinXP with IE6
it errs right on CreateWindowEx().
I tried just starting a new win32 app and cutting n pasting the code to create the listview n it works fine on that Win98. So my question is what could be the problem, is it the class?
|
|
|
|
|