|
Probably whatever 'm_pDatabase' points to should also be created on the secondary thread.
When I did DAO work, I always did ALL the database work on the secondary thread, and it works fine.
|
|
|
|
|
yes the object have a pointer to CDaoDatabase but in main thread i check if db exist (if not db will be created) but in any case i close the connection... in the secondary thread i created a new object and i do a new connection
|
|
|
|
|
What method did you use to create the secondary thread? AfxBeginThread or otherwise?
|
|
|
|
|
I use AfxBeginThread
BOOL CProvaDlg::OnInitDialog(){
...
AccDatabase* pAccDatabase = new AccDatabase();
if (pAccDatabase->Open()){ //local db already exist
}
else{
//local db does not exist
//create it
pAccDatabase->Create();
}
pAccDatabase->Close();
delete pAccDatabase;
m_pThreadSynchronize = AfxBeginThread(ThreadFunc, m_pAccDatabase);
...
}
UINT CProvaDlg::ThreadFunc(LPVOID pParam){
AccDatabase* pAccDatabase = new AccDatabase();
pAccDatabase->Open();
// do something with pAccDatabase like insert, delete ecc...
...
}
AccDatabase.h:
public:
AccDatabase(void);
~AccDatabase(void);
void Close();
bool Create();
bool Open();
bool Insert(Articolo* m_pArticolo);
bool Delete(Articolo* m_pArticolo);
bool Select(Articolo* m_pArticolo);
bool SelectAllToInsert(void);
Articolo* getNext(void);
bool SelectAllToUpdate(void);
bool SelectAllToDelete(void);
bool SetAllToSynchronize(void);
bool Update(Articolo* m_pArticolo);
private:
CDaoRecordset* m_pRecordset;
bool bFirstRecord;
CDaoDatabase* m_pDatabase;
CDaoQueryDef* m_pQueryDef;
};
|
|
|
|
|
I am concerned the problem might lie with the Articolo* m_pArticolo passed into each function. Make sure these items are also created within the same thread as the one accessing the database. When I used the DAO, I only had to make sure that all the objects used to access the database were made from within the same thread. I could connect, open, close, and execute all from within that same thread with no problem.
|
|
|
|
|
the error is in open
the code does not arrive to execute insert
|
|
|
|
|
I was reading MSDN some more on this. Maybe since the DAO object is created in the separate thread, but you don't supply arguments, it tries to use the DAOWorkSpace from the primary thread as the default. Maybe you also need to create a DAOWorkSpace in the secondary thread and explicitly use it during the Open call. I am running out of suggestions, so I hope this most recent one helps!
|
|
|
|
|
Hi
I'm opening a file using:
ofstream FicNet; //variable pour écriture de fichier
FicNet.open ( "nomFichier", ios::out);
if (FicNet.fail())
{
exit(2);
}
else
{
FicNet << "! "<
|
|
|
|
|
Why open it first? Can't you just use CopyFile() ?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi
I'm opening a file using:
ofstream FicNet; //variable pour écriture de fichier
FicNet.open ( "nomFichier", ios::out);
if (FicNet.fail())
{
exit(2);
}
else
{
FicNet << "! "<
|
|
|
|
|
Take a look at the GetSaveFileName() function in the Win32 platform SDK on MSDN.
Human beings were not meant to sit in little cubicles staring at computer screens all day, filling out useless forms and listening to eight different bosses drone on about about mission statements. -- Peter Gibbons
|
|
|
|
|
can anybody solve my problem!
i am getting header information of shape file but i dont know how to convert big endian byte order data to little endian byte order.
|
|
|
|
|
|
sorry i cant understand what u say?
|
|
|
|
|
Please follow the link I posted to an earlier message in this very same forum asking and answering the very same question.
|
|
|
|
|
Did you bother to test your clickety before submitting your message.
No wonder the guy was (still is) confused.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
|
YEs this one has the desired result
|
|
|
|
|
|
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
I have written a program which launches another application which displays a Tree. Thru my application, I obtain a handle to the window which displays the tree. using this handle I want to grab the tree. Is there a way I can do that. The program I am writing is in C# but I thought that some help from the VC++ section would do. I now know that there is CWnd::Attach and Detach in VC++ . Is there a way to call this from C#.
Abhishek
|
|
|
|
|
You can call GetClassName() on the window handle, and see if it is a "SysTreeView32" class. If it is you can send TVM_* messages to it to get the information you need.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
I am developing an application which is looking at the process running on the PC. For Explorer.exe I can get the window title, but does anyone know where in the registry, if at all, this title matches up with a folder name.
For example
Title=RandP
CommandLine=C:\WINDOWS\Explorer.EXE
so how do I get at the text in the Address control of Explorer ? does this info get saved/stored in the registry ?
Any help would be much appreciated.
Phil Gibson
|
|
|
|
|
philgibson wrote:
so how do I get at the text in the Address control of Explorer ?
You have to Write Browser Helper Object for Window Explorer!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
philgibson wrote:
does this info get saved/stored in the registry ?
Nope
philgibson wrote:
so how do I get at the text in the Address control of Explorer ?
You have To write Browser Helper Object for Window Explorer. Search Browser Helper Object in google to know more about it
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|