|
so as «_Superman_» suggested, you should not call EndDialog from other threads. Use PostMessage to send some user defined messages to your child dialog and call EndDialog() from that message handler.
|
|
|
|
|
|
Slightly off topic, but what is the child dialog doing while the secondary thread is reading the Excel file?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
its not a secondary thread the thread is inside of child dialog box and when thread the excel file and insert the value in listctrl of main dialog,this time the child dialog box is in hidden form and after the ending of file reading i pass the command to end the child dialog.
|
|
|
|
|
Le@rner wrote: its not a secondary thread...
Are you calling AfxBeginThread() , _beginthread() , or CreateThread() ?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
yes i start the thread tru AfxBeginThread
|
|
|
|
|
Then you do have a secondary thread.
Now that that's out of the way, why are you doing this? Your primary thread is already being blocked by the modal child dialog, so having a secondary thread is not buying you anything.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
hi all guy!
I have a textbox. I want to input multi language to this textbox. In Control panel, i select location:japan. In VC++6, i select UNICODE, However Textbox cannot display corect(Ex:input tamin language). Please help me!
|
|
|
|
|
It is most likely 1 of 2 things wrong.
You don't have the correct language packs installed on your system, so the character is unprintable, or it is not supported by the selected font.
If the character works elsewhere on your computer, like in Wordpad or web pages (excluding wikipedia because it often uses images) then this is not your problem.
The character can't fit into Unicode. Unicode only defines space for 65535 characters. Some characters are out of this range, character sets like UTF-x can go up to a bit over 1.1 million characters (limited by a standard in the case of UTF-8, not the limits of the encoding).
Visual studio provides a Multi-byte option, which I have not used which may be able to help your problem, however the Windows core is coded in Unicode.
Other than this, make sure you have the correct character in the string to begin with.
|
|
|
|
|
Hi,
In microsoft word, u can input multi language? I buid small application in C for Win(VC++6), when I set location as EN. I can input multi language. Textbox is displayed corect with language input. When I set location as Japan, Textbox cann't display corect(Ex:Tamin Language)
|
|
|
|
|
hi everybody
i want to make a tree in a listctrl..
but i don't know how
i search but i don't find something about that
help me Plz
sorry if my english isn't good
|
|
|
|
|
|
|
I use BackupRead() to back up a bunch of files. This function reads all the streams contained in each file, including security information.
When I try to restore the file with BackupWrite(), it writes the security info into the beginning of the main file stream so that when you open the file in Notepad, you see a bunch of garbage at the top of the file.
What am I supposed to do with the security stream in order to restore it properly?
What functions are involved?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I write a Win32 DLL for a MFC app. The DLL needs to show a modal dialog at some point. When I move the dialog, the underlying app doesn't repaint all controls; it repaints window borders, MDI client area, a bunch of control inside MDI windows, but NOT the client area of MDI windows. Here's a screenshot[^].
Spy++ shows that WM_NCPAINT, WM_ERASEBKG, and WM_PAINT are sent and that DC of WM_PAINT is 0 (!), which seems to be similar to this topic on CodeProject[^].
I'm a beginner and I more or less follow the explanation there (a custom control subclasses wrong control ID), but don't quite understand if my case is same and if yes, how I can use the info to solve the problem.
Other info: the host app is a third-party app and I don't have the sources; I think it's MFC, because when I move the mouse over them, it says "Wizards" the classes of MDI windows are 'AFX:something'. My primary goal is not to find a bug in the host app, but to solve the redrawing issue; I know it must be possible because there are many other plug-ins that display such dialogs and they somehow solved this. The app makes a synchronous call into the plug-in; everything happens in the same thread. The Win32 DLL embeds Python and the calls are actually made from Python via 'ctypes'; the dialog code is very basic and only uses a couple of API calls, which all seem to work OK (i.e. the dialog shows up and closes), except for the redrawing.
Please help?
Update: please disregards the note about DC = 0, I've just re-read the WM_PAINT specs and saw that this and the whole question I referred to were not relevant to my case. At all.
modified on Wednesday, March 2, 2011 3:44 PM
|
|
|
|
|
maybe try posting this in the Q&A section with the code from your dll...
|
|
|
|
|
I'd love to, but I think I'm already posting this in Q&A, am I not? I'm new here, so I don't really know
The code in the DLL uses basically two API calls: DialogBoxIndirectParam and then EndDialog in the dialog proc. This code seems to be OK, the dialog opens, with all the necessary flags, correctly accesses the param, correctly handles the messages, etc.
|
|
|
|
|
well this is the forum, so even though you can ask questions here its probably better (because its easier to read) to post questions with a good deal of code in the "Questions and Answers" section. in this case, i'd probably have to look at a bit of code to be able to help.
|
|
|
|
|
And the modal loop code goes like this (pseudocode):
m = MSG()
while not dialog.result:
GetMessage(&m)
if not CallMessageFilter(&m, 0)
TranslateMessage(&m)
DispatchMessage(&m)
I don't handle idle time here; but the modal loop in the DialogBox() does do this, I see the WM_ENTERIDLE messages it sends to the main window, so I don't think this could be the problem. The CallMessageFilter() is a later addition (rationale[^]); without it it doesn't work either.
|
|
|
|
|
If the app itself is causing the modal dialog to be shown (by calling dlg.DoModal(), say), then the simplest solution may be to call RedrawWindow() after dlg.DoModal() returns.
|
|
|
|
|
My DLL is non-MFC, so instead of DoModal I call Win32 functions from the DialogBox family (namely DialogBoxIndirectParam). (I suspected this MFC-Win32 relationship could be the cause, but I from what I learned about MFC message passing[^], I don't see why; and yes, maybe the article is old.) After the dialog closes, the app repaints itself correctly; it only exhibits the behavior when the dialog box is open. Moreover, there's no problem if I simply create a dialog without making it modal (e.g. with CreateDialogIndirectParam). But I need a kind of a modal loop here; I tried to write my own modal loop, but got the same problem.
I tried sending explicit RedrawWindow and/or InvalidateRect/UpdateWindow from within the modal loop (e.g. from the dialog proc on WM_WINDOWPOSCHANGED or other such notifications), but this doesn't help. I sometimes see the effect on the parts that do redraw already, they start to flick, but the problematic area doesn't update.
|
|
|
|
|
Hey
If i am right CreateProcess() function can't be used in this case, as Disk Defragmenter needs Admin privilages to open.
Please explain me how to do this.
Thanks in advance.
modified on Wednesday, March 2, 2011 6:36 PM
|
|
|
|
|
dipuks wrote: Now i want to disable the app controls when the Disk Defragmenter is OPEN and
then re-enable the app controls when Disk Defragmenter is CLOSED.
How to
do this?
Do you have a handle to the window?
dipuks wrote: I am using ShellExecute function to open the Disk Defragmenter. I can know when
the Disk Defragmenter is OPENED, but not when it's CLOSED. Is that true?
Look at the PROCESS_INFORMATION structure. Monitoring those handles or IDs should provide you this information.
dipuks wrote: If i am right CreateProcess() function can't be used in this case, as Disk
Defragmenter needs Admin privilages to open.
Can you use CreateProcessAsUser() or CreateProcessWithLogonW() ?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
|
Thank you guys.....i Did it!
|
|
|
|