|
hey you !
not only you don't copy my code correctly, but you modify it wrngly and you vote my post without even knowing what you're talking about
go to hell with you macro. if you can't play with your compiler to test so things, and read the C++ doc, then don't expect me to answer you anyfurther.
|
|
|
|
|
Hi toxcct,
Actually your code does not compile, could you try please? I have tried twice. If there is any mistake I have made in the code, please feel free to let me know.
<br />
#define PREFIX(x) _T("FOO##x");<br />
<br />
<br />
int main()<br />
{<br />
<br />
const TCHAR* SecondArray [2] = {PREFIX(_T("FILE1")), PREFIX(_T("FILE2"))};<br />
<br />
TCHAR* p = NULL;<br />
p = SecondArray [0];<br />
p = SecondArray [1];<br />
<br />
<br />
return 0;<br />
}<br />
main.cpp(9) : error C2143: syntax error : missing '}' before ';'
main.cpp(9) : error C2143: syntax error : missing ';' before ','
main.cpp(12) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
main.cpp(12) : error C2040: 'p' : 'int' differs in levels of indirection from 'TCHAR *'
main.cpp(12) : error C2065: 'SecondArray' : undeclared identifier
main.cpp(13) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
main.cpp(13) : error C2040: 'p' : 'int' differs in levels of indirection from 'TCHAR *'
main.cpp(16) : error C2059: syntax error : 'return'
main.cpp(17) : error C2059: syntax error : '}'
main.cpp(17) : error C2143: syntax error : missing ';' before '}'
main.cpp(17) : error C2059: syntax error : '}'
regards,
George
|
|
|
|
|
George_George wrote: Actually your code does not compile, could you try please
you're an idiot, you cannot even copy paste correctly.
have you seen a ; after my macro definition ?
certainly not. that's certainly it though.
|
|
|
|
|
Be patient, mon ami
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.
|
|
|
|
|
all he deserves is let down on is crap
he doesn't even understand all we explain to him, but still he thinks he has the right to vote anyhow.
|
|
|
|
|
toxcct wrote: he doesn't even understand all we explain to him, but still he thinks he has the right to vote anyhow
I know, this is very unpleasant
BTW using the token-pasting operator with string is tricky, I had to fight a bit before finding the way out [^].
It was only for academical interest however: I keep thinking the search-replace tool of his IDE was more valuable there.
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.
|
|
|
|
|
Sorry, it is my carelessness. I have removed the ; sign and it works! Cool!
have a good weekend,
George
|
|
|
|
|
I want to change windows size of SDI project(CFromView).
what's function can support this issue
|
|
|
|
|
Do you tried already MoveWindow?
|
|
|
|
|
Hello,
Have you checked SetWindowPos() method of CWnd.That might help to change the size of the window .
Pritha
|
|
|
|
|
|
Hello,
Make your question clear Hamid?
Prithaa
|
|
|
|
|
|
Hello,
Oh Sorry, I thought you were asking a question about SetWindowPos().
Prithaa
|
|
|
|
|
Dont worry I think my answer was not clear.;)
|
|
|
|
|
Hello everyone,
I found that for an application, if I specify the entry point function (e.g. main), the performance of startup will be greatly improved.
My questions are,
1. If no entry point is specified, how will debugger of Visual Studio find the entry point function? Will the time to search entry point function long?
For example, in my application, I defined the main function like this,
int main(void)
how will debugger treat main as the start point to execute (I set a break point to this function if I do not specify the entry point, then after a couple of minutes after pressing F5 to trigger debugger, debugger will jumps to main)?
If I specify the entry point to main, then debugger will directly jumps to this function after F5 debugging.
2. Specify entry point is a way to improve performance?
thanks in advance,
George
|
|
|
|
|
George_George wrote: I found that for an application, if I specify the entry point function (e.g. main), the performance of startup will be greatly improved.
You are skipping the Windows-startup-code. That may or may not be a problem for a simple test application of a complexity comparable with "Hello World!". It will be for any real application.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
Hi jhwurmbach,
What are the startup code and the function of the code? Any impact if I skip it? Could you provide more information please?
regards,
George
|
|
|
|
|
The startup code is what makes you code into a windows-specific program.
You can get away without it, if your program e.g. gets some command-line arguments, reads a certain file and writes it back.
As long as you stick to old c-lib or C++-lib functions, there is no need to be windows proprietary.
If you want to read more, MSDN has topics about WinMain, CWinApp and "General MFC topics".
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
Hello,
I have a CDatabase object.
CDatabase CurrentDatabase;
The table has columns LOCATION,PRODUCTS,t,Demand
In the following "FirstQuarter" is the variable which will have the sum of Demand.
CString Query = CString("SELECT SUM(Demand) as ") +
"FirstQuarter" +
" FROM " +
TableDemand +
"WHERE LOCATION = Mumbai"+
"AND PRODUCT = LPG +
"t = Jan OR t=Feb OR t=Mar";
CurrentDatabase.ExecuteSQL(Query);
Now how can I get this variable FirstQuarter in my own variable?.
Pritha
|
|
|
|
|
_RecordsetPtr cReadText::GetRecordset(_bstr_t SQL)<br />
{<br />
<br />
pCommand.CreateInstance (__uuidof (Command));<br />
pCommand->ActiveConnection = m_pConn; <br />
pCommand->CommandText = SQL; <br />
pRecordset.CreateInstance (__uuidof (Recordset));<br />
pRecordset->CursorLocation = adUseClient;<br />
pRecordset->Open ( (IDispatch *) pCommand, vtMissing, adOpenStatic,adLockBatchOptimistic, adCmdUnknown);<br />
<br />
MessageBox(pRecordset->Fields->GetItem("FirstQuarter")->Value);<br />
return pRecordset;<br />
<br />
}<br />
try this,
i Hope this can help you.
|
|
|
|
|
Hello,
I have sort of understod but can you tell me the which type of objects are these pCommand,pRecordset .
Is _RecordsetPtr a MFC class ?
And how can I connect my object(of class CDatabase) with all of these objects?
Thanks
Prithaa
|
|
|
|
|
Hi, i am sending these types:
<br />
_ConnectionPtr m_pConn;<br />
_RecordsetPtr pRecordset;<br />
_CommandPtr pCommand;<br />
<br />
these code helps you to understand:<br />
<br />
<br />
void cReadText::ConnectionAdo() <br />
{<br />
bConnected = true;<br />
<br />
try <br />
{<br />
HRESULT hr = m_pConn.CreateInstance (__uuidof (Connection));<br />
<br />
if (FAILED (hr))<br />
{<br />
AfxMessageBox ("Can't create intance of Connection");<br />
}<br />
if (FAILED (m_pConn->Open (_bstr_t("Provider=Microsoft.Jet.OLEDB.4.0;Data Source = <big>EmailReminder.mdb</big>;"),<br />
_bstr_t (""), _bstr_t (""), adModeUnknown)))<br />
{<br />
AfxMessageBox ("Can't open datasource");<br />
} <br />
}<br />
catch( _com_error &e )<br />
{<br />
_bstr_t bstrSource(e.Source());<br />
_bstr_t bstrDescription(e.Description());<br />
TRACE( "Exception thrown for classes generated by #import" );<br />
TRACE( "\tCode = %08lx\n", e.Error());<br />
TRACE( "\tCode meaning = %s\n", e.ErrorMessage());<br />
TRACE( "\tSource = %s\n", (LPCTSTR) bstrSource);<br />
TRACE( "\tDescription = %s\n", (LPCTSTR) bstrDescription);<br />
AfxMessageBox ((LPCTSTR) bstrDescription);<br />
AfxMessageBox ((LPCTSTR) e.Source());<br />
<br />
<br />
bConnected = false;<br />
<br />
}<br />
catch (...)<br />
{<br />
bConnected = false;<br />
}<br />
<br />
<br />
}<br />
<br />
void cReadText::RunCammand(_bstr_t SQL)<br />
{<br />
<br />
m_pConn->Execute(SQL,NULL,adExecuteNoRecords);<br />
<br />
}<br />
<br />
_RecordsetPtr cReadText::GetRecordset(_bstr_t SQL)<br />
{<br />
<br />
pCommand.CreateInstance (__uuidof (Command));<br />
pCommand->ActiveConnection = m_pConn; <br />
pCommand->CommandText = SQL; <br />
pRecordset.CreateInstance (__uuidof (Recordset));<br />
pRecordset->CursorLocation = adUseClient;<br />
pRecordset->Open ( (IDispatch *) pCommand, vtMissing, adOpenStatic,adLockBatchOptimistic, adCmdUnknown);<br />
return pRecordset;<br />
<br />
}<br />
<br />
|
|
|
|
|
Hi All,
Please help me to solve my problem.
I've an MFC ActiveX control(.OCX) and i created this control in one of my Extension Dll's View class(derived from CView).This view has been placed in the SDI Splitter window application as one of the view.Every thing is working fine but when i close the Application window i'm getting the Assertion in "Release" Configuration but the assertion is not in "Debug" configuration.when i check with message boxes ,all the destructors are called in order. After all destructors completed i'm getting Assertion.
Can any one give me the Solution for my problem. Thanks in Advance.
|
|
|
|
|