|
I found it...
I was looking at the item state, and didn't realize there was a GetCheck member function of CTreeCtrl. I knew it was going to be simple.
Later.
|
|
|
|
|
I have a dialog based application in which I have two sources of events
1) On Timer
2) On User input(such as click of button)
Now on both events I will be calling a function, which acts on a single resource.
Calling the function while it is already executing is dangerous & can corrupt all my data.
Now I want to know do I need to put any synchronization code (SingleLock etc.) in my function.
** The important point here is that I am not creating any threads explicitly.
So my assumption is that my app is single threaded. In such case my function can never be called (from anywhere else) while it is running.
Am I correct? Am I missing anything here?
Please help me.
|
|
|
|
|
Since you only have one thread, you need not worry.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
you might not need SingleLock, etc.. but if there's a chance you could end up going through the same function twice at the same time (especially if you're doing message pumping) you might need to use a flag at the top of any functions where this could be dangerous.
bool g_alreadyInFuncA = false;
void funcA()
{
if (g_alreadyInFuncA)
{
error? return early? crash?
}
g_alreadyInFuncA = true;
blah
blah
MessagePump...
blah
g_alreadyInFuncA = false;
}
void OnMyMessage()
{
funcA()
}
-c
I'm not the droid you're looking for.
|
|
|
|
|
Hi All,
I was wondering where I would find information on the techniques for debugging mutexes, semaphores, critical sections etc. I have a place in my code that blocks and locks the application. It appears to be happening randomly on a CSingleLock(&mymutex). How do I takle it and find out what the real problem is?
Cheers,
Clint
|
|
|
|
|
1. Are you 100% positive you are always unlocking your locks?
2. Do you have any deadly embraces in your locks. (i.e. thread #1 locks lock A then lock B while thread #2 locks lock B then lock A.)
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
As far as I know I don't have these problems. Would either problem cause random mutex lockups? I can see where #2 could potentially be the culprit as there looks like a race condition there.
Cheers,
Clint
|
|
|
|
|
Both examples cause lockups. The first because some thread never released the mutex. The second for the race condition you saw.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
It was a deadly embrace.
Thanks for you help.
Cheers,
Clint
|
|
|
|
|
hey guys
I have run into this problem now. In my application, I use FindWindow to search for a window with a specific title text. This is all fine as long as the language is english. But what do I do for non-english versions of Windows? One solution is to have a string table with the text for the title in various languages. But is there some easier simpler way to do this that I am not aware of?
Regards,
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Couldn't you ID the windows with an internal hard-coded (in english ) string ?
Max.
|
|
|
|
|
Maximilien wrote:
Couldn't you ID the windows with an internal hard-coded (in english ) string ?
Not a window created my me unfortunately. This is the IE save-as window. I am using a browser control in my dialog and using IE to save the html and all the reqd images. problem is I wanna automate this and I find the save as window, find the save button and send a click to it.
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
The IE Save As box does not save the page with images, it just saves the source HTML.
To save with images is quite an involved process, but basically what you have to do is this:
1. Open the page in your Web Browser control
2. Get the IHTMLDocument2 handle (using GetHtmlDocument)
3. Get a list of images from the IHTMLDocument2 (get_images)
4. iterate through each image:
a. Download the image to a file.
b. iterate through each IMG tag on the page, and if the
image is referenced in the HREF tag, modify the HREF
tag to point to your newly save file. (This comparison
is non trivial, because you have to connonicize both
filenames first.)
5. When you have rewritten the images, get the HTML text
from the IHTMLDocument2 and save it.
|
|
|
|
|
nde_plume wrote:
The IE Save As box does not save the page with images, it just saves the source HTML.
It does save images and style sheets and everything else, if you use ExecWB with OLECMDID_SAVEAS. Thanks for your suggestion though. If nothing else works I'll try that out I guess.
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Hi y'all I'm new here.
I've searched and searched and can't find an easy and seamless method of keeping my desktop and laptop email in sync that doesn't require an exchange server.
So I guess it looks like I have to write one myself.
Anyone got any comments, interest, warnings?
George
|
|
|
|
|
hi. i have an Empty Document of MFC (Demo). in this Document i design a Dialog box that is open beside the Document Windows. My Dialog have a Simple Edit Box. I Creat a Class From this Dialog (CDlg) and Add a Variable to this Class for that Edit box (m_str)
how can i change this Variable in my DemoView.cpp or for example Control that if a Button is Clicked on that Dialog. (i mean i want to Control that Dialog Remotly on my DemoView.cpp)
thanx
-=Ehsan-de-Burge=-
|
|
|
|
|
I think one method is to send your CDlg a user message from your DemoView.cpp.
|
|
|
|
|
I want to print a filled in triangle
that looks like |> squished together.
I want it to say
Total |>
and that triangle sort of points to
what the actual total is. Any ideas?
I couldn't find anything in ascii.
Please, any response any one can give
me will be greatly appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
according to the chart that MSDN shows, ASCII char #16 (0x10) looks like that (right-pointing arrow head)
-c
I'm not the droid you're looking for.
|
|
|
|
|
I tried lots of different things, but I keep
ketting carriage return!! How can I get the
symbol as a CString?
Please any response you can give me will be
greatly appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
How can i use a dialog from a thread ?
Code below doesn't work.
DWORD WINAPI s(LPVOID params)
{
CDialog d;
d.DoModal(); // ASSERT problem here
}
CreateThread(NULL,0,s,(LPVOID)this,0,&thID)));
|
|
|
|
|
If you are using MFC, then using MFC to create your thread, not WIN32.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
1. What does the ASSERT say?
2. Is the CDialog class really called "CDialog"? It should be a class derived from CDialog, not CDialog itself.
3. Have you thought of using a modeless dialog instead? It simulates a modal dialog box on a separate thread:
static CMyDialog s_dlg;
if (!::IsWindow(s_dlg.m_hWnd))
s_dlg.Create(CMyDialog::IDD);
s_dlg.ShowWindow(SW_SHOWNORMAL);
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
I've overriden WM_TIMER in my ListView class,and put SetTimer in OnInitUpdate(),but my WM_TIMER called only one time.Any idea?
::SetTimer(NULL,NULL,10000,NULL);
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
give ur timer an id
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|