-
May 9th, 2014, 02:58 PM
#61
Re: Capture of Window
Originally Posted by crazy boy
.............
And what does it mean?
Please, either restore your post or just delete it!
Victor Nijegorodov
-
May 9th, 2014, 04:14 PM
#62
Re: Capture of Window
Is it possible to handle WM_PRINT or WM_PRINTCLIENT
with this routine?
Code:
INT_PTR CALLBACK MainDlgProc(HWND sheet, UINT msg, WPARAM wParam, LPARAM lParam)
-
May 9th, 2014, 04:36 PM
#63
Re: Capture of Window
The article whose reference you posted here
http://forums.codeguru.com/showthrea..._PRINT-Message
described one way of easily handling WM_PRINTCLIENT messages.
Code:
//Draw what is required in the client area (eg an ellipse) when a WM_PAINT or WM_PRINTCLIENT message received
void OnDraw(HWND hWnd, HDC hDC)
{
RECT rt;
GetClientRect(hWnd, &rt);
SelectObject(hDC, GetSysColorBrush(COLOR_INFOBK));
Ellipse(hDC, rt.left+5, rt.top+5, rt.right-3, rt.bottom-5);
}
void OnPaint(HWND hWnd, WPARAM wParam)
{
PAINTSTRUCT ps;
HDC hDC;
if ( wParam==0 )
hDC = BeginPaint(hWnd, & ps);
else
hDC = (HDC) wParam;
OnDraw(hWnd, hDC);
if ( wParam==0 )
EndPaint(hWnd, & ps);
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
...
case WM_PRINTCLIENT:
SendMessage(hWnd, WM_PAINT, wParam, lParam);
break;
case WM_PAINT:
OnPaint(hWnd, wParam);
break;
...
}
return 0;
}
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
May 9th, 2014, 04:54 PM
#64
Re: Capture of Window
Well, but my problem is that the app AOKTS use DialogProc to deliver messages. And I don't know why the message is not delivered. Now I try to deliver message to aokts.cpp which is Property sheet, not classical window. There should be some problem why it is not delivered. I can make bitmap from aokts.cpp window but not client area. I cannot break it in the WM_PRINT case or WM_PRINTCLIENT case. I commented some block of code which performed continue command before the TranslateMessage() is called. But still it is not delivered. Looks like the type of CALLBACK block the message... Do you understand what is going on right there?
http://paste.ofcode.org/FqBUjqBDWvTzM7Ag3bQQqs
Near line 894
There is this piece of code which makes it DialogProces:
Code:
// give the sheet its own DialogProc
pproc = (DLGPROC)SetWindowLong(sheet, DWL_DLGPROC, (LONG)&MainDlgProc);
But not classical LRESULT CALLBACK like in the mapview.cpp
-
May 9th, 2014, 05:24 PM
#65
Re: Capture of Window
Originally Posted by crazy boy
Do you understand what is going on right there?
Not by looking. I'd have to put in a few trace messages and some breakpoints in the code and start debugging. Of course, I'd also dust off the copy of the Petzold book and refresh my memory on GDI to make sure I understand how things are suppose to work.
I mentioned earlier about the Petzold book.. another must read is Programming Applications for Microsoft Windows by Jeffrey Richter.
Where Petzold speaks of the 'windowy' aspects of Windows; Richter speaks lower in the Windows stack: threads, processes, synchronization and so on.
Both are essential reading and will give you the background to solve many of these sorts of problems.
-
May 9th, 2014, 11:36 PM
#66
Re: Capture of Window
Originally Posted by Arjay
I mentioned earlier about the Petzold book.. another must read is
Are you payed agent (seller)?
Last edited by crazy boy; May 9th, 2014 at 11:51 PM.
-
May 10th, 2014, 02:25 AM
#67
Re: Capture of Window
Originally Posted by crazy boy
Are you payed agent (seller)?
No, like everyone else here just an unpaid volunteer. What's wrong, don't like to read up and learn about the subjects you are trying to program in?
-
May 10th, 2014, 04:23 AM
#68
Re: Capture of Window
Originally Posted by Arjay
No, like everyone else here just an unpaid volunteer. What's wrong, don't like to read up and learn about the subjects you are trying to program in?
You didn't answer my question which
Well, but my problem is that the app AOKTS use DialogProc to deliver messages. And I don't know why the message is not delivered.
First of all, I am asking if is it possible that WM_PRINT or WM_PRINTCLIENT are not proceesed by DialogProc? asking if is it possible to use DialogProc to handle WM_PRINT or WM_PRINTCLIENT. Clear question. Clear answer expected.
You better try to sell books. If you were not seller then you can recommend online reading like this
http://www.cprogramming.com/tutorial..._messages.html
-
May 10th, 2014, 06:52 AM
#69
Re: Capture of Window
if is it possible to use DialogProc to handle WM_PRINT or WM_PRINTCLIENT.
The short answer is I don't know. But what I would do is to log all messages coming into the dialog proc and find out. If I have a problem with windows code not working as expected, the first thing I do is to display all the incoming messages and their parameters to both a console and a log file. Then I can see what messages have been received and in what order in response to events.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
May 10th, 2014, 10:16 AM
#70
Re: Capture of Window
According this article it is possible to deliver the non dialog messages to DialogProc
Last edited by crazy boy; May 10th, 2014 at 04:55 PM.
-
May 10th, 2014, 05:03 PM
#71
Re: Capture of Window
Originally Posted by crazy boy
My priority now is to understand how DialogProc works.
...So I must study this more deep to see what's going on there.
Those two books I recommended would be a great place to start. Or you could continue posting and not follow the answers or advice you are given. We're at 5 pages now - I'm interested in seeing how long this thresd will go on.
-
May 11th, 2014, 07:42 AM
#72
Re: Capture of Window
I tested one program with DialogProc to find how the messages works.
http://forums.codeguru.com/showthrea..._PRINT-Message
There is good feature in Visual Studio C++ which enables me to use "When hit..." breakpoint, which displays a message into Output window. I used it to debug the WM_PRINTCLIENT inside WindowProc
Last edited by crazy boy; May 11th, 2014 at 10:23 AM.
-
May 11th, 2014, 08:06 AM
#73
Re: Capture of Window
Originally Posted by Arjay
Those two books I recommended would be a great place to start. Or you could continue posting and not follow the answers or advice you are given. We're at 5 pages now - I'm interested in seeing how long this thresd will go on.
Books are not the only one source of knowledge. Also different people have different attitudes of learning. because somebody like you need to read 1500 pages of book and then go learn programming. But some people like reading and practising simultaneously. You should not tell people which way of learning they should take because everybody is unique person and ppl are different. What fits to you will not fit to me. It's like trying to dress a goat in human clothes. You will not saddle dog to ride on him, huh?
PS: I still think that you are a seller. You will not convince me, same as those hackers which I talked with. They told me they are not hackers but I got proofs in the mean while. As your effort to sell commercial products looks very suspicious.
Last edited by crazy boy; May 11th, 2014 at 08:10 AM.
-
May 11th, 2014, 09:27 AM
#74
Re: Capture of Window
Originally Posted by crazy boy
Books are not the only one source of knowledge. Also different people have different attitudes of learning. because somebody like you need to read 1500 pages of book and then go learn programming. But some people like reading and practising simultaneously. You should not tell people which way of learning they should take because everybody is unique person and ppl are different. What fits to you will not fit to me. It's like trying to dress a goat in human clothes. You will not saddle dog to ride on him, huh?.
Sure some people learn differently and others don't learn. Like learning proper etiquette when posting to a programming forum. Some folks demand answers and do very little to help the folks that are trying to help them, while others realize that folks answering are donating their time will do everything to assist - like actually make code snippets readable and point out exactly what like 73 is without forcing the 'helpers' to count every single line. Oh and remember to not get upset when the 'helpers' ask the poster to point out what line 73 is.
Moving on to the book. I did not ask you to read the 1500 page book - I said that it would benefit you to read and work through the exercises which brings up another point of programming forum etiquette: actually reading and processing the responses you are getting.
Originally Posted by crazy boy
PS: I still think that you are a seller. You will not convince me, same as those hackers which I talked with. They told me they are not hackers but I got proofs in the mean while. As your effort to sell commercial products looks very suspicious.
It is clear from your posts that you don't have the background for the basics of how Windows works. I suggested to work through the examples of the two books because they will give you a great foundation. Other posters have agreed with me (which most folks would take that as to mean that the books I recommended are actually worth reading). Sure, there are many ways of learning, but forums aren't necessarily the best way to learn foundational work. Why should folks on a forum try to teach you the basics that are much better explained in a book? Doing so would be a waste of time to folks trying to answer questions.
Hopefully, you don't honestly think that I'm on the forum here to just try to get folks to buy books. In the 10,000+ post I have on here answering questions, it isn't often that I recommend books, but when I do it's because I believe the person that I'm recommending to will definitely get some benefit. I would venture to guess that everyone that has attempted to help you on this forum has read the two books I recommended. So look at this another way: you haven't read the books and you're asking questions; we've read the books and we're answering questions. See the pattern?
-
May 11th, 2014, 10:02 AM
#75
Re: Capture of Window
Originally Posted by Arjay
I did not ask you to read the 1500 page book - I said that it would benefit you to read and work through the exercises which brings up another point of programming forum etiquette: actually reading and processing the responses you are getting.
Your statements are absurd. Should I read every book what everybody brings to mind? Are you mad? Are saying that I don't read responses? I did read all the references which were suggested to me on MSDN. You think that I will read all this stuff within few hours? Are you mad? I need time for this. Also I did my best to make my post or codes readable.
Originally Posted by Arjay
It is clear from your posts that you don't have the background for the basics of how Windows works. I suggested to work through the examples of the two books because they will give you a great foundation. Other posters have agreed with me (which most folks would take that as to mean that the books I recommended are actually worth reading). Sure, there are many ways of learning, but forums aren't necessarily the best way to learn foundational work.
Even if I would read those books, I would come here again and ask about how to make that example codes working.
I don't learn from forums! I learn from MSDN and other internet sources! Don't say that I learn here. I needed to explain some little pieces which I read or have found when I tried to make some codes working or better to understand. The stuff which I learned could not be written on 1000 pages of this forum! So your statement is not true. I just need some clue and that is all.
Originally Posted by Arjay
Why should folks on a forum try to teach you the basics that are much better explained in a book? Doing so would be a waste of time to folks trying to answer questions.
Hopefully, you don't honestly think that I'm on the forum here to just try to get folks to buy books. In the 10,000+ post I have on here answering questions, it isn't often that I recommend books, but when I do it's because I believe the person that I'm recommending to will definitely get some benefit. I would venture to guess that everyone that has attempted to help you on this forum has read the two books I recommended. So look at this another way: you haven't read the books and you're asking questions; we've read the books and we're answering questions. See the pattern?
Why you waste your time reading my posts and writing? Are you bored? You must be very much bored! If I would want a book to read, I would find some. I don't need you to tell me which book to buy. I did not ask you "What book is best for learning C++?" If I would want to buy a book I can go to internet or to go to bookshop rather. Conclusion: your post are useless, have not bring anything good for me. But the other guys who written here did some good. They helped me to fix some bug, which I appreciate and they can have good feeling of help others. Whilst you are bored and teasing and really wasting your time. You even spent much more time than you would do if you would answer my simple question. This is just clear unwillingness to help. My final word to this is that I already have found a big benefit of what I learned during last week! But am not planning to buy book because I don't have so much time to read it. My time is limited. It really priceless trying to make me to read book.
Yes I use books but only when I look for something in the moment, I don't reed them completley. I would not have time for this it would taken years for me to complete. PLS don't waste your time in this topic. Don't slam your head against wall of bricks, you cannot break it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|