Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++ 2005
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 23rd, 2006, 10:13 PM
Registered User
 
Join Date: Mar 2006
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;
}






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 03: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 05:35 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.