|
I have *never* had one of those functions giving me an error. The only thing I can think of is that you've not initialised the critical section before using it. Look on
MSDN for EnterCriticalSection. One of the links take you to an example page for critical sections. (Copied below)
I would avoid the use of a global variable, and make the critical section a co-member of a class with your recordset, but I hope you'll get the idea.
Iain.
CRITICAL_SECTION CriticalSection;
void main()
{
...
InitializeCriticalSection(&CriticalSection);
...
DeleteCriticalSection(&CriticalSection)
}
DWORD WINAPI ThreadProc( LPVOID lpParameter )
{
...
__try
{
EnterCriticalSection(&CriticalSection);
}
__finally
{
LeaveCriticalSection(&CriticalSection);
}
...
}
|
|
|
|
|
Thanks again
I will try that. Actaully I am using the CWinThread Run() function from a CWinThread derived class
and doing the simultaneous update of the CRecordSet object and not AfxBeginthread function
will that work too?
anyway thank you very much for your help
and I will keep you disturbing
Thanks a lot
|
|
|
|
|
The code I showed was just an example - mostly for initialising the critical section.
Any code wrapped up by a Enter/LeaveCriticalSection pair will be callable from only one thread at a time. This includes any calls you make to a database, etc. It doesn't matter whether you make a thread using CWinThread::Run, AfxBeginThread, or ::CreateThread (mostly because they all end up being a call to BeginThread).
Iain.
|
|
|
|
|
Sir
I tried all the functions but it is still not working
some rows are surely getting updated but some of them are not
the error Mesage is No rows were affected by the update or delete operation.
has it any thing to do with the type of database I am using.Actually I am uising MS-ACCESS database.
may be ACCESS is not able to handle concurrent updates
|
|
|
|
|
Hi,
in my application I need to check if network is available. I have used the function InternetGetConnectedState.
But this function is not working on Windows 98. It always returns "Network connected State".
Is any other way, to check the network ( INTERNET ) connection on 98.
Regards
Somnath
|
|
|
|
|
Somnath_Mali wrote: It always returns "Network connected State".
And is that not right?
Have you tried IsNetworkAlive() or InternetCheckConnection() ?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
We have windows application, which should track if Desktop window is active and process some code if desktop is active.
Is any way to track the events which gets called when user selects "show desktop" from Quick launch OR "show desktop" from right click on task bar OR window+D.
Regards,
Somnath
|
|
|
|
|
Have you used Spy++ to see what message(s) your application receives when all top-level windows are minimized?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
dear all
how to solve the following problem: thanks
actually the problem is from this line:
vn[ii][j][k] = w*v[ii][j][k] + c1*rand()*(pbestArray[ii][j][k]-x[ii][j][k]) + c2*rand()*(gbest[j][k]-x[ii][j][k]);
xn[ii][j][k] = x[ii][j][k] + v[ii][j][k] + (a1*(g-fitness(ii)));
TestSource.cpp(258) : error C2064: term does not evaluate to a function
thanks..after compilation, the errer is above..
Li Zhiyuan
5/10/2006
modified on Monday, January 28, 2008 2:30:03 AM
|
|
|
|
|
1/ Please read the guidelines - it's attached to the top of the forum, and in big letters tells you to use a meaningful topic.
I've yet to see someone post a message, but say "please don't help me".
2/ You show an error on a line of code, then show TWO lines of code. Which one is wrong?
3/ You can solve the problem yourself.
Start with
vn[ii][j][k] = 1; does that compile happily?
vn[ii][j][k] = w*v[ii][j][k]; does that compile happily?
vn[ii][j][k] = w*v[ii][j][k] + c1; does that compile happily?
vn[ii][j][k] = w*v[ii][j][k] + c1*rand(); does that compile happily?
I'm bored now, but I hope you get the idea.
Or you can read the error message. To call a function, you use ()'s. So, look for () that should not be there, or be [] as an array variable.
Good luck,
Iain.
|
|
|
|
|
If I recall well from you previous posts, fitness is an array, hence you need to access its elements via [] operator. Probably you have to replace fitness(ii) with fitness[ii] .
BTW I suggust you to read some introductory documentation on C/C++ programming.
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.
[my articles]
|
|
|
|
|
thanks, brother, solved already,i still has a problem:
LINK : fatal error LNK1104: cannot open file "psoCode.lib"
Error executing link.exe.
psoCode.lib is static library what i created..i really tried many manners to solve it..anyone can provide me with own email, i can pass my source code to you and you help me to solve it, thanks a lot.size of file is so small.....thanks again..my email address is lizhiyuan16@hotmail.com.
i compiled static library and main function file respectively, but it is no problem..and after dependency...this problem occurred...
Li Zhiyuan
5/10/2006
|
|
|
|
|
There's no need to send code, you simply need to make Visual Studio know about your library file psoCode.lib folder path. You have to add that folder path to the Library files directory list, I already posted you about
(alternatively, quick and dirty method, you can put your library file psoCode.lib inside a Visual Studio well known path, for instance the lib subfolder of the Visual Studio installation one).
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.
[my articles]
|
|
|
|
|
dear friend
could you give me some detail, for example: first step..second...let me check carefully..but actually i already set all requirement what program demand....
thanks a lot..
Li Zhiyuan
5/10/2006
|
|
|
|
|
I've Visual Studio 2005, but I think it applies also to VS2003 & VS2008:
(1) Find you library folder path, i.e. the path of the folder containing the file psoCode.lib .
(2) On Visual Studio, select Tools->Options menu item.
(3) On the newly appeared window, select the Projects and Solutions->VC++ Directories node.
(4) Select Library files item in the Show directories for listbox.
(5) Add the folder you found at point (1) to the list of library folders, you can use the browse button.
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.
[my articles]
|
|
|
|
|
but i use vc++6.0..so far..how to set? is this same way? thanks....
Li Zhiyuan
5/10/2006
|
|
|
|
|
|
I am using the two stage check box in sdk(not MFC).
when i checked or unchecked on checkbox then how can I find out
whether the checkedbox is checked or unchecked. I am using the following
code.
case WM_COMMAND:
if(LOWORD(wParam) == IDC_CHECKBOX1)
{
}
Trioum
|
|
|
|
|
Hi, Trioum
Try IsDlgButtonChecked function please.
============
Einstein
Seeing is believing.
|
|
|
|
|
Did you use of BM_GETCHECK?
|
|
|
|
|
but how can I used in my code shown in my first post.
I could not understand
Trioum
|
|
|
|
|
Please search it on google or MSDN .
============
Einstein
Seeing is believing.
|
|
|
|
|
For use it you must use of SendMessage with handle of your control.
|
|
|
|
|
case WM_COMMAND:
if(LOWORD(wParam) == IDC_CHECKBOX1)
{
LRESULT ret = ::SendMessage((HWND)lParam, BM_GETCHECK, 0, 0);
if (BST_CHECKED == ret)
{
}
else if (BST_INDETERMINATE == ret)
{
}
else
{
}
}
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|