|
Think of the fact that GetOpenFileName changes current directory. So after using common dialogs it should be checked what file SQLite functions work with.
|
|
|
|
|
This could really be the answer ! But I should exhume the code wherever it is now, after three years.
However this seems an useful clue. Thanks.
|
|
|
|
|
Hello,
How can I read excel file through VC++ ? Which topics should I refer so that it enables me to read an excel file and put output on the excel sheet .
Is Visual Basic necessary for the same? since I don't know anything of Visual Basic.
Thanks
Prithaa
|
|
|
|
|
You could use Automation to read and write to excel sheets, even in VC++.
Search for "Excel Automation"
|
|
|
|
|
http://www.codeproject.com/database/cspreadsheet.asp
Thats just one I found in a quick search.
|
|
|
|
|
In addition to automation, you could also use ODBC.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I have the following macro in a message map that compiles and works just fine under version 6.
ON_NOTIFY(DTN_DATETIMECHANGE, IDC_CALENDAR, OnDateTimeChangeNotify)
But when I compile the source under vs 2005, I get the following error message,
error C2440: 'static_cast' : cannot convert from 'void (__thiscall CurrencyPrices::* )(LPNMDATETIMECHANGE,LRESULT *)' to 'void (__thiscall CCmdTarget::* )(NMHDR *,LRESULT *)' CurrencyPrices is the dialog class that implements this message map and one of the controls on the dialog is a DateTime control. From the error message, it's just not clear to me what I have to change. I'm pretty sure that the problem relates to casting from LPNDATETIMECHANGE to a NMHDR*, but I'm not sure. Thanks.
Chris Meech
I am Canadian. [heard in a local bar]
I agree with you that my argument is useless. [Red Stateler]
Hey, I am part of a special bread, we are called smart people [Captain See Sharp]
The zen of the soapbox is hard to attain...[Jörgen Sigvardsson]
I wish I could remember what it was like to only have a short term memory.[David Kentley]
|
|
|
|
|
Didn't ON_NOTIFY callback prototype changed in VS2005 ?
check the prototype of OnDateTimeChangeNotify
|
|
|
|
|
Thanks Maximilien. I think you are correct. I dug into the docs and found this about ON_NOTIFY
afx_msg void memberFxn( NMHDR * pNotifyStruct, LRESULT * result ); It does look as though the first parameter is to be a NMHDR*. I'll make the change and know soon enough.
Thanks again.
Chris Meech
I am Canadian. [heard in a local bar]
I agree with you that my argument is useless. [Red Stateler]
Hey, I am part of a special bread, we are called smart people [Captain See Sharp]
The zen of the soapbox is hard to attain...[Jörgen Sigvardsson]
I wish I could remember what it was like to only have a short term memory.[David Kentley]
|
|
|
|
|
What is the safest way to convert a BSTR to a std::string?
FF
|
|
|
|
|
You could add the result from this to your string buffer:
_com_util::ConvertBSTRToString( yourBstr )
|
|
|
|
|
I`m creating an MFC application. I use a modal dialogbox to configure some settings. To read a configuration file i`ve placed this code in the OnActivate event of dialogbox:
<code>
void CPortConfig::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
{
CDialog::OnActivate(nState, pWndOther, bMinimized);
// TODO: Add your message handler code here
FILE *conffile;
errno_t err;
char tempbuffer[40];
char portname[10];
char baudrate[10];
char flowcontrol[10];
err = fopen_s(&conffile,"..//conffile.dat","r");
if(err !=0)
{
MessageBox(Configuration file not found!\nCreating new one..","Port configuration",MB_OK|MB_ICONERROR);
fopen_s(&conffile,"..//conffile.dat","a+");
fputs("COM1\t9600\tNone\n",conffile);
fclose(conffile);
err = 0;
}
fopen_s(&conffile,"..//conffile.dat","r");
fgets(tempbuffer,40,conffile);
sscanf(tempbuffer,"%s%*[\t\r]%s%*[\t\r]%s",portname,baudrate,flowcontrol);
fcloseall();
this->c_baudrate.SelectString(0,baudrate);
this->v_portname = portname;
this->v_flowcontrol = flowcontrol;
UpdateData(false);
}
</code>
In case when the file doe`s exist everything is OK, but when there is no file, I get the message box displayed on and on and on.I`ve figured out this far, that this part of code is being executed in a loop:
<code>
if(err !=0)
{
MessageBox("Port configuration",
"Configuration file not found!\nCreating new one..",
MB_OK|MB_ICONERROR);
fopen_s(&conffile,"..//conffile.dat","a+");
fputs("COM1\t9600\tNone\n",conffile);
fclose(conffile);
}
</code>
because every time i press OK on the messagebox the line "COM1\t9600\tNone\n" is added to the file.
There is no chance to close the application, only way to do it it using "End task"..
Please help me out with this ! What am I doing wrong?
-- modified at 11:20 Monday 27th November, 2006
|
|
|
|
|
Don't put your initialization code in OnActivate put it in OnInitDialog.
When your message box is dismissed a message is sent to the dialog telling it to activate however this causes the dialog to call OnActivate before your file creation code can execute to create a file.
|
|
|
|
|
Thanx! I was suspecting this to be the cause. Hope this will solve my problem!
|
|
|
|
|
Hi all,
how can I change the font in a RichEdit2 Control to Terminal?
I tried this, but the displayed font is not Terminal.
CHARFORMAT cf;
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_FACE | CFM_SIZE; // makes szFaceName and yHeight valid
cf.yHeight = 9 * 20; // in TWIPS, 20 twips per point
//cf.bPitchAndFamily = FIXED_PITCH;
cf.bCharSet = OEM_CHARSET;
::lstrcpy (cf.szFaceName, "Terminal");
m_pRichEdit->SetSelectionCharFormat(cf);
Thanks
|
|
|
|
|
Has no one any ideas or is it to easy ?
I'm trying to solve this problem since hours. It must be possible.
In Borland Delphi it's no problem, but I have to do this in VC++.
|
|
|
|
|
My understanding of how to use the rich edit is that you have to first select the text for which you wish to change the font.
I found the following code in a program that I wrote some time ago:
CHARRANGE CharRange ;
CHARFORMAT2 CharFormat ;
// To format the text just written, we must select it.
::SendMessage(
m_hwndThis,
EM_SETSEL,
0,
CharRange.cpMax) ; //'cpMax' set to LAST character position.
// Set up the character formatting structure.
CharFormat.cbSize = sizeof(CharFormat) ;
CharFormat.dwMask = CFM_BOLD | CFM_COLOR | CFM_ITALIC ;
CharFormat.dwEffects = (bBold) ? CFE_BOLD : 0 |
(bItalic) ? CFE_ITALIC : 0 ;
CharFormat.yHeight = 0 ;
CharFormat.yOffset = 0 ;
CharFormat.crTextColor = clrFG ; //Previously set
CharFormat.bCharSet = DEFAULT_CHARSET ;
CharFormat.bPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE ;
memset(CharFormat.szFaceName, 0, 1) ;
_tcscpy((_TCHAR*)&CharFormat.szFaceName, _T("Arial")) ;
// Format the text just written.
::SendMessage(
m_hwndThis,
EM_SETCHARFORMAT,
SCF_SELECTION,
(LPARAM)&CharFormat) ;
Don't know if this will help, but maybe it will give you some ideas where to continue.
Scott
|
|
|
|
|
I have writen a program :
#include <string>
using namespace std;
int main()
{
string a("a");
return 0;
}
when i compile it
then it is the result :
--------------------Configuration: abc - Win32 Debug--------------------
Compiling...
abc.cpp
c:\program files\microsoft visual studio\vc98\include\xstring(600) : error C2838: illegal qualified name in member declaration
c:\program files\microsoft visual studio\vc98\include\xstring(618) : see reference to class template instantiation 'std::basic_string<_E,_Tr,_A>' being compiled
c:\program files\microsoft visual studio\vc98\include\stdexcept(19) : error C2629: unexpected 'class std::logic_error ('
c:\program files\microsoft visual studio\vc98\include\stdexcept(19) : error C2334: unexpected token(s) preceding ':'; skipping apparent function body
c:\program files\microsoft visual studio\vc98\include\stdexcept(29) : error C2146: syntax error : missing ';' before identifier '_Str'
c:\program files\microsoft visual studio\vc98\include\stdexcept(29) : error C2501: 'string' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\stdexcept(29) : error C2501: '_Str' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\stdexcept(34) : error C2629: unexpected 'class std::domain_error ('
c:\program files\microsoft visual studio\vc98\include\stdexcept(34) : error C2334: unexpected token(s) preceding ':'; skipping apparent function body
c:\program files\microsoft visual studio\vc98\include\stdexcept(45) : error C2629: unexpected 'class std::invalid_argument ('
c:\program files\microsoft visual studio\vc98\include\stdexcept(45) : error C2334: unexpected token(s) preceding ':'; skipping apparent function body
c:\program files\microsoft visual studio\vc98\include\stdexcept(56) : error C2629: unexpected 'class std::length_error ('
c:\program files\microsoft visual studio\vc98\include\stdexcept(56) : error C2334: unexpected token(s) preceding ':'; skipping apparent function body
c:\program files\microsoft visual studio\vc98\include\stdexcept(67) : error C2629: unexpected 'class std::out_of_range ('
c:\program files\microsoft visual studio\vc98\include\stdexcept(67) : error C2334: unexpected token(s) preceding ':'; skipping apparent function body
c:\program files\microsoft visual studio\vc98\include\stdexcept(78) : error C2629: unexpected 'class std::runtime_error ('
c:\program files\microsoft visual studio\vc98\include\stdexcept(78) : error C2334: unexpected token(s) preceding ':'; skipping apparent function body
c:\program files\microsoft visual studio\vc98\include\stdexcept(88) : error C2146: syntax error : missing ';' before identifier '_Str'
c:\program files\microsoft visual studio\vc98\include\stdexcept(88) : error C2501: 'string' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\stdexcept(88) : error C2501: '_Str' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\stdexcept(93) : error C2629: unexpected 'class std::overflow_error ('
c:\program files\microsoft visual studio\vc98\include\stdexcept(93) : error C2334: unexpected token(s) preceding ':'; skipping apparent function body
c:\program files\microsoft visual studio\vc98\include\stdexcept(104) : error C2629: unexpected 'class std::underflow_error ('
c:\program files\microsoft visual studio\vc98\include\stdexcept(104) : error C2334: unexpected token(s) preceding ':'; skipping apparent function body
c:\program files\microsoft visual studio\vc98\include\stdexcept(115) : error C2629: unexpected 'class std::range_error ('
c:\program files\microsoft visual studio\vc98\include\stdexcept(115) : error C2334: unexpected token(s) preceding ':'; skipping apparent function body
c:\program files\microsoft visual studio\vc98\include\xlocinfo(39) : error C2039: '_Collvec' : is not a member of '`global namespace''
c:\program files\microsoft visual studio\vc98\include\xlocinfo(39) : error C2146: syntax error : missing ';' before identifier '_Collvec'
c:\program files\microsoft visual studio\vc98\include\xlocinfo(39) : error C2868: '_Collvec' : illegal syntax for using-declaration; expected qualified-name
c:\program files\microsoft visual studio\vc98\include\xlocinfo(40) : error C2039: '_Ctypevec' : is not a member of '`global namespace''
c:\program files\microsoft visual studio\vc98\include\xlocinfo(40) : error C2146: syntax error : missing ';' before identifier '_Ctypevec'
c:\program files\microsoft visual studio\vc98\include\xlocinfo(40) : error C2868: '_Ctypevec' : illegal syntax for using-declaration; expected qualified-name
c:\program files\microsoft visual studio\vc98\include\xlocinfo(41) : error C2039: '_Cvtvec' : is not a member of '`global namespace''
c:\program files\microsoft visual studio\vc98\include\xlocinfo(41) : error C2146: syntax error : missing ';' before identifier '_Cvtvec'
c:\program files\microsoft visual studio\vc98\include\xlocinfo(41) : error C2868: '_Cvtvec' : illegal syntax for using-declaration; expected qualified-name
c:\program files\microsoft visual studio\vc98\include\xlocinfo(47) : error C2146: syntax error : missing ';' before identifier '_Getname'
c:\program files\microsoft visual studio\vc98\include\xlocinfo(47) : error C2501: 'string' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\xlocinfo(48) : warning C4183: '_Getname': member function definition looks like a ctor, but name does not match enclosing class
c:\program files\microsoft visual studio\vc98\include\xlocinfo(85) : error C2146: syntax error : missing ';' before identifier '_Days'
c:\program files\microsoft visual studio\vc98\include\xlocinfo(85) : error C2501: 'string' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\xlocinfo(85) : error C2501: '_Days' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\xlocinfo(85) : error C2501: '_Months' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\xlocinfo(85) : error C2501: '_Oname' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\xlocinfo(85) : error C2501: '_Nname' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\xlocale(86) : error C2146: syntax error : missing ';' before identifier '_Name'
c:\program files\microsoft visual studio\vc98\include\xlocale(86) : error C2501: 'string' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\xlocale(86) : error C2501: '_Name' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\xlocale(90) : error C2143: syntax error : missing ',' before '&'
c:\program files\microsoft visual studio\vc98\include\xlocale(90) : error C2059: syntax error : '&'
c:\program files\microsoft visual studio\vc98\include\xlocale(112) : error C2146: syntax error : missing ';' before identifier 'name'
c:\program files\microsoft visual studio\vc98\include\xlocale(112) : error C2501: 'string' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\xlocale(113) : warning C4183: 'name': member function definition looks like a ctor, but name does not match enclosing class
c:\program files\microsoft visual studio\vc98\include\xiosbase(19) : error C2504: 'runtime_error' : base class undefined
c:\program files\microsoft visual studio\vc98\include\xiosbase(21) : error C2629: unexpected 'class std::ios_base::failure ('
c:\program files\microsoft visual studio\vc98\include\xiosbase(21) : error C2334: unexpected token(s) preceding ':'; skipping apparent function body
c:\program files\microsoft visual studio\vc98\include\xiosbase(118) : error C2146: syntax error : missing ';' before identifier 'getloc'
c:\program files\microsoft visual studio\vc98\include\xiosbase(118) : error C2501: 'locale' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\xiosbase(119) : warning C4183: 'getloc': member function definition looks like a ctor, but name does not match enclosing class
c:\program files\microsoft visual studio\vc98\include\xiosbase(120) : error C2146: syntax error : missing ';' before identifier 'imbue'
c:\program files\microsoft visual studio\vc98\include\xiosbase(120) : error C2501: 'locale' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\xiosbase(120) : error C2143: syntax error : missing ',' before '&'
c:\program files\microsoft visual studio\vc98\include\xiosbase(120) : error C2059: syntax error : '&'
c:\program files\microsoft visual studio\vc98\include\xiosbase(168) : error C2146: syntax error : missing ';' before identifier '_Loc'
c:\program files\microsoft visual studio\vc98\include\xiosbase(168) : error C2501: 'locale' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\xiosbase(168) : error C2501: '_Loc' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\xlocnum(21) : error C2653: 'locale' : is not a class or namespace name
c:\program files\microsoft visual studio\vc98\include\xlocnum(69) : see reference to class template instantiation 'std::numpunct<_E>' being compiled
c:\program files\microsoft visual studio\vc98\include\xlocnum(21) : error C2504: 'facet' : base class undefined
c:\program files\microsoft visual studio\vc98\include\xlocnum(69) : see reference to class template instantiation 'std::numpunct<_E>' being compiled
c:\program files\microsoft visual studio\vc98\include\xlocnum(26) : error C2653: 'locale' : is not a class or namespace name
c:\program files\microsoft visual studio\vc98\include\xlocnum(69) : see reference to class template instantiation 'std::numpunct<_E>' being compiled
c:\program files\microsoft visual studio\vc98\include\xlocnum(26) : error C2146: syntax error : missing ';' before identifier 'id'
c:\program files\microsoft visual studio\vc98\include\xlocnum(69) : see reference to class template instantiation 'std::numpunct<_E>' being compiled
c:\program files\microsoft visual studio\vc98\include\xlocnum(26) : error C2501: 'id' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\xlocnum(69) : see reference to class template instantiation 'std::numpunct<_E>' being compiled
c:\program files\microsoft visual studio\vc98\include\xlocnum(31) : error C2146: syntax error : missing ';' before identifier 'grouping'
c:\program files\microsoft visual studio\vc98\include\xlocnum(69) : see reference to class template instantiation 'std::numpunct<_E>' being compiled
c:\program files\microsoft visual studio\vc98\include\xlocnum(31) : error C2501: 'string' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\xlocnum(69) : see reference to class template instantiation 'std::numpunct<_E>' being compiled
c:\program files\microsoft visual studio\vc98\include\xlocnum(32) : warning C4183: 'grouping': member function definition looks like a ctor, but name does not match enclosing class
c:\program files\microsoft visual studio\vc98\include\xlocnum(69) : see reference to class template instantiation 'std::numpunct<_E>' being compiled
c:\program files\microsoft visual studio\vc98\include\xlocnum(39) : error C2629: unexpected 'class std::numpunct<_E> ('
c:\program files\microsoft visual studio\vc98\include\xlocnum(69) : see reference to class template instantiation 'std::numpunct<_E>' being compiled
c:\program files\microsoft visual studio\vc98\include\xlocnum(39) : error C2334: unexpected token(s) preceding ':'; skipping apparent function body
c:\program files\microsoft visual studio\vc98\include\xlocnum(69) : see reference to class template instantiation 'std::numpunct<_E>' being compiled
c:\program files\microsoft visual studio\vc98\include\xlocnum(49) : error C2143: syntax error : missing ',' before '&'
c:\program files\microsoft visual studio\vc98\include\xlocnum(69) : see reference to class template instantiation 'std::numpunct<_E>' being compiled
c:\program files\microsoft visual studio\vc98\include\xlocnum(49) : error C2059: syntax error : '&'
c:\program files\microsoft visual studio\vc98\include\xlocnum(69) : see reference to class template instantiation 'std::numpunct<_E>' being compiled
c:\program files\microsoft visual studio\vc98\include\xlocnum(60) : error C2146: syntax error : missing ';' before identifier 'do_grouping'
c:\program files\microsoft visual studio\vc98\include\xlocnum(69) : see reference to class template instantiation 'std::numpunct<_E>' being compiled
c:\program files\microsoft visual studio\vc98\include\xlocnum(60) : error C2433: 'string' : 'virtual' not permitted on data declarations
c:\program files\microsoft visual studio\vc98\include\xlocnum(69) : see reference to class template instantiation 'std::numpunct<_E>' being compiled
c:\program files\microsoft visual studio\vc98\include\xlocnum(60) : error C2501: 'string' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\xlocnum(69) : see reference to class template instantiation 'std::numpunct<_E>' being compiled
c:\program files\microsoft visual studio\vc98\include\xlocnum(61) : warning C4183: 'do_grouping': member function definition looks like a ctor, but name does not match enclosing class
c:\program files\microsoft visual studio\vc98\include\xlocnum(69) : see reference to class template instantiation 'std::numpunct<_E>' being compiled
c:\program files\microsoft visual studio\vc98\include\xlocnum(83) : error C2653: 'locale' : is not a class or namespace name
c:\program files\microsoft visual studio\vc98\include\xlocnum(83) : error C2143: syntax error : missing ';' before 'tag::id'
c:\program files\microsoft visual studio\vc98\include\xlocnum(83) : error C2501: 'id' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\xlocnum(83) : error C2059: syntax error : ';'
c:\program files\microsoft visual studio\vc98\include\xlocnum(83) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Error executing cl.exe.
abc.exe - 80 error(s), 5 warning(s)
please help me
i will very appreciate
help!!!
|
|
|
|
|
why dont u use the class CString?
|
|
|
|
|
Because it's an STL exercise. Just because someone gets an error with STL does not automatically warrant a "Use MFC" comment.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
And what does he use if he can't get that to work?
Steve
|
|
|
|
|
edit your post so that we can see your include
btw, include this:
#include <STRING>
|
|
|
|
|
I agree, it seems as if you forgt an "#include" statement or some needed setting is not set properly.
|
|
|
|
|
A small knit pick, but you should use lowercase.
Steve
|
|
|
|
|
why ?
i always include the standard C++ headers in uppercase, as the include file names are written like that...
please explain your feeling
|
|
|
|