|
You bet
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
hi thanks for your reply ..
i have found out the problem... while creating the methods for the control i used functions which are by default reference but in vc++ its by value .... that was the problem ..thanks anyway
|
|
|
|
|
I made com exe (not service) i have few interface in that, One of my requirement is to listen to windows messages also how do i do that ?
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
Create an Invisible Window and create a message Loop for that in a new thread if required
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
i figured that already and i implemented that too...
what i wanted to know that since i am using atl is there anything that atl provides to do the message handling.
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
You need some thing like spy++. I believe I have seen a simular program here at codeproject. You can also look at sourceforge.
The difference seems to be that you want to listen to all message sent to your program. This is easy if it was written in C, but if you are using MFC (or some other frame work) then you needed to understand where the frame work is rerouting the messages so you can intercept them.
Hey! With a little patience you can single step through, from the beggining, any (Windows) application to determine how to intercept all messages.
INTP
|
|
|
|
|
hi..i need help on a prob pls...
i have a proj where i draw a rect in the OnDraw of my proj's View...
code:
--------------------------------------------------------------------------------
//
//Set the mapping mode to LOENGLISH
//
pDC->SetMapMode(MM_LOENGLISH);
//
//Convert arguments to coordinates to MM_LOENGLISH units.
//
CSize szTemp;
szTemp.cx = pDoc->GetGridX();//get the left of the rect to be drawn
szTemp.cy = pDoc->GetGridY();//get the bottom of the same rect
pDC->DPtoLP(&szTemp);
//
//Draw the size preview
//
CRect rect( 10, -10, szTemp.cx, -szTemp.cy );
pDC->Rectangle(rect);
--------------------------------------------------------------------------------
now after the rect is draw..i want to do the following:
given a point say 20,20.....so every time i get i point i make it into a rect and color it say red...
so if i get a point 20, 20
i amke arect
20,-20,21,-21
works fine now...but io ahve one doubt...
where should i do this this calculation???in the OnUpdate?
in the DOC?make my own fn in a view and put it there?
the point i get from which i am supposed to make the small rect comes from DOC.
so from doc where should i go to do this calulation???
code:
--------------------------------------------------------------------------------
CRect rect(x,-y,x+1,-(y+1));
pDC->Rectangle(rect);
pDC->FillRect(rect, &brush);
UpdateAllViews(NULL,.....);
--------------------------------------------------------------------------------
if i do this in doc..how do i get the DC????
please help...tks a lot...
can i get the dc like this
CClient dc(this);
will this dc be the dc of the view???
can i do the drtawiung using this dc that i make in doc???
tks a lot..really appreciate your time and help..
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
"For God so loved the world that He gave His only begotten Son, that whoever believes in Him should not perish but have everlasting life."
John 3:16
"Therefore you also be ready, for the Son of Man is coming at an hour you do not expet."
Luke 12:40
|
|
|
|
|
in the OnDraw of View call GetDocument to get the Document Pointer and access the Data that is required to Draw the Stuff
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
cannot do that...the data is not fixed..it keeps changing...something like the scribble applicaiton,,,
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
"For God so loved the world that He gave His only begotten Son, that whoever believes in Him should not perish but have everlasting life."
John 3:16
"Therefore you also be ready, for the Son of Man is coming at an hour you do not expet."
Luke 12:40
|
|
|
|
|
If ur drawing is based on constant User input
then have no choice but to do the calculations in the Drawing code itself
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
What you seem to want is where to store the rectangle information.
1) If more then 1 view needs the rectangle information, then store it in the document class and tell all views when the information has changed.
2) If only the current view needs the rectangle information, then store it in the view class.
Question: "if i do this in doc..how do i get the DC????"
Answer: The DC only matters when your are drawing the image, and it is given to you (if you are using MFC).
Question: "CClient dc(this);"
Answer: Yes! But you normaly do not need to (when using MFC), since it is given to you in the OnDraw() function.
Question: "will this dc be the dc of the view???"
Answer: If you are getting the DC in the view class, then yes.
Question: "can i do the drtawiung using this dc that i make in doc???"
Answer: Yes! But a document class does not know a DC from a hole in the ground. I wish I could say NO but if you try hard enough then the answer must be yes. (DO NOT DO THIS!)
INTP
|
|
|
|
|
How to know a toolbar button ID under the mouse!??
Best regards,
Eugene Pustovoyt
|
|
|
|
|
A quick look implies the following:
1) Use pToolBar = CToolBar::GetToolBarCtrl(); to get access to control
2) Use pToolBar->GetItemRect(); to find which item the mouse is over.
3) Now use pToolBar->GetItemID(); to get the ID.
Accept for all the typing (loops, ect..), it should be easy.
P.S. It would be easier if each button on an MFC toolbar was an indiviual window, but they are not. If this helps helps, send me your solution; if not write an article on your solution.
INTP
|
|
|
|
|
Good and how can I know a quantities of the toolbar button?
Best regards,
Eugene Pustovoyt
|
|
|
|
|
What do you mean? Do you mean the number of items on the toolbar?
The base class of CToolBar is the CControlBar class and has a GetCount() member. If you have the display coordinates, then just loop through count items until you find an item rectangle (CToolBar::GetItemRect(nIndex, &Rect)) in which the cursor (also in display coordinates) is located. Now you should have the index of the toolbar item, call CToolBar::GetItemID(nIndex) to get ID.
INTP
|
|
|
|
|
Yes, I need to know the number of the items for the enumerate method.
Thank you, your answer was full!!!
Best regards,
Eugene Pustovoyt
|
|
|
|
|
I want to add a preview function while use CFileDialog to open a *.jpg.
Then it has done successfully.
But I found the preview place down not right.
what can i do??
|
|
|
|
|
What are you trying to do?
1) If you just want to see what the image looks like before opening and you are using one of the Windows operating systems that support thumbnails, then
you should already have preview built in.
2) If you wish to support preview on a system that does not support thumnails in the open file dialog, then you will need to subclass the open file dialog. This is covered in the MFC libraray and I believe there may be some articles at codeproject that may cover this subject.
3) If you already have a dialog that you designed, then what problems are you having: (1) is it not drawing, (2) is it not draw in the correct location.
INTP
|
|
|
|
|
for my MDI app, i have a toolbar with a drop down list that is properly initialised and created. i can capture/detect when the user selects a given item from the list.
desired functionality: whenever the user selects an item from the drop-down list, i want to change the contents of the main menubar. i read the online docs for Microsoft Visual C++ .NET regarding the CMDIFrameWnd::MDISetMenu method. at first glance this is what i want but the article suggests that we should not "call this member function if you use the framework to manage your MDI child windows".
any helpful suggestion would be appreciated. thanks.
|
|
|
|
|
I do not use .NET, but one source that might give you a clue is the book "The MFC Answer Book" (look for MFC FAQ on the internet). When using Visual C++ 6.0, you normaly create a resource for based on the view (but you can change the resource used at any time). The most effective way would probaly be to add and remove menue items directly via code (this is much harder to code and maintain).
INTP
|
|
|
|
|
I wanted to know how an mfc application responds to WM_CLOSE. I have one application which is issuing a WM_CLOSE message to another MFC application.But the other doesn't respond to WM_CLOSE instantly. It waits for the current function or method running in primary thread to return and then takes up this message. But if primary thread is not doing anything, only secondary thread is processing, WM_CLOSE is processed instantly. Please confirm that my analysis is correct..
|
|
|
|
|
It is not a matter (I believe) of how MFC responds, but of how Windows responds. You might try putting your thread to sleep momentaraly to give the other application time to process the command.
As for how mfc applications responds: that is up to the person who wrote the application.
INTP
|
|
|
|
|
Thanks, I guess I didn't write my question clearly. What I want to confirm is whether an application running a message loop responds to WM_CLOSE instantly or after finishing the current processing. I tested with my application, what I found that when I issue a WM_CLOSE message to the second application, this second application responds to WM_CLOSE only after it has finished current processing. i.e. if a Dialog class's OnInitDialog method is getting processed when I issue WM_CLOSE, WM_CLOSE is handled only after OnInitDialog returns.
Is this behavior specific to DoModal or any method which is getting called?
|
|
|
|
|
windows programs handle events serially for one window
e.g
if you are already handling an event and another event comes , it will be in the queue and after processing ur current event the next event will be processed from the Queue .
Hope it answers ur query
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
Sorry I was buzy elsewere!
Quick Answer: Before any application can close it must first finish what it is doing. That is it will not receive (etc...) any new messages until it is finish with the current message (or sub-task). It is possible to end a task now, but DO NOT DO THAT (CRTL-ALT-DELETE).
Question: "Is this behavior specific to DoModal or any method which is getting called?"
Answer: Yes and No! (1) The quick answer remains the same. The difference is that a modal box is not finished until the user closes the dialog box.
P.S. No application can respond until it has finished current processing.
INTP
|
|
|
|