|
Yes, for the mapping of the message handler. The handler itself can be anywhere just like any other class method.
"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
|
|
|
|
|
The problems mentioned were a result of using SendMessage. You usually use PostMessage when communicating from a worker thread to a GUI thread. PostMessage does not pause the worker thread.
Also, <pet peeve alert>, use WM_APP as the base for your internal messages, not WM_USER. WM_USER is used internally by some controls - may not bite you, but it may if you're doing "interesting" stuff with some of your controls. </pet peeve alert>
Judy
|
|
|
|
|
Your handler method should have the following prototype:
LRESULT OnMyMessage(WPARAM wp, LPARAM lp);
*EDIT* Never mind. I see you have the right prototype but you're trying to handle a window message in the app class.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
yeah, i'm not fully understand the message stuff yet, but i know that I should touch the GUI object from worker thread because the GUI object send some message to the parent thread and parent thread is blocked somehow and DEADLOCK.
that's why i implemented the message in the app class or the dialog class.
tell me if i'm misunderstanding
|
|
|
|
|
alberthyc wrote: because the GUI object send some message to the parent thread
It posts a thread message or sends (or posts) a window message?
It's important to differentiate the target of the message and whether it's being sent or posted.
If you have a worker thread that needs to get a message to a window, you should use PostMessage();
That message should be received in the window class.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
thx, that's pretty clear now
|
|
|
|
|
Hi all,
I am writing a program that has a dialog box with a logging window. Since the dialog is resizeable, I want my text to wrap. However, I do not want to use the windows wrapping, since I indent certain lines, and the indentation should be kept for the wrapped parts of the lines.
I am currently using the following code for this:
CDC * pDC = m_ctrlLog.getDC ();
CSize Size = pDC->GetTextExtent (m_strLine); // the line that needs to be displayed
m_ctrlLog.GetClientRect (&Rect);
pDC->DPtoLP (&Rect);
m_ctrlLog.ReleaseDC (pDC);
if (Size.cx > Rect.right) // we need to wrap
-------------------------------------
However, this does not do the job! If I let the font be the default font, then it starts wrapping much too soon. If I set the font to Courier (which I do, since I am working with 3 letter tags that then get nicely lined-up) then it starts wrapping when the line already exceeds the windows width by some 12 characters. I think it has to do with the units that are used in the different routines, but I do not seem to be able to get this right!
Anybody any bright ideas please?
Thanks in advance,
William
|
|
|
|
|
|
Hi,
I am writing few programs which generate some data that needs to be plotted. I am currently using MS EXCEL to plot the graphs. I would like to know if there is a way to call the EXCEL application from C++ programs and make them generate the plots. I heard that using DLLs and Marcos its possible I dont know much about it. so can anyone help me.... pls
I am a new to this subject and any kind of help would be very much appreciated
Jyothi
|
|
|
|
|
What you mean by calling excel application from c++ ?
you mean the Excel activex control ? It is possible create excel activex.
If u can Dream... U can do it
|
|
|
|
|
Hi,
I am writing few programs which generate some data that needs to be plotted. I am currently using MS EXCEL to plot the graphs. I would like to know if there is a way to call the EXCEL application from C++ programs and make them generate the plots. I heard that using DLLs and Marcos its possible I dont know much abou t it. so can anyone help me.... pls
I am a new to this subject and any kind of help would be very much appreciated
Jyothi
|
|
|
|
|
Hi Jyothi,
I am not quite sure about excel, but I know that it is possible to control word and outlook from a C++ program, using what is called "office automation". In the directory where the Excel executable is stored, you should look for a file called "Excel9.olb" If you can find this, then you can import it in your Studio environment, which will give you all the functions you need to control excel. You will need to look for descriptions of the necessary functions on the inetrnet. Microsoft does have a number of usefull documents, but these are usually hard to find!
Good luck.
William
|
|
|
|
|
Hi William
Thank you very much for the reply.
I ll get back to u once I am done with it.
Jyothi
|
|
|
|
|
William Engberts wrote: but these are usually hard to find!
*sigh*[^]
|
|
|
|
|
Can you simply generate a text file that contains the data numbers in ASCII format, saving it with the XLS extension and then open it with excell (also programmatically using ShellExecute )and then plot that data manually?
Or you need to prepare the graphs automatically?
Russell
|
|
|
|
|
Hi Russell,
Thanks for the reply. Its sound easy but I want my C++ program to open the excel application and plot it when I run my C++ program.
Jyothi
|
|
|
|
|
This is rough idea , you can create some addin Excel , and you can invoke it from your application . I think there is a way here.
Or one morething , when u invoke excel from c++ , you can specify macro file name to that.. so excel can open that macro . Then inside that macro u can do some stuffs.. (i am not an expert in macros. i don't know whether ur task is possible from macro or not)
If u can Dream... U can do it
http://krishnadevan.spaces.live.com
|
|
|
|
|
If you need automatic plot you can choose one of:
1) learn xls format and save directly the data with tha graps
2) Use a different (and easyer) file format like CVS compatible with excell that leave you prepare grapsh
3) Use Macros in excell;)
4) Find a different (freeware if possible) program that leave you write a data file (easily) and set there the params to plot they
5) Prepare your drawing class (here there is an example: http://www.codeproject.com/miscctrl/graph2d.asp[^] )
Russell
|
|
|
|
|
Hi Friends
Plaease help me out if Any one Know about
MPEG chopping on basis of time.
Rohit
|
|
|
|
|
It's success when I build a driver program in Win32 Free mode, but it's error in Win32 Checked mode, and report this error message 'Matching PDB file not found', I looked for the reason in google and can't find it. would you help me???
I like nature and smile ^_^
|
|
|
|
|
A .pdb file is Microsoft compiler specific mostly. It contains debugging information for individual obj files [rather than in obj itself]. Therefore, you need to do a rebuild when you move to a different compiler or platform.
|
|
|
|
|
Thank you, swati24n but I have rebuild more than 10 times, there are the same result. by the way, following are error message:
Generating Code...
Linking with DDK linker...
Compuware NM32 Symbol Translator/Loader version 4.3.2
(C) Compuware Corporation, 1996-2004
MODULE=.\objchk\i386\test.sys
PROMPT=OFF
SoftICE is not active
Error translating D:\test.sys: Matching PDB file not found.
Error executing d:\windows\system32\cmd.exe.
I like nature and smile ^_^
|
|
|
|
|
Not sure. Do you by any chance have the .DBG and .PDB in the same directory? It looks like the linker for the project is looking for the PDB generated for the module test.sys and cannot load it because test.sys is not built with the same compiler perhaps?
You can alway build your code without generating a PDB. Every compiler has a flag to do this.
-- modified at 14:10 Wednesday 8th August, 2007
|
|
|
|
|
There is test.pdb in the same directory(objchk\i386), when I disabled the pdb flag and the error continuing. I don't known how to solve it and it make me crazy
I like nature and smile ^_^
|
|
|
|
|
Hi,
I’m really a beginner on this field. Could some body can please help me. I need to create a lexical analyzer using C++, how will I start?
Thanks!
lavender_indigo
|
|
|
|