|
could you show me your coding of OnInitDialog Function?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
There is several way to terminate your thread. Let me suppose that you understand about synchronisation.
And also to make thing more easier,
define a static member variable of type: static BOOL m_endLoop for your dialog class CYourDLG;
and also define a static member of type: static CEvent m_EventExit for your dialog class CYourDLG.
in the CYourDLG::OnInit() function initialize m_endLoop=0; and call m_EventExit.SetEvent().
And in your function OnCancel and OnOk at before to exit, call
WaitForSingleObject(EventExit,INFINITE); and in the first line in those 2 functions set
m_endLoop =TRUE;
and now in your loop function that terminate the thread, inside the loop insert this code:
if(CYourDLG::m_endLoop==TRUE)
{
// first to some cleaning and close all opened file or whatelse
...........
//and call
CYourDLG::m_EventExit.SetEvent();
return 0;
}
================== BUT when your start the thread insert this line at the begin of the thread function
CYourDLG::m_EventExit.ResetEvent();
That is.
You will have no access violation.
This solution must help.
Let me know if you have more questions
Perre Kande
|
|
|
|
|
a_du wrote:
Actually i am not sur
How can you not know? You call AfxBeginThread() in one of two ways. One way creates a worker (has no message pump) thread. The other creates a UI (has a message pump) thread.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hello,
I think that you have a worker thread problem. Read here[^] about threads.
As stated in the article, you can kill your thread by calling ::TerminateThead((HANDLE)YourWinThreadObject); , but this is not safe, since your resources will not be cleaned up nicely...
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
See here for termination methods.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
is it normal that CEdit::SetSel(-1, -1); donnot erase my EditBox ?
from the MSDN, i read this :
void SetSel(
int nStartChar,
int nEndChar,
BOOL bNoScroll = FALSE
);
nStartChar
Specifies the starting position. If nStartChar is 0 and nEndChar is –1, all the
text in the edit control is selected. If nStartChar is –1, any current selection is removed.
i so thought that calling say m_peMyEdit->SetSel(-1, -1); (where m_peMyEdit is declaredas as a CEdit* and well initialized also) would clear the content of my Control.
should i feedback this to Microsoft ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
It does not clear the content of the control.
It removes the selection.
(e.g. if you press shift you can select chars in an edit control by pressing arrow keys) calling the setsel with -1 as startchar removes the selection... The text is still there completely, only any text that was 'selected', appears as normal now...
Hope this helps you,
Davy
|
|
|
|
|
effectively, now you say it, i realize i didn't read it right...
thanks a lot
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hi Tox,(Long time no see)
Why don't you use CEdit::SetWindowText("") for clearing the Edit Control
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
ThatsAlok wrote:
Hi Tox,(Long time no see)
yeah, i'm here, but with a lot of work, so no much time to be connected (moreover, our servers are still cuting off during the morning and the afternoon...).
ThatsAlok wrote:
Why don't you use CEdit::SetWindowText("") for clearing the Edit Control
yes, that's what i do, but i wondered why i could not do this actually...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
One of my article is waiting for you comment, hope you find some time for it from your busy Schedule. BOB and other already commented on it
here is link Article[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
|
there any wizard in MFC for creating a Windows Service?
If not, Please help me with a complete code for developing a Windows Service
I need it very much and immediately
|
|
|
|
|
Yes, assuming you're running VS 2003.
- Shift+Ctrl+N to invoke New Project dialog box
- Expand Visual C++ Projects folder
- Select ATL folder
- Select the ATL Project type
- Specify name and location
- Click enter
- When the ATL Project Wizard displays, select the Application Settings tab
- Specify Server type of Service
- Click Finish
Voila! You now have a service with the guts of communicating with the SCM and a worker thread done for you.
|
|
|
|
|
Check here[^]
<bold>- Nilesh
<italics>"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
Tank you very much for your Help.
But I need a Source code for crete and develop a Windows Service because
I`m not a professional programmer in VisualC++ and I do`nt have much information about Windows Service
|
|
|
|
|
|
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
Thank you for your help!
There is a good code in item "Five Steps to Writing Windows Services in C".
But some links are not enabled.(Such as "Listing 1, Listing 2, Figure 1, Figure 2"
I want to see this links and figures.What shude I do?
Please guide me immediately.
|
|
|
|
|
Hi,
How to get the sectors/clusters of a particular file?
I am working on Windows 2000.
Hoping to get a reply soon.
TIA.
regards,
Jahfer V P.
|
|
|
|
|
Hi Jahfer,
I think you just need to reach to cluster, then following function would let you know how many sectors are there in one cluster & bye info of sector.
BOOL GetDiskFreeSpace(
LPCTSTR lpRootPathName, // pointer to root path
LPDWORD lpSectorsPerCluster, // pointer to sectors per cluster
LPDWORD lpBytesPerSector, // pointer to bytes per sector
LPDWORD lpNumberOfFreeClusters,
// pointer to number of free clusters
LPDWORD lpTotalNumberOfClusters
// pointer to total number of clusters
);
Then you need to iterate for sectors.
Regards,
Sumit Kapoor
+91-98-990-59818(M) Delhi >> INDIA
sumit_kapoor1980@rediffmail.com
Never consider anything impossible before trying to solve that..---Sumit Kapoor---
|
|
|
|
|
I need to get the sectors/clustors of a file.
A file may be in contiguous sectors or may be scattered, on the disk. I want to get this sector information.
Jahfer V P.
|
|
|
|
|
I don't know it is fully possible or not with another API..
DeviceIOControl(). This API is used for similar type of work, even file related. Check MSDN for more detail.
I think it would be only help that I can do. Let me know if you get any direct method(by e-mail).
Regards,
Sumit Kapoor
+91-98-990-59818(M) Delhi >> INDIA
sumit_kapoor1980@rediffmail.com
Never consider anything impossible before trying to solve that..---Sumit Kapoor---
|
|
|
|
|
Because of the HAL, I think you'll need to create a device driver if you want that level of access.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Respected All
Regards!
I already sent my problem to the forums but no reply till now now i am going to explain a bit more my problem.
" I loaded a bitmap in the form of Electric Circuit from my VC++ program and that bit map has some Resistors and Voltage, when I execute the program the bitmap became load and voltage from battry came Randomly after every one second by settimer() function and according to voltage the current is calculated from V=IR formula , now i want that when current flow through the circuit(which is not real , here i just show on bitmap that current s flowing) exceeds from certain limit the Resistor(which is on bitmap)change his color to RED, GREEN etc at run time.plz help me while doing so.
Best wishes.
David
david
|
|
|
|