CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 5 of 9 FirstFirst ... 2345678 ... LastLast
Results 61 to 75 of 132
  1. #61
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,398

    Re: Capture of Window

    Quote Originally Posted by crazy boy View Post
    .............
    And what does it mean?
    Please, either restore your post or just delete it!
    Victor Nijegorodov

  2. #62
    Join Date
    May 2014
    Posts
    205

    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)

  3. #63
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,825

    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)

  4. #64
    Join Date
    May 2014
    Posts
    205

    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

  5. #65
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Capture of Window

    Quote Originally Posted by crazy boy View Post
    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.

  6. #66
    Join Date
    May 2014
    Posts
    205

    Re: Capture of Window

    Quote Originally Posted by Arjay View Post
    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.

  7. #67
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Capture of Window

    Quote Originally Posted by crazy boy View Post
    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?

  8. #68
    Join Date
    May 2014
    Posts
    205

    Re: Capture of Window

    Quote Originally Posted by Arjay View Post
    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

  9. #69
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,825

    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)

  10. #70
    Join Date
    May 2014
    Posts
    205

    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.

  11. #71
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Capture of Window

    Quote Originally Posted by crazy boy View Post
    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.

  12. #72
    Join Date
    May 2014
    Posts
    205

    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.

  13. #73
    Join Date
    May 2014
    Posts
    205

    Re: Capture of Window

    Quote Originally Posted by Arjay View Post
    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.

  14. #74
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Capture of Window

    Quote Originally Posted by crazy boy View Post
    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.

    Quote Originally Posted by crazy boy View Post
    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?

  15. #75
    Join Date
    May 2014
    Posts
    205

    Re: Capture of Window

    Quote Originally Posted by Arjay View Post
    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.


    Quote Originally Posted by Arjay View Post
    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.


    Quote Originally Posted by Arjay View Post
    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.

Page 5 of 9 FirstFirst ... 2345678 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured