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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Creating Sub folder

Creating Sub folder

Scheduled Pinned Locked Moved C / C++ / MFC
help
22 Posts 4 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.
  • H Hamid Taebi

    if you know folers name use of String Table of course before this if your folders are like a b c d...ab ac dc,... use of numbers and convert numbers with itoa or CString::Format forPathFileExists then you can check and create 28 folder with a loop (I think you use of a b c d),but if you different names use of String Table and insert folders name on it and read of it ;)


    WhiteSky


    R Offline
    R Offline
    Rajesh R Subramanian
    wrote on last edited by
    #10

    Bad advise. Please see here[^]


    Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா

    1 Reply Last reply
    0
    • H Hamid Taebi

      if you know folers name use of String Table of course before this if your folders are like a b c d...ab ac dc,... use of numbers and convert numbers with itoa or CString::Format forPathFileExists then you can check and create 28 folder with a loop (I think you use of a b c d),but if you different names use of String Table and insert folders name on it and read of it ;)


      WhiteSky


      S Offline
      S Offline
      Suresh H
      wrote on last edited by
      #11

      Thanks WhiteSky ......I will do the same ...;)

      1 Reply Last reply
      0
      • R Rajesh R Subramanian

        That is some dumb way of doing things. What if you have a 14 folders intermediate to create the innermost folder? Use SHCreateDirectory() or SHCreateDirectoryEx() instead.

        SHCreateDirectory(NULL, TEXT("D:\\Hi there\\Good luck"));


        Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா

        S Offline
        S Offline
        Suresh H
        wrote on last edited by
        #12

        Hi brahmma, I am getting undeclared identifier, we have to include any header or lib file ??? SHCreateDirectory(NULL, TEXT("C:\\A\\B\\C")); SHCreateDirectoryEx(NULL, TEXT("C:\\A\\B\\C")); error C2065: 'SHCreateDirectory' : undeclared identifier error C2065: 'SHCreateDirectoryEx' : undeclared identifier

        R 2 Replies Last reply
        0
        • S Suresh H

          Hi brahmma, I am getting undeclared identifier, we have to include any header or lib file ??? SHCreateDirectory(NULL, TEXT("C:\\A\\B\\C")); SHCreateDirectoryEx(NULL, TEXT("C:\\A\\B\\C")); error C2065: 'SHCreateDirectory' : undeclared identifier error C2065: 'SHCreateDirectoryEx' : undeclared identifier

          R Offline
          R Offline
          Rajesh R Subramanian
          wrote on last edited by
          #13

          Suresh H wrote:

          we have to include any header or lib file ???

          #include "shlobj.h" and you need to link to shell32.lib


          Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா

          S 1 Reply Last reply
          0
          • R Rajesh R Subramanian

            That is some dumb way of doing things. What if you have a 14 folders intermediate to create the innermost folder? Use SHCreateDirectory() or SHCreateDirectoryEx() instead.

            SHCreateDirectory(NULL, TEXT("D:\\Hi there\\Good luck"));


            Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா

            P Offline
            P Offline
            prasad_som
            wrote on last edited by
            #14

            Good one !

            Prasad Notifier using ATL | Operator new[],delete[][^]

            R 1 Reply Last reply
            0
            • R Rajesh R Subramanian

              Suresh H wrote:

              we have to include any header or lib file ???

              #include "shlobj.h" and you need to link to shell32.lib


              Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா

              S Offline
              S Offline
              Suresh H
              wrote on last edited by
              #15

              hi Brahmma , I added shell32.lib to project settings, but still i am getting the same error and also i ahve included #include "shlobj.h" . can u plz tell me what is the cause ??

              R 1 Reply Last reply
              0
              • S Suresh H

                hi Brahmma , I added shell32.lib to project settings, but still i am getting the same error and also i ahve included #include "shlobj.h" . can u plz tell me what is the cause ??

                R Offline
                R Offline
                Rajesh R Subramanian
                wrote on last edited by
                #16

                I think you need to download the latest Platform SDK.


                Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா

                S 1 Reply Last reply
                0
                • R Rajesh R Subramanian

                  I think you need to download the latest Platform SDK.


                  Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா

                  S Offline
                  S Offline
                  Suresh H
                  wrote on last edited by
                  #17

                  I am using VS 6.

                  P 2 Replies Last reply
                  0
                  • S Suresh H

                    Hi brahmma, I am getting undeclared identifier, we have to include any header or lib file ??? SHCreateDirectory(NULL, TEXT("C:\\A\\B\\C")); SHCreateDirectoryEx(NULL, TEXT("C:\\A\\B\\C")); error C2065: 'SHCreateDirectory' : undeclared identifier error C2065: 'SHCreateDirectoryEx' : undeclared identifier

                    R Offline
                    R Offline
                    Rajesh R Subramanian
                    wrote on last edited by
                    #18

                    Suresh H wrote:

                    SHCreateDirectory(NULL, TEXT("C:\\A\\B\\C")); SHCreateDirectoryEx(NULL, TEXT("C:\\A\\B\\C"));

                    SHCreateDirectoryEx(NULL, TEXT("C:\\A\\B\\C")); There is a third parameter to the Ex version of this function! Did you not even look at this function in the documentation? the Ex version of this function allows you to define security attributes to the folder that you create. That is the third parameter while using the Ex version and that is the only difference between SHCreateDirectory() and SHCreateDirectoryEx(). If you do not want to define security attributes, then do not use the Ex version.


                    Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா

                    S 1 Reply Last reply
                    0
                    • R Rajesh R Subramanian

                      Suresh H wrote:

                      SHCreateDirectory(NULL, TEXT("C:\\A\\B\\C")); SHCreateDirectoryEx(NULL, TEXT("C:\\A\\B\\C"));

                      SHCreateDirectoryEx(NULL, TEXT("C:\\A\\B\\C")); There is a third parameter to the Ex version of this function! Did you not even look at this function in the documentation? the Ex version of this function allows you to define security attributes to the folder that you create. That is the third parameter while using the Ex version and that is the only difference between SHCreateDirectory() and SHCreateDirectoryEx(). If you do not want to define security attributes, then do not use the Ex version.


                      Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா

                      S Offline
                      S Offline
                      Suresh H
                      wrote on last edited by
                      #19

                      I just tried with both the options, I want just to create a set of folders c:\\a\\b , then I think SHCreateDirectory() is enough.

                      1 Reply Last reply
                      0
                      • P prasad_som

                        Good one !

                        Prasad Notifier using ATL | Operator new[],delete[][^]

                        R Offline
                        R Offline
                        Rajesh R Subramanian
                        wrote on last edited by
                        #20

                        Thanks!


                        Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா

                        1 Reply Last reply
                        0
                        • S Suresh H

                          I am using VS 6.

                          P Offline
                          P Offline
                          prasad_som
                          wrote on last edited by
                          #21

                          You need to download latest platform SDK. If its already there. Update include directories settings for your IDE, to point to updated SDK.

                          Prasad Notifier using ATL | Operator new[],delete[][^]

                          1 Reply Last reply
                          0
                          • S Suresh H

                            I am using VS 6.

                            P Offline
                            P Offline
                            prasad_som
                            wrote on last edited by
                            #22

                            In addition to my previous reply. Mentioned API's are available with IE version 6 onwards. Make sure sure it is present on your machine. And to compile youe code , your need to update IE version in your app, too.

                            #ifdef _WIN32_IE
                            #undef _WIN32_IE
                            #endif
                            #define _WIN32_IE 0x0601

                            Use above line of code in your application. Before including concern API file.

                            Prasad Notifier using ATL | Operator new[],delete[][^]

                            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