Click here to Skip to main content
15,888,302 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: insert text in video Pin
Game-point16-Feb-10 0:35
Game-point16-Feb-10 0:35 
QuestionHow can I run an MFC Application as a Console Application Pin
Reitz00015-Feb-10 14:17
Reitz00015-Feb-10 14:17 
AnswerRe: How can I run an MFC Application as a Console Application Pin
Luc Pattyn15-Feb-10 14:23
sitebuilderLuc Pattyn15-Feb-10 14:23 
GeneralRe: How can I run an MFC Application as a Console Application Pin
«_Superman_»15-Feb-10 17:08
professional«_Superman_»15-Feb-10 17:08 
AnswerRe: How can I run an MFC Application as a Console Application Pin
Emilio Garavaglia15-Feb-10 22:44
Emilio Garavaglia15-Feb-10 22:44 
QuestionHow to get DLL's path? Pin
John578815-Feb-10 12:24
John578815-Feb-10 12:24 
AnswerRe: How to get DLL's path? Pin
Chris Losinger15-Feb-10 14:13
professionalChris Losinger15-Feb-10 14:13 
QuestionCan someone help with a TRIVIAL database problem Pin
DaveHitchman15-Feb-10 9:32
DaveHitchman15-Feb-10 9:32 
I have an existing C++ project, Visual studio 9, running on Windows 7.
I want to write a non-managed piece of code to open a database.
First time round the database won't exist, so I want an error so that I can then run some code to create it.

So far:

DAO doesn't work (it used to in another project)...
m_pDB = new CDaoDatabase(NULL);// use a temporary workspace

// try to open it, not exclusive, not read only the connect arguements left blank (default)
// failure throws an exception (not nice really - rather it returned a false
// fails if database doesn't exist so catch it and then try a create if the user required that.
try
{
opened = true; // assume success
m_pDB->Open(CString("EventsLog.mdb"), false, false);
}
catch(CDaoException* e)
{
opened = false; // wrong assumption, didn't open
e->Delete();
}
if ((!opened) && (createIfRequired))
{
try
{
opened = true; // assume success
m_pDB->Create(CString("EventsLog.mdb"));
CreateActivityRecordStructure();
CreateActivityRecord("0.1.2.3", "Test sensor 1", "Temp OK", 0);
}
catch(CDaoException* e)
{
opened = false; // wrong assumption, didn't open
LPTSTR errors = new TCHAR[100];
e->GetErrorMessage(errors,100,NULL);
// ALWAYS ENDS HERE COMPLAINING IT CAN'T START DAO
AfxMessageBox(errors);
e->Delete();
}
}



_ConnectionPtr pConnection;
hr = pConnection.CreateInstance(__uuidof(Connection));
if (FAILED(hr))
{
return false;
}
_RecordsetPtr recordset;
hr = recordset.CreateInstance(__uuidof(Recordset));
if (FAILED(hr))
{
return false;
}

hr = pConnection->Open(strConnectionString, "", "", adOpenUnspecified);
// this ALWAYS fails regardless of any connection string I have tried - and I've tried a few.



Anything thats to do with 'wrappers around managed classes' just reveals piles of shite about /clr and what it is incompatible with.



I can't find a piece of example code anywhere on the internet that will compile and work.
Surely it is trivial - after all, what I am trying to do (at this stage) is not really any harder than opening a file!
AnswerRe: Can someone help with a TRIVIAL database problem Pin
CPallini15-Feb-10 20:54
mveCPallini15-Feb-10 20:54 
Questionh_addr_list of gethostbyname returns negative values for google.com or other servers like example.com [modified] Pin
Jayapal Chandran15-Feb-10 9:18
Jayapal Chandran15-Feb-10 9:18 
AnswerRe: h_addr_list of gethostbyname returns negative values for google.com or other servers like example.com Pin
Graham Breach15-Feb-10 10:04
Graham Breach15-Feb-10 10:04 
AnswerRe: h_addr_list of gethostbyname returns negative values for google.com or other servers like example.com Pin
Richard MacCutchan15-Feb-10 11:19
mveRichard MacCutchan15-Feb-10 11:19 
AnswerRe: h_addr_list of gethostbyname returns negative values for google.com or other servers like example.com Pin
David Crow16-Feb-10 4:14
David Crow16-Feb-10 4:14 
QuestionRe: h_addr_list of gethostbyname returns negative values for google.com or other servers like example.com Pin
Jayapal Chandran16-Feb-10 7:12
Jayapal Chandran16-Feb-10 7:12 
GeneralRe: h_addr_list of gethostbyname returns negative values for google.com or other servers like example.com Pin
David Crow16-Feb-10 7:28
David Crow16-Feb-10 7:28 
GeneralRe: h_addr_list of gethostbyname returns negative values for google.com or other servers like example.com Pin
Jayapal Chandran16-Feb-10 10:17
Jayapal Chandran16-Feb-10 10:17 
QuestionRe: h_addr_list of gethostbyname returns negative values for google.com or other servers like example.com Pin
David Crow16-Feb-10 10:19
David Crow16-Feb-10 10:19 
AnswerRe: h_addr_list of gethostbyname returns negative values for google.com or other servers like example.com Pin
Jayapal Chandran16-Feb-10 10:44
Jayapal Chandran16-Feb-10 10:44 
GeneralRe: h_addr_list of gethostbyname returns negative values for google.com or other servers like example.com Pin
Jayapal Chandran16-Feb-10 11:43
Jayapal Chandran16-Feb-10 11:43 
QuestionRe: h_addr_list of gethostbyname returns negative values for google.com or other servers like example.com Pin
David Crow17-Feb-10 3:03
David Crow17-Feb-10 3:03 
AnswerRe: h_addr_list of gethostbyname returns negative values for google.com or other servers like example.com Pin
Jayapal Chandran17-Feb-10 5:51
Jayapal Chandran17-Feb-10 5:51 
GeneralRe: h_addr_list of gethostbyname returns negative values for google.com or other servers like example.com Pin
David Crow17-Feb-10 5:58
David Crow17-Feb-10 5:58 
GeneralRe: h_addr_list of gethostbyname returns negative values for google.com or other servers like example.com Pin
Jayapal Chandran17-Feb-10 6:15
Jayapal Chandran17-Feb-10 6:15 
GeneralRe: h_addr_list of gethostbyname returns negative values for google.com or other servers like example.com Pin
David Crow17-Feb-10 6:23
David Crow17-Feb-10 6:23 
GeneralRe: h_addr_list of gethostbyname returns negative values for google.com or other servers like example.com Pin
Jayapal Chandran17-Feb-10 7:07
Jayapal Chandran17-Feb-10 7:07 

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.