Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. 2 not so simple questions

2 not so simple questions

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nemok
    wrote on last edited by
    #1

    1. How can I drag my dialog when draging over a certain portion of the dialog??? When I'm using: UINT CNBinderDlg::OnNcHitTest(CPoint point) { UINT ret = CDialog::OnNcHitTest(point); if(ret == HTCLIENT) { return HTCAPTION; } return ret; } I can drag the window by draging anywhere in the window. 2. Is it posible to hide or lock a directory, not only in explorer(with ".{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0}") but in other file managers like TotalCommander too??? Thanx!:confused:

    A 1 Reply Last reply
    0
    • N Nemok

      1. How can I drag my dialog when draging over a certain portion of the dialog??? When I'm using: UINT CNBinderDlg::OnNcHitTest(CPoint point) { UINT ret = CDialog::OnNcHitTest(point); if(ret == HTCLIENT) { return HTCAPTION; } return ret; } I can drag the window by draging anywhere in the window. 2. Is it posible to hide or lock a directory, not only in explorer(with ".{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0}") but in other file managers like TotalCommander too??? Thanx!:confused:

      A Offline
      A Offline
      Antti Keskinen
      wrote on last edited by
      #2

      1. Easily. As you can see in the WM_NCHITTEST message handler, you receive a CPoint object that specifies the point, in screen coordinates, where the hit test was made. If you first use ScreenToClient function to convert the CPoint into client coordinates then you can compare the coordinates to a pre-made list of where the function should return HTCAPTION. Everywhere where HTCAPTION is returned, the dialog becomes draggable. Thus, if, for example, the x-coordinate of the CPoint is smaller than a half of the dialog's width, then you return HTCLIENT. Otherwise you return HTCAPTION. As a result, when you click and hold on the right-most half of your dialog, it can be dragged. 2. Some advanced file managers by-pass the security settings placed in the registry. To go around this, you could try the _access and _waccess functions of the Run-Time C Library. Not sure if they work though... -Antti Keskinen ---------------------------------------------- The definition of impossible is strictly dependant on what we think is possible.

      D 1 Reply Last reply
      0
      • A Antti Keskinen

        1. Easily. As you can see in the WM_NCHITTEST message handler, you receive a CPoint object that specifies the point, in screen coordinates, where the hit test was made. If you first use ScreenToClient function to convert the CPoint into client coordinates then you can compare the coordinates to a pre-made list of where the function should return HTCAPTION. Everywhere where HTCAPTION is returned, the dialog becomes draggable. Thus, if, for example, the x-coordinate of the CPoint is smaller than a half of the dialog's width, then you return HTCLIENT. Otherwise you return HTCAPTION. As a result, when you click and hold on the right-most half of your dialog, it can be dragged. 2. Some advanced file managers by-pass the security settings placed in the registry. To go around this, you could try the _access and _waccess functions of the Run-Time C Library. Not sure if they work though... -Antti Keskinen ---------------------------------------------- The definition of impossible is strictly dependant on what we think is possible.

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        Antti Keskinen wrote: ...you could try the _access and _waccess functions... These are "get" functions not "set" functions, or did I miss your intent?


        "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

        N 1 Reply Last reply
        0
        • D David Crow

          Antti Keskinen wrote: ...you could try the _access and _waccess functions... These are "get" functions not "set" functions, or did I miss your intent?


          "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

          N Offline
          N Offline
          Nemok
          wrote on last edited by
          #4

          you are right DavidCrow. _access and _waccess are get functions. I wan't set functions that hides (locks) folders no matter on what account you are, including administrator. Any ideas anybody?

          D 1 Reply Last reply
          0
          • N Nemok

            you are right DavidCrow. _access and _waccess are get functions. I wan't set functions that hides (locks) folders no matter on what account you are, including administrator. Any ideas anybody?

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            I do not know how to do it programmatically.


            "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups