Click here to Skip to main content
16,006,768 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: ShowWindow() problem - MFC Pin
nguyenvhn19-May-04 18:18
nguyenvhn19-May-04 18:18 
GeneralRe: ShowWindow() problem - MFC Pin
J.B.19-May-04 18:57
J.B.19-May-04 18:57 
GeneralRe: ShowWindow() problem - MFC Pin
*Dreamz20-May-04 2:23
*Dreamz20-May-04 2:23 
GeneralRe: ShowWindow() problem - MFC Pin
J.B.20-May-04 3:26
J.B.20-May-04 3:26 
GeneralRe: ShowWindow() problem - MFC Pin
*Dreamz20-May-04 3:34
*Dreamz20-May-04 3:34 
GeneralRe: ShowWindow() problem - MFC Pin
J.B.20-May-04 5:16
J.B.20-May-04 5:16 
GeneralRe: ShowWindow() problem - MFC Pin
*Dreamz20-May-04 19:21
*Dreamz20-May-04 19:21 
GeneralA probelm of launching excel from C++ Pin
xiaosongxia19-May-04 16:18
xiaosongxia19-May-04 16:18 
VC++.net,excel 2000,
at first I import the lib as below#import "p:\ofc2000\program files\microsoft office\office\mso9.dll" no_namespace rename("DocumentProperties", "DocumentPropertiesXL")
#import "p:\ofc2000\program files\Common Files\Microsoft Shared\VBA\VBA6\vbe6ext.olb" no_namespace
#import "p:\ofc2000\program files\microsoft office\office\excel9.olb" rename("DialogBox", "DialogBoxXL") rename("RGB", "RBGXL") rename("DocumentProperties", "DocumentPropertiesXL") no_dual_interfaces
//#import "P:\ofc97\MSAPPS\VBA\vbeext1.olb" no_namespace
#pragma warning (disable:4192)

And the I open an exsiting spread sheet:
CLSID clsid;
HRESULT hr = CLSIDFromProgID(L"Excel.Application", &clsid);
if(FAILED(hr))
{
::MessageBox(NULL, "CLSIDFromProgID() failed", "Error", 0x10010);
return;
}
IDispatch *pXlApp;
hr = CoCreateInstance(clsid, NULL, CLSCTX_LOCAL_SERVER, IID_IDispatch, (void **)&pXlApp);
pXL.GetActiveObject(L"Excel.Application");
pXL.CreateInstance(L"Excel.Application");
pXL->Visible = VARIANT_TRUE;
pBook=pXL->Workbooks->Open(_T("H:\\xxs\\c++\\geopro\\Print2excel\\P2E\\Geofoam_Slope_Program.xls"));
DWORD aa=::GetLastError();
//Get the Second sheet.
pSheets = pBook->GetSheets();
pSheet = pSheets->GetItem(COleVariant(short(2)));

no error in compile and link,,
error occurs in running, I can open the spread sheet,problem comes from getting the second page of the sheets:GetItem(COleVariant(short(2)));

but this code can run in VC6.0 very well,and error comes from VC++.net,
Why??
Thank you, any suggestion is admired?

asfazxdfvzxvcxzcv
GeneralRe: A problem of launching excel from C++ Pin
Steve S19-May-04 22:37
Steve S19-May-04 22:37 
GeneralMFC and Menus Pin
Eversman19-May-04 16:16
Eversman19-May-04 16:16 
GeneralRe: MFC and Menus Pin
valikac19-May-04 18:31
valikac19-May-04 18:31 
GeneralRe: MFC and Menus Pin
Eversman20-May-04 2:45
Eversman20-May-04 2:45 
GeneralRe: MFC and Menus Pin
valikac20-May-04 5:21
valikac20-May-04 5:21 
GeneralRe: MFC and Menus Pin
Eversman20-May-04 9:36
Eversman20-May-04 9:36 
GeneralRe: MFC and Menus Pin
*Dreamz20-May-04 17:48
*Dreamz20-May-04 17:48 
Generalselect an item from a listctrl Pin
dadacncn19-May-04 13:12
dadacncn19-May-04 13:12 
GeneralRe: select an item from a listctrl Pin
nguyenvhn19-May-04 15:40
nguyenvhn19-May-04 15:40 
GeneralOnKeyDown & PropSheets Pin
Cambalindo19-May-04 12:40
Cambalindo19-May-04 12:40 
GeneralRe: onkeydown & PropSheets Pin
John R. Shaw19-May-04 12:56
John R. Shaw19-May-04 12:56 
GeneralRe: onkeydown & PropSheets Pin
Cambalindo19-May-04 13:01
Cambalindo19-May-04 13:01 
GeneralAccessing Image Data(BITMAP) Pin
mostafa_pasha19-May-04 9:33
mostafa_pasha19-May-04 9:33 
GeneralRe: Accessing Image Data(BITMAP) Pin
David Crow19-May-04 9:56
David Crow19-May-04 9:56 
GeneralRe: Accessing Image Data(BITMAP) Pin
mostafa_pasha19-May-04 10:09
mostafa_pasha19-May-04 10:09 
GeneralRe: Accessing Image Data(BITMAP) Pin
David Crow19-May-04 10:20
David Crow19-May-04 10:20 
GeneralRe: Accessing Image Data(BITMAP) Pin
mostafa_pasha19-May-04 10:26
mostafa_pasha19-May-04 10:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.