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. Problem loading non-default wab

Problem loading non-default wab

Scheduled Pinned Locked Moved C / C++ / MFC
help
14 Posts 3 Posters 1 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.
  • C Code o mat

    Why is this conversion needed:

    Member 868926 wrote:

    wp.szFileName = (LPTSTR) (LPCTSTR) pszFileName;

    ?

    > The problem with computers is that they do what you tell them to do and not what you want them to do. < > If it doesn't matter, it's antimatter.<

    M Offline
    M Offline
    Member 868926
    wrote on last edited by
    #3

    Good point, well I'm now trying: wp.szFileName = "C:\\Jim.wab"; as I know that wab exists there but it still isn't loading it. G

    C 1 Reply Last reply
    0
    • M Member 868926

      Hi I'm having trouble trying to load a non-default .wab file (I know it's old hat but need to keep it going for my XP users). I'm running it on Vista and although I'm supplying a filename it keeps loading my Vista Contacts instead instead of the specific wab addresses. It must be going wrong around here (mostly stock code from the msdn sample code): // (pszFileName is const char *) if(m_hinstWAB) { // if we loaded the dll, get the entry point // m_lpfnWABOpen = (LPWABOPEN) GetProcAddress(m_hinstWAB, "WABOpen"); if(m_lpfnWABOpen) { HRESULT hr = E_FAIL; WAB_PARAM wp = {0}; wp.cbSize = sizeof(WAB_PARAM); wp.szFileName = (LPTSTR) (LPCTSTR) pszFileName; // if we choose not to pass in a WAB_PARAM object, // the default WAB file will be opened up // if(m_lpfnWABOpen(&m_lpAdrBook,&m_lpWABObject,&wp,0)==S_OK) m_bInitialized = TRUE; } As usual, any help much appreciated. Greg

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #4
      1. Have you checked the actual error code returned from the WABOpen Function?
      2. Have you checked the documentation[^] for compatibility?

      One of these days I'm going to think of a really clever signature.

      M 1 Reply Last reply
      0
      • M Member 868926

        Good point, well I'm now trying: wp.szFileName = "C:\\Jim.wab"; as I know that wab exists there but it still isn't loading it. G

        C Offline
        C Offline
        Code o mat
        wrote on last edited by
        #5

        Are you completely sure that is a correct WAB file and it is readable by the process (it has the required access rights and somesuch)?

        > The problem with computers is that they do what you tell them to do and not what you want them to do. < > If it doesn't matter, it's antimatter.<

        M 1 Reply Last reply
        0
        • L Lost User
          1. Have you checked the actual error code returned from the WABOpen Function?
          2. Have you checked the documentation[^] for compatibility?

          One of these days I'm going to think of a really clever signature.

          M Offline
          M Offline
          Member 868926
          wrote on last edited by
          #6

          It doesn't return an error, just loads my Vista Contacts instead. Compatability seems OK.

          L 1 Reply Last reply
          0
          • C Code o mat

            Are you completely sure that is a correct WAB file and it is readable by the process (it has the required access rights and somesuch)?

            > The problem with computers is that they do what you tell them to do and not what you want them to do. < > If it doesn't matter, it's antimatter.<

            M Offline
            M Offline
            Member 868926
            wrote on last edited by
            #7

            Yes the wab is OK. If you doubleclick it Windows asks if you want to import the addresses. Somehow the WabOpen bit just thinks I want the default Wab (although there isn't one in Vista) and isn't getting the filename. In the original code there was a 'GetNativePath()' call which isn't available - could it be to do with how I'm passing in the file location string? G

            C 2 Replies Last reply
            0
            • M Member 868926

              Yes the wab is OK. If you doubleclick it Windows asks if you want to import the addresses. Somehow the WabOpen bit just thinks I want the default Wab (although there isn't one in Vista) and isn't getting the filename. In the original code there was a 'GetNativePath()' call which isn't available - could it be to do with how I'm passing in the file location string? G

              C Offline
              C Offline
              Code o mat
              wrote on last edited by
              #8

              As far as i remember the documentation says it will load the default if you pass NULL for the path, but you are not passing NULL but a seemingly correct path. Hmm...

              > The problem with computers is that they do what you tell them to do and not what you want them to do. < > If it doesn't matter, it's antimatter.<

              1 Reply Last reply
              0
              • M Member 868926

                Yes the wab is OK. If you doubleclick it Windows asks if you want to import the addresses. Somehow the WabOpen bit just thinks I want the default Wab (although there isn't one in Vista) and isn't getting the filename. In the original code there was a 'GetNativePath()' call which isn't available - could it be to do with how I'm passing in the file location string? G

                C Offline
                C Offline
                Code o mat
                wrote on last edited by
                #9

                If i check the documentation (http://msdn.microsoft.com/en-us/library/ms629458%28v=vs.85%29.aspx[^]) for WAB_PARAM, the szFileName member is declared to be LPTSTR. This suggests that depending on your target options, it might be a unicode or an ansii/mbcs string which then suggests that there might be a unicode and an ansii/mbcs version of the function (as with a lot of API methods throughout windows). When you query the function's pointer...are you sure you are getting the correct version?

                > The problem with computers is that they do what you tell them to do and not what you want them to do. < > If it doesn't matter, it's antimatter.<

                M 1 Reply Last reply
                0
                • M Member 868926

                  It doesn't return an error, just loads my Vista Contacts instead. Compatability seems OK.

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #10

                  Have you tried removing the default contacts file to see if it works then? It's a long while since I used WAB and I never actually tried using the non-default file.

                  One of these days I'm going to think of a really clever signature.

                  M 1 Reply Last reply
                  0
                  • L Lost User

                    Have you tried removing the default contacts file to see if it works then? It's a long while since I used WAB and I never actually tried using the non-default file.

                    One of these days I'm going to think of a really clever signature.

                    M Offline
                    M Offline
                    Member 868926
                    wrote on last edited by
                    #11

                    I tried that, then it just doesn't load anything.

                    L 1 Reply Last reply
                    0
                    • C Code o mat

                      If i check the documentation (http://msdn.microsoft.com/en-us/library/ms629458%28v=vs.85%29.aspx[^]) for WAB_PARAM, the szFileName member is declared to be LPTSTR. This suggests that depending on your target options, it might be a unicode or an ansii/mbcs string which then suggests that there might be a unicode and an ansii/mbcs version of the function (as with a lot of API methods throughout windows). When you query the function's pointer...are you sure you are getting the correct version?

                      > The problem with computers is that they do what you tell them to do and not what you want them to do. < > If it doesn't matter, it's antimatter.<

                      M Offline
                      M Offline
                      Member 868926
                      wrote on last edited by
                      #12

                      I'm not sure - in the header file I can't see another version except WabOpenEx which I tried but didn't work. I've noticed that my Contacts folder is actually receiving the wab addresses and getting bigger and bigger! So instead of opening the wab on its own it's adding them to the Contacts then opening those instead. Is this some undocumented Vista mechanism? Thanks very much for everyone's conttributions so far. G

                      C 1 Reply Last reply
                      0
                      • M Member 868926

                        I tried that, then it just doesn't load anything.

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #13

                        Sorry, I cannot think of anything else to suggest. You could try the Microsoft forums.

                        One of these days I'm going to think of a really clever signature.

                        1 Reply Last reply
                        0
                        • M Member 868926

                          I'm not sure - in the header file I can't see another version except WabOpenEx which I tried but didn't work. I've noticed that my Contacts folder is actually receiving the wab addresses and getting bigger and bigger! So instead of opening the wab on its own it's adding them to the Contacts then opening those instead. Is this some undocumented Vista mechanism? Thanks very much for everyone's conttributions so far. G

                          C Offline
                          C Offline
                          Code o mat
                          wrote on last edited by
                          #14

                          Frankly, i don't know, sorry... :(

                          > The problem with computers is that they do what you tell them to do and not what you want them to do. < > If it doesn't matter, it's antimatter.<

                          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