|
See this[^]from Microsoft.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
Hi
In the code bottom I want to create a new dialog box when a condition is provided.But it failed.It is possible to create a new dialog box in a thread?If it is possible how can I do that.Thanks for your help.
UINT threading(LPVOID p)
{
CMyClass * me = (CMyClass *)p;
if(something happen)
me->threading();
return 0;
}
void CMyClass::threading()
{
CDlg *dlg = new CDlg;
dlg->Create(IDD_DIALOG2,this);
dlg->ShowWindow(SW_SHOW);
}
|
|
|
|
|
iayd wrote: But it failed.
How do you know it failed?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
It locked all windows and did not create the new dialog box properly.(But I should tell that I am writing the code for a Palm Pc with embedded visual C++)
|
|
|
|
|
Are you running a message pump in the thread?
Steve
|
|
|
|
|
No.There was not any problem before I tried to create a new dialog box in CMyClass::Threading method.I wonder that can I create a new dialog box in a thread?
|
|
|
|
|
Hello All,
I have to take back-up of a file which is either of word, text or excel etc and which is already exists.
For example: suppose there is a file which have 4 lines of text today and anybody came tomorrow and open this file writing something in this file and does not save this but my application is able to take backup of this file data which is already saved.
How it is possible because I am getting only one method which is like read the contents of the file and write it into another file but it falls down the performance of my application.
if anybody have idea how can I achieve this please share with me its very urgent.
|
|
|
|
|
Hello,
i have a question about speed between this two objects, vectors and maps(CMap, CMapStringToOb, ...).
For example, for searching an loop(and sort, search etc.), what of them is faster?
What of them to prefer, what to use if i need to store many data(class)?
Any sugestion what to use?
thanks for answers
termal
|
|
|
|
|
don't confuse, vectors and maps are fundamentally different.
vectors are dynamic arrays (in the basic meaning), when maps are associative array, in the sense that you have a unique key, and a value associated to it...
|
|
|
|
|
|
Hello,
thanks for reply!
termal
|
|
|
|
|
I just post a message about this question Link but I don't obtain a good answer...
I need to manage a Progress Bar created into my man app from a thread (while my app is using an ActiveX control).
How can I do this?
I must use a timer to increment the progress, but I can't use the CWnd::setTimer why my CThread class is derived from CWinThread an not from Cwnd, so how can I manage the Timer?
Thanks for every observation.
|
|
|
|
|
Well, you can use SetTimer function of global namespace (passing NULL as HWND and a valid callback function pointer). But then, how do you communicate with the progress bar?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Thanks for the reply, I use SetTimer function you said but now my main problem is just how to comunicate with the pregress??
It's a global variable of my app, but can I access and use it from the thread?
It's seems NO because nothing is performed by code that must increment it!!
SO HOW DO THIS?
|
|
|
|
|
I suggest to you to post a message to the Application Window Thread (you can pass the application window HANDLE to your secondary thread whenever you create it) and let it (the Application Window Thread) do the updating job for you.
P.S. Maybe the overall design is wrong: probably would be better to create a window in the secondary thread and build the progress bar in that context.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Or you could use a simple Object Oriented solution like this[^]
led mike
|
|
|
|
|
Oh, I see..., he is going round and around forums to remain stick in his original design...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
I try to explain well my problem.. In my MainWnd I use an ActiveX control (a REprot Viewer) that need time to compute his job (load report) and I need the increment the progress bar while it's computing.
I can't set a timer to update the progress bar in the MainWnd (as said here) because while the activeX is working the Timer event is not processed.
If the solution you suggest work, I don't need the MyThread but I can manage directly the progress in the MainWnd, but it's wrong.
I hope to explain well my problem, and because I use this solution.
Thanks
|
|
|
|
|
I'm totally lost (or you are ) (I've been following all the threads on this topic).
If your ActiveX control is busy processing stuff on the app's main thread, and your progress
dialog/control was created on that same thread, then the progress dlg/control cannot process
any window messages because your activex control has control of the thread so the thread's
message loop isn't being processed.
So, it seems to me you have two options -
1) Put the activeX control on another thread so the main thread can process window messages as
usual (it can also process your timer messages)
2) Put the progress dialog on a separate thread and process all it's messages, including timer
messages, on that thread. That way the ActiveX control can go about its business.
Both these have been recommended to you several times. Try one!
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
It all started here[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Thanks a lot for the reply, I just see your past reply but I will see if somebody can give me a solution for don't use another dialog (with progressbar).
|
|
|
|
|
Hello,
I am trying to resize a GetOpenFilename dialog box, so that it appears larger than standard, so you can see more files in the dialog.
I have succesfully hooked for notifications with OFN_HookProc.
I can execute code on WM_InitDialog.
I have tried using the SetWindowPos function, but specifying a new size for the dialog box leaves all the controls in the same place and makes the window bigger, in order to add more controls to the form.
But what I want to do is stretch the dialog, just as the user would do by grabbing the corner of the windows. I don't want to add more controls, I want to make the control on the existing forms resize too.
Any idea how I do this ?
Thanks for any help.
Steve
|
|
|
|
|
IMHO you have to reposition the controls by code.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hi ,
i tried one sample program from Code Projet , I resized the CFileDialog size in File Save dilog , the same size will appear for remaing dialog ,
i want the default size back ..
plz help
hh
|
|
|
|
|
Sorry, I lost my magic stick. So, today will you point out the article with a link?
|
|
|
|