|
When a modal dialog box is closed using EndDialog does it's parent window recieve a message to notify it that the dialog has closed? I want to update some info in my status bar as soon as the dialog is closed.
Thanks in advance,
Paddy
|
|
|
|
|
|
Thanks for the help. It's non-MFC I'm using. Does this mean that my main window can't do anything until EndDialog is called?
Paddy
|
|
|
|
|
|
What am I doing wrong? I want to read the names from a file and put them onto a vector of char*......it crashes at the pushback. Each file name is on a different line.
I did a dir/b in dos and got a txt file with a list of file names (a bunch of .bmps) from the directory. I assume theres carriage returns at the end of each line. But maybe not. There are 18 letters in the name08FEB096_9571s.bmp , and carriage return line feed is 1 byte (MSDN).
CFile file;
std::vector<char*> fileVec;
file.Open("c:\\miss\\SImages.txt", CFile::modeRead, 0);
char* pBuf;
char folder[200];
strcpy(folder , "C:\\miss\\");
for (int i = 0; i <96; i++)
{
pBuf = new char[200];
file.Read( pBuf,20);
strcat(folder, pBuf);
fileVec.push_back(folder);
delete[] pBuf;
}
file.Close();
|
|
|
|
|
looks like the board ate some of your code. how is your vector defined? (what is it a vector of?)
-c
WWT2D?
|
|
|
|
|
It was avector of CString. However my problem was that I was using CFile when CStdioFile was more suitable and I had overwritten some buffers, but the poor vector got blamed....
Thanks.
|
|
|
|
|
CFile file;
change std::vector fileVec;
to std::vector<string> fileVec;
Move strcpy(folder,"c:\\miss\\");
to For Statement
for (int i = 0; i <96; i++) {
strcpy(folder , "C:\\miss\\");
pBuf = new char[200];
file.Read( pBuf,20);
strcat(folder, pBuf);
fileVec.push_back(folder);
delete[] pBuf;
}
Learning and Working
|
|
|
|
|
Nobody explained the reason for the crash...Without the unimportant stuff, here is what the code looks like. Do you see the problem?
char folder[200];
strcpy(folder , "C:\\miss\\");
for (int i = 0; i <96; i++)
{
...
strcat(folder, pBuf);
...
}
|
|
|
|
|
Yup. I saw finally....my poor "folder" variable was getting concatenated way beyond its allocated space...
Thanks
Appreciate your help,
ns
|
|
|
|
|
I have a file with several lines of text (all end with a carriage return). I want to use my CFile object to read these strings into an array of pointers to char. I dont see a anything like GetLine()....if I dont know the length of the text on the line, I dont have a value to give Read() as a count of chracters...
Actually I'm push_backing the strings onto a vector...
|
|
|
|
|
|
That is working out......many thanks.
|
|
|
|
|
Hi,
I got a DLL (not MFC) with some functions in it. The header file containing the declaration for the functions of the DLL is also available.
Is there a way to call these functions in a static way other than using LoadLibrary and GetProcAddress ?
Thanks
|
|
|
|
|
yes, include the header file:
#include "MyDllBase.h"
and link the project with the output .LIB file for the DLL
under project settings->linker->input, add "MyDllBase.lib"
- Roman -
|
|
|
|
|
Hi!
I have tried to find a simple way to manipulate a database (in MS Access or MS SQL Server). However, I've not succeeded. I've tried SELECT statements with CRecordset and it works. But it seems like only SELECT statements work. This is what I've tried:
CDaoDatabase* m_pDB;
CDaoRecordset* m_pRS;
m_pDB = new CDaoDatabase;
m_pRS = new CDaoRecordset(m_pDB);
try {
m_pDB->Open("c:\\accessdb\\db1.mdb");
// CString strQuery = _T("SELECT * FROM Table1"); //Works just fine...
CString strQuery = _T("INSERT INTO Table1 VALUES ('3', 'Olga')"); //Doesn't work
m_pRS->Open(dbOpenDynaset, strQuery);
} catch (CDaoException* e) {
AfxMessageBox(e->m_pErrorInfo->m_strDescription);
e->Delete();
}
So how do you add data to a table, modify tables and so on?
Cheers,
Joachim
|
|
|
|
|
im assuming the 3 in ur insert statement goes into a numeric field in the database table ... if so lose the '' around it ... u only have to quote text fields (and prolly date fields sometimes)
"even if my world is weird its my world" biz stuff about me
|
|
|
|
|
|
ok well i use odbc for db stuff but it would seem to me that opening a dynaset on an insert statement wouldnt make sense ... u need to simple execute the statement against the db so prolly look for an .execute type command
"even if my world is weird its my world" biz stuff about me
|
|
|
|
|
ok thanks, but it need more specific ideas... i'm not that experienced with using vc++ to work with databases
|
|
|
|
|
Do you really need to use DAO. ADO is a lot easier. Check out this link for some good examples.
http://www.codeproject.com/database/#ADO[^]
Michael
Wonder Woman, Wonder Woman.
All the world's waiting for you,
and the power you possess.
In your satin tights,
Fighting for your rights
And the old Red, White and Blue.
|
|
|
|
|
JockeP wrote:
("INSERT INTO Table1 VALUES ('3', 'Olga')");
INSERT INTO Table1 (Field1, Field2) VALUES VALUES ('3', 'Olga')");
where field1 and field2 are obviously part of your table
(you didnt tell us the structure of your table)
Bryce
|
|
|
|
|
Pls Using:
CDaoDatabase::Execute
Learning and Working
|
|
|
|
|
Hi,
it simply doesn't work... I'm right?
Imagine somthing like this.........
template <class T> class CDialogView : public CDialog
{
} It will all compile fine until compiler hits the MFC message macros. At BEGIN_MESSAGE_MAP macro the template specification for the class causes the compiler to fail. A CDialog without message handlers makes no sense, that's why you can't simple skip the message macros. *sigh*
I had a look on Google's Usenet archive and found no solution.
|
|
|
|
|
Check Yury Golstman's article Colored/Blinking Controls and Dialogs with any Font[^]. He features a most interesting technique to implement message maps for template class (view TemplDef.h in the source code).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|