|
If you want to play avi file or even your pictures you can use of MCI functions however you dont need to use of MCI functions for pictures.
|
|
|
|
|
hi i m usng the below code for writing data to excel from vc++
but the saved file is not in good format.
can anyone suggest a gud one?
UpdateData(TRUE);
ofstream o;
char ch[101];
o.open("D:\\tdy1",ios::app);
int s, s1;
s = m_edit1.GetLength();
strcpy(ch,"\n");
o.write(ch,2);
strcpy(ch,m_edit1);
o.write(ch,s);
strcpy(ch,"\t");
o.write(ch,2);
s1 = m_edit2.GetLength();
strcpy(ch,m_edit2);
o.write(ch,s1);
o.close();
|
|
|
|
|
hellogany wrote: hi i m usng the below code for writing data to excel from vc++
1) no, you're not - you're writing to a file you hope excel can read - since D:\tdy1 has no extension and you're likely not doing a file import, excel wont have a clue how to read the data.
2) your use of ostream is an abomination !!!
how about :-
ofstream o;
o.open("D:\\tdy1.csv", ios::app);
if (!o.is_open())
{
cout << "Cant Open D:\\tdy1.csv For Output" << endl;
return -1;
}
o << m_edit1.GetLength() << "," << m_edit1 << endl;
o << m_edit2.GetLength() << "," << m_edit2 << endl;
o.close();
Because Excel knows how to read a file with a .csv extension, you should see 2 x 2 rows/columns with your data
'g'
|
|
|
|
|
i tried savin in xls format
but whil openin the excel file, it is showing " the file format is not recognisable"
|
|
|
|
|
so what makes you think those values you are saving constitute the Excel .xls format ? - they dont
if you dont like the help Ive offered, learn to use a textbook or google for instance
modified on Monday, November 17, 2008 6:42 AM
|
|
|
|
|
Garth J Lancaster wrote: if you dont like the help Ive offered, learn to use a textbook, google for instance
Hey Garth, is Google a textbook now?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
you cheeky so and so corrected, replaced ',' with 'or'
sorry, I was a bit exasperated
reminder to self, must not post on CP when work hours > 14
'g'
|
|
|
|
|
Garth J Lancaster wrote: reminder to self, must not post on CP when work hours > 14
Wow, I usually work no more than 6 hours per day
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
HI all,
i m using the below code , but the result saves in another excel file.
can anyone suggest y it happens?
_Application app;
Workbooks books;
_Workbook book;
Worksheets sheets;
_Worksheet s;
Range range;
Font font;
Range cols;
LPDISPATCH lpDisp; // Often reused variable.
// Commonly used OLE variants.
COleVariant
covTrue((short)TRUE),
covFalse((short)FALSE),
covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
// Start Excel and get Application object.
if(!app.CreateDispatch("Excel.Application"))
{
AfxMessageBox("Couldn't start Excel and get Application object.");
return;
}
lpDisp = app.GetWorkbooks(); // Get an IDispatch pointer.
ASSERT(lpDisp);
books.AttachDispatch(lpDisp); // Attach the IDispatch pointer
// to the books object.
// Open a new workbook and attach that IDispatch pointer to the
// Workbook object
lpDisp = books.Add( covOptional );
ASSERT(lpDisp);
book.AttachDispatch( lpDisp );
lpDisp = books.Open("D:\\test.xls",
covOptional, covFalse, covTrue, covOptional,
covOptional, covTrue, covOptional, covOptional,
covTrue, covOptional, covOptional, covOptional,
covOptional, covOptional);
// Get the Sheets collection and attach the IDispatch pointer to your
// sheets object.
*/
/* lpDisp = book.GetSheets();
ASSERT(lpDisp);
sheets.AttachDispatch(lpDisp);
// Get *** #1 and attach the IDispatch pointer to your ***
// object.
lpDisp = sheets.GetItem( COleVariant((short)(1)) );
//GetItem(const VARIANT &index)
ASSERT(lpDisp);
s.AttachDispatch(lpDisp);
// Fill range A1 with "1/25/98", the settlement date.
lpDisp =s.GetRange(COleVariant("A1"), COleVariant("A1"));
ASSERT(lpDisp);
range.AttachDispatch(lpDisp);
range.SetValue2(COleVariant("change")); // Excel 2002 and Excel 2003
// checking for the particular cell if it's empty
VARIANT value1;
char str[]="A";
char strf[]="";
int i = 1;
char str1[10];
_itoa(i,str1,10);
strcpy(strf,str);
strcat(strf,str1);
range = s.GetRange(COleVariant(strf),COleVariant(strf));
value1 = range.GetValue2();
while(!value1.vt == VT_EMPTY)
{
i++;
_itoa(i,str1,10);
strcpy(strf,str);
strcat(strf,str1);
range = s.GetRange(COleVariant(strf),COleVariant(strf));
value1 = range.GetValue2();
}
range.SetValue2(COleVariant("Country"));
book.Save();
{
COleSafeArray saRet;
saRet.Detach();
}
app.SetVisible(TRUE);
app.SetUserControl(TRUE);
|
|
|
|
|
I can access all data from a single table.But If I want to access selected data from multiple tables then I get an error after executing.
ERROR: ORA-00903: invalid table name
DSN Name: om_ebridge.
Oracle User Name: SCOTT
Table Names: Transaction_Master,Transporter_Master,Supplier_Master,Product_Master.
CString CMyebridgeSet::GetDefaultConnect()
{
return _T("ODBC;DSN=om_ebridge");
}
CString CMyebridgeSet::GetDefaultSQL()
{
//return _T("[SCOTT].[TRANSACTION_MASTER]");(works to access data from single table.)
-------------------------
(But ERROR occurs if the below mentioned INNER JOIN is used to access selected data from multiple tables .Can you please help me access data).
return _T("SELECT TRANSACTION_MASTER.TRANSACTION_CODE,TRANSACTION_MASTER.VEHICLE_NO,TRANSACTION_MASTER.OPERATING_MODE,")
_T("TRANSPORTER_MASTER.transporter_name,SUPPLIER_MASTER.SUPPLIER_NAME,")
_T("PRODUCT_MASTER.PRODUCT_NAME,TRANSACTION_MASTER.unit,TRANSACTION_MASTER.Gross_Wt,TRANSACTION_MASTER.Gross_WtTime,")
_T("TRANSACTION_MASTER.Tare_Wt,TRANSACTION_MASTER.Tare_WtTime,TRANSACTION_MASTER.CONTAINER1_TAREWT,")
_T("TRANSACTION_MASTER.CONTAINER2_TAREWT ,TRANSACTION_MASTER.net_Wt,TRANSACTION_MASTER.Challan_no,TRANSACTION_MASTER.Challan_Wt,")
_T("TRANSACTION_MASTER.No_Of_Units,TRANSACTION_MASTER.Calculated_Wt,TRANSACTION_MASTER.Formula1,")
_T("TRANSACTION_MASTER.Formula2,TRANSACTION_MASTER.Formula3,TRANSACTION_MASTER.Formula4,")
_T(" TRANSACTION_MASTER.location_code,TRANSACTION_MASTER.field1,TRANSACTION_MASTER.field2,TRANSACTION_MASTER.field3 ")
_T("from PRODUCT_MASTER INNER JOIN SUPPLIER_MASTER INNER JOIN TRANSACTION_MASTER")
_T("ON SUPPLIER_MASTER.SUPPLIER_CODE =TRANSACTION_MASTER.SUPPLIER_CODE")
_T("ON PRODUCT_MASTER.PRODUCT_CODE=TRANSACTION_MASTER.PRODUCT_CODE")
_T("INNER JOIN TRANSPORTER_MASTER ON TRANSPORTER_MASTER.TRANSPORTER_CODE=TRANSACTION_MASTER.TRANSPORTER_CODE ");
}
|
|
|
|
|
Divya Lalwani wrote: ERROR: ORA-00903: invalid table name
So what do you not understand about this? Look at each table you are referencing. At least one of them is invalid.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
|
hi,
maybe you can override "preTh...." function of dialog's parent windows, and send message to this dialog!
|
|
|
|
|
your means is this:
BOOL CDlg::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_MOUSEMOVE)
{
SendMessage(WM_USERMOVE,0,0);
}
return CDialog::PreTranslateMessage(pMsg);
}
-------------
LRESULT CMap::OnUserMove(WPARAM wp, LPARAM lp)
{
m_tooltip.RelayEvent(pMsg);
return TRUE;
}
|
|
|
|
|
You can use the GetCurrentMessage function.
If you vote me down, my score will only get lower
|
|
|
|
|
hi,
thanku for your reply,can i do like this?
LRESULT CMap::OnUserMove(WPARAM wp, LPARAM lp)
{
MSG* pMsg = GetCur...; // is this your meanings?
m_tooltip.RelayEvent(pMsg);
return TRUE;
}
thanku again!
|
|
|
|
|
hi,
is your question how to get the information of "pMsg"?
there are two method, maybe answer your request.
1. refer to 'sendmessage' function, it can take information of msg to receiptor like that:
" sendmessage(WM_xxx, wp,lp);"
then , in function "OnusrMove(wp,lp)", you use the parameter of 'wp/lp' to do something.
2. in ' pretranslatemessage' function, call the process 'mousemove' straight.
|
|
|
|
|
hi,
thanku for your reply,but another problem again...
1.the pMsg is MSG* type,and wp or lp is DWORD type, is this can convert to each other?
2.in Pretrans...,can i do like this? -->
... ::Pretrans..(MSG* pMsg)
{
if( ... == wm_mousemove)
{
CMyChildDlg.m_tooltips.RelayEvent(pMsg); // is this ok?
}
...
}
thanks again!
|
|
|
|
|
hi,
1. read the structure of msg in detail,
typedef struct tagMSG {
HWND hwnd;
UINT message;
WPARAM wParam;
LPARAM lParam;
DWORD time;
POINT pt;
#ifdef _MAC
DWORD lPrivate;
#endif
} MSG, *PMSG, NEAR *NPMSG, FAR *LPMSG;
wp is pMsg->wPar...
lp is pMsg->lP...
2. maybe yes, i did't check this code. you try to test it.
|
|
|
|
|
hi,
1. for pMsg, there are some other params, just only send/post wp and lp can resolve the problem?
2. ok, i will test it.but cannot now.
thank u again!
|
|
|
|
|
|
I have downdload the the fantastic control named cgfxoutbarctrl,
at http://www.codeguru.com/controls/outbar.shtml[^],now I try to chang the right view of CGfxSplitterWnd(derived from CSplitterWnd).But exception occurs when
runing it and the dialog displays "Unhandled exception in filetitle.exe(MFC42D.DLL):0x0000005 Access Violation".I found the hWnd=??? in the class pointer during debug.
Fllowing is my own code ,please tell me what's wrong with it and how to correct,thanks!!
<br />
void CMySplitterWnd::ChangeView(int row, int col, CRuntimeClass* pViewClass)<br />
{<br />
ASSERT(pViewClass->IsDerivedFrom(RUNTIME_CLASS(CView)));<br />
<br />
CView* pView = STATIC_DOWNCAST(CView, GetPane(row, col));<br />
CFrameWnd* pFrame = pView->GetParentFrame();<br />
ASSERT(pFrame);<br />
<br />
CCreateContext cc;<br />
memset(&cc, 0, sizeof(cc));<br />
cc.m_pNewViewClass = pViewClass;<br />
cc.m_pCurrentDoc = pView->GetDocument();<br />
cc.m_pNewDocTemplate = cc.m_pCurrentDoc ?<br />
cc.m_pCurrentDoc->GetDocTemplate() : NULL;<br />
cc.m_pCurrentFrame = pFrame;<br />
<br />
DeleteView(row, col);
TRACE("Rows=%d,Columns=%d",GetRowCount,GetColumnCount);<br />
VERIFY(CreateView(row, col,
pViewClass,<br />
CSize(0,0),
&cc));<br />
<br />
RecalcLayout();
<br />
CWnd* pWnd = GetPane(row, col);<br />
if (pWnd)<br />
pWnd->SendMessage(WM_INITIALUPDATE);<br />
}<br />
<br />
|
|
|
|
|
Hi all,
please tell me how can i save value of COLORREF type variable in access databse.
what type of variable use for this?
please help me for this.
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
|
COLORREF is defined as typedef DWORD COLORREF;
-Saurabh
|
|
|
|
|