Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++ 2005
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Visual C++ 2005 For discussion of Visual C++ 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ 2005 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old March 23rd, 2006, 10:13 PM
Registered User
 
Join Date: Mar 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default a problem in use vc++.net to import WAB file!

It's my first vc++.net program,i want it to import another WAB book from d:/pxall.wab into

my default outlook express WAB book. Under vs2005 i debug it done ok,but double click .exe

file it can't work(my OS is xp)!!when i copy .exe and msvcr80d.dll to win2000 and double

click .exe it done ok!!i copy .exe file and msvcr80d.dll to other xp os it can't work!why??

Can any one help me! thanks!

/ updateOutlookExpress.cppˇŁ
//

#include "stdafx.h"
#include "wab.h"
#include "Wabapi.h"
#include "updateOutlookExpress.h"

int APIENTRY _tWinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPTSTR lpCmdLine,
                     int nCmdShow)
{
    LPWABOPEN lpfnWABOpen = NULL; // Defined in Wabapi.h.
        HINSTANCE hinstWAB = NULL;
    LPWABOBJECT lppWABObject;
    LPADRBOOK lppAdrBook;
    HRESULT hr = E_FAIL;
    LPWABIMPORTPARAM lpWABParam;




    TCHAR szWABDllPath[MAX_PATH];
        DWORD dwType = 0;
        ULONG cbData = sizeof(szWABDllPath);
        HKEY hKey = NULL;

        *szWABDllPath = '\0';

        // First we look under the default WAB DLL path location in the
        // Registry.
        // WAB_DLL_PATH_KEY is defined in wabapi.h
        //
        if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, WAB_DLL_PATH_KEY, 0, KEY_READ,

&hKey))
            RegQueryValueEx( hKey, L"", NULL, &dwType, (LPBYTE) szWABDllPath, &cbData);

        if(hKey) RegCloseKey(hKey);

        // if the Registry came up blank, we do a loadlibrary on the wab32.dll
        // WAB_DLL_NAME is defined in wabapi.h
        //
        hinstWAB = LoadLibrary( (lstrlen(szWABDllPath)) ? szWABDllPath : WAB_DLL_NAME );

    if (hinstWAB)
    {
            lpfnWABOpen = (LPWABOPEN) GetProcAddress(hinstWAB, "WABOpen");
            if (lpfnWABOpen)
            {
                hr = lpfnWABOpen (&lppAdrBook, &lppWABObject,NULL, 0);
                if (hr != S_OK) {
                    MessageBox(NULL,L"Outlook Express WAB Book Update

Failed!",L"Update",MB_OK);
                    exit(1);
                }

                lpWABParam=(LPWABIMPORTPARAM)(malloc(sizeof

(WABIMPORTPARAM)));
                lpWABParam->lpszFileName="d:\\pxall.wab";

                lpWABParam->lpAdrBook=lppAdrBook;


                HRESULT res=lppWABObject->Import((LPSTR)lpWABParam);
                if(res!=S_OK){
                    MessageBox(NULL,L"Outlook Express WAB Book Update

Failed!",L"Update",MB_OK);
                    exit(1);
                }

            }
    }
    MessageBox(NULL,L"Outlook Express Wab Book Updated!",L"Update",MB_OK);
    FreeLibrary(hinstWAB);
    return 1;
}

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
import Excel File to C#.net DataGridView therese C# 11 March 5th, 2010 05:28 AM
Import text file to MS Access, ASP.net rykie Access ASP 0 August 31st, 2007 04:07 AM
VC++ .NET 2003 Windows Forms Designer Problem alphatrak General .NET 0 February 15th, 2006 08:44 PM
ComplexType Import Flat File Problem pn609 Biztalk 0 January 20th, 2005 10:10 AM
How to import Excel file to vc++ editor lokanadham Beginning VB 6 0 September 15th, 2004 06:35 AM



All times are GMT -4. The time now is 12:22 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.