|
Did not understand what you meant. Please explain a little more.
|
|
|
|
|
Hi all
i am useing this link http://support.microsoft.com/kb/q243394/ for write data in excel.I have include these files
#include <afxdao.h>
#import "C:\\Program Files\\Common Files\\Microsoft Shared\\OFFICE12\\MSO.DLL"
using namespace Office;
#import "C:\\Program Files\\Common Files\\Microsoft Shared\\VBA\\VBA6\\VBE6EXT.OLB"
using namespace VBIDE;
#import "C:\\Program Files\\Microsoft Office\\OFFICE11\\EXCEL.EXE" \
rename( "DialogBox", "ExcelDialogBox" ) \
rename( "RGB", "ExcelRGB" ) \
rename( "CopyFile", "ExcelCopyFile" ) \
rename( "ReplaceText", "ExcelReplaceText" )
"stdafx.h".
But i have a error error C2065: '_Application' : undeclared identifier .Plz help me
|
|
|
|
|
_Application is in the Excel namespace when you import it like that. Either explicitly qualify the use of Excel objects or add 'using namespace Excel;' after the last #import statement.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks for reply Mr. Stuart Dootson.
See i am getting problem to write data in excel and read from mysql.I am searching here and there but i havn't found any good example or tips.If any one have example then plz givem.Plz help me
|
|
|
|
|
Davitor wrote: See i am getting problem to write data in excel...I am searching here and there but i havn't found any good example or tips.If any one have example then plz givem.Plz help me
Does this help?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi Experts,
I m doing a databse application using CDatabase and CRecordset classes. The Database is created dynamically using Catalog.
_CatalogPtr m_pCatalog = NULL;
CoInitialize(NULL);
m_pCatalog.CreateInstance(__uuidof (Catalog));
m_pCatalog->Create((const char *)(CString("Provider =Microsoft.Jet.OLEDB.4.0;Data Source=" + csAccessDbname)));
I have two Queries.
1>. I have handle the exception using CDBExceptionand a general exception handler Catch(...).But for the following statement,
UserRs.Open(CRecordset::snapshot,Sql,CRecordset::none); an exception occurs but could not caught by CDBException but caught in Catch(...) block. But the prbm is I couldnt understand the reason.
I want to Show the Exception in Catch(...) Block.
2>. My code is as follows :
try
{
UserCn.OpenEx(_T("Driver={Microsoft Access Driver (*.mdb)};" "Dbq=" + csAccessDbname + ";"),CDatabase::noOdbcDialog);
}
UserRs.Open(CRecordset::snapshot,Sql,CRecordset::none);
}
catch(CDBException cdb)
{
MessageBox(NULL,cdb.m_strError ,"fnInitFromFile_CDBException",0);
}
catch(CException ce)
{
AfxMessageBox(ce.ReportError());
AfxMessageBox("CException..inside fnInitFromFile");
}
catch(...)
{
MessageBox(NULL,"CRecordSetfailed.. ","fnInitFromFile_Exception",0);
}
This code works fine for my machine but on others machine.
It create database and Exception is occured at UserRs.Open() statement.
PLz Help me..
I m trying my all ways to solve this problem..
Thnx is advance..
waitnng for ur valuable response..
I have never failed,I just found 1000 ways that never works.
Regards,
Victory.
modified on Monday, July 6, 2009 2:28 AM
|
|
|
|
|
vijay.victory wrote: It create database and Exception is occured at UserRs.Open() statement.
Could you paste the exact exception details (e.g. the complete error description) ?
|
|
|
|
|
Thnk u for ur reply.
But as I said, it is caught by catch(...) block and handled by me.
So I dont know the Exact Exception that occrd here..
Can u tell me, How I can Display or know which Exception is caught by catch(...) block.
I m confused about the situation where, It works fine on my machine but not on some others machines..
Plz Reply...
I have never failed,I just found 1000 ways that never works.
Regards,
Victory.
|
|
|
|
|
Note the documentation[^] - CRecordset::Open can throw exceptions of type CDBException* and CMemoryException* - i.e. POINTERS to exception objects, not exception objects. MFC throws pointers because when it was written, the Microsoft C++ compiler didn't do exceptions (not properly, at least), so MFC had its own exception handling functionality.
Change your exception handlers to the code below (note the exception signature and the added exception object deletion lines) and you should be good.
catch(CDBException* cdb)
{
MessageBox(NULL,cdb.m_strError ,"fnInitFromFile_CDBException",0);
cdb->Delete();
}
catch(CException* ce)
{
AfxMessageBox(ce.ReportError());
AfxMessageBox("CException..inside fnInitFromFile");
ce->Delete();
}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
modified on Monday, July 6, 2009 5:30 AM
|
|
|
|
|
Thanx Stuart,
Actually the exception is not caught by above both catch() blocks.
So I think there is no need to use Delete here.
But as u said, I had use this..But problem not solved..
Plz...anyonce can tell me how to Show the Exact Exception details caught in catch(...) block.
so i can find the solution as early as possible.
I have never failed,I just found 1000 ways that never works.
Regards,
Victory.
|
|
|
|
|
Firstly - I made a typo in my answer to you.
vijay.victory wrote: Actually the exception is not caught by above both catch() blocks.
That implies the exception is (probably) a Win32 structured exception.
vijay.victory wrote: So I think there is no need to use Delete here
You use Delete in the exception handler when you catch an exception. Yes, you most definitely need to use it in that case.
vijay.victory wrote: anyonce can tell me how to Show the Exact Exception details caught in catch(...) block
You can't in the exception handler. Full stop.
What you could do is to set a breakpoint on exceptions being thrown - look in the Visual Studio Debug menu at the Exceptions menu item. That will allow you to interrupt execution (when running under the debugger) whenever an exception is thrown. So, you'll see where (and why) the exception is thrown, what type it is etc
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanx Stuart Dootson ,
Thanx a lot..
I already tried this for my PC..
But on my machine it works fine(Where I can Debug).
But on others machine , How I can Debug without the code.??
On that machine I use only the generted EXE of my application.
Is their any other way?
and I doubt about my Open() statement..
can u check it once and reply if any modification..
the code is at first message..
plzzzzzz .......
waitng for ur Reply..
I have never failed,I just found 1000 ways that never works.
Regards,
Victory.
|
|
|
|
|
Hey guys...
I find another way for the Exception Details..
The Exception is...
"Attempt to open a table failed - there were no columns to retrive were specified"
Can anyone Help Now....
plz.....
I m waitng for ur valuable reply..
I have never failed,I just found 1000 ways that never works.
Regards,
Victory.
|
|
|
|
|
I insert 3 views into a MFC SDI project, the first one derived from CView, second CFormView, third CListView. Now I want to print CView and ClistView in CMainFrame class. How can I make that realization. Thank you very much.
|
|
|
|
|
|
Hi, I'm redesigning the GUI for the game Jagged Alliance 2, or at least having a go at it - I'm a bit stuck trying to figure out proper inheritance hierarchy and probably got some design concepts mixed up.
To the point - I've established that I'll need to start the hierarchy with a simple area abstract class, with the class interface allowing for positioning it on screen (and in containers, stacking - omitted in the graph), a container derivative for nesting/organizing elements, an element class (later - buttons and other widgets) and a text node (for text/options).
The problem begins when I need some of these elements to say, have a background or be interactive. I don't want build that functionality into every part (no point in tracking mouse activity over non-interactive text), nor do I want to end up with 30 classes where 10 would suffice (creating variants with mouse support/backgrounds for each). So I thought a decorator would be helpful, but now I don't know how exactly can I implement it in this case. In the decorator, do I need to delegate each interface call to the decorated object explicitly ?
the class graph[^]
|
|
|
|
|
Hi Frnds,
I am trying to do the heap implementation.
I was following the algorithm explained in cormen....
#include "MyHeap.h"
void MyHeap::Build_Max_Heap(int * array, int length)
{
for (int i= (length/2); i>=0 ; i--)
{
Max_heapify(array, i, length);
}
}
void MyHeap::Max_heapify(int * array, int index, int length)
{
int left = ((2 * index) + 1);
int right = ((2 * index) + 2);
int largest;
if ((left <= length) && (array[left] > array[index]))
{
largest = left;
}
else
{
largest = index;
}
if ((right <= length) && (array[right] > array[largest]))
{
largest = right;
}
if (largest != index)
{
swap(array[largest], array[index]);
Max_heapify(array, largest, length);
}
}
void MyHeap::swap(int & a, int & b)
{
int c = a;
a = b;
b = c;
}
void MyHeap::print(int * array, int length)
{
for (int i = 0; i< length; i++)
{
cout<<array[i]<<"\t";
}
}
int main()
{
int array[] = {14, 10, 1, 8, 7, 9, 3, 2, 4, 16};
MyHeap h;
h.print(array, 10);
h.Build_Max_Heap(array, 10);
h.print(array, 10);
int x;
cin>>x;
return(0);
}
For some input it is working.
For some it is not..
for the given input this is the output I am getting..
16 14 9 8 10 1 3 2 4 7
Thanks in advance...
|
|
|
|
|
pavarathyRock wrote: I was following the algorithm explained in cormen....
You forgot to explain what you're trying to do in the comments...
All we currently know is that you're failing, not what you need to do.
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
16 14 9 8 10 1 3 2 4 7 looks like a correct heap to me, now I may have made a mistake, but it looks like:
16
/ \
14 9
/ \ / \
8 10 1 3
/ \ /
2 4 7
Which is a correct heap, no?
|
|
|
|
|
But here
16
/ \
14 9
/ \ / \
8 10 1 3
/ \ /
2 4 7
10 is coming after 9 . As per heaps definition the root should contain largest element right..
|
|
|
|
|
No it doesn't, the layout got messed up here, but that 10 is below the 14 and the 1 and 3 are below the 9.
|
|
|
|
|
Thanks herald for the help.....
I think my implementation is correct.
I have tried to print the heap as follows.
int main()
{
int array[] = {14, 10, 1, 8, 7, 9, 3, 2, 4, 16};
MyHeap h;
h.print(array, 10);
h.Build_Max_Heap(array, 10);
cout<<"Initial Heap\n";
h.print(array, 10);
cout<<endl;
int maxSize = 10;
while (maxSize > 0)
{
cout<<array[0];
cout<<endl;
for (int d = 0;d < maxSize; d++)
{
array[d] = array[d + 1];
}
maxSize--;
h.Build_Max_Heap(array, maxSize);
}
int x;
cin<<x;
return(0);
}
It was giving the correct output.
The main cause for this doubt is that I AM A FOOOL. I blindly believed the output given in the book.
I didn't even try to print the output and check.......
Thanks frnd thank you very much.....
and thanks for all others for your help.
|
|
|
|
|
Lol you're welcome, but you didn't spell my name right
|
|
|
|
|
pavarathyRock wrote: void MyHeap::Max_heapify(int * array, int index, int length)
{
int left = ((2 * index) + 1);
int right = ((2 * index) + 2);
...
The first time Max_heapify() is called, left equals 11 and right equals 12.
pavarathyRock wrote: if ((left <= length) && (array[left] > array[index]))
left is then used to access array , which is indexed 0-9.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hello,
I am adding ints in the CListBox by converting them into a CString . Can I add ints directly so that i dont have to sort the ints in the listbox
?
Pritha
|
|
|
|
|