|
lavy2883 wrote: why...when I implement this function in C++....it give me...
Because it has been declared deprecated.
led mike
|
|
|
|
|
) yes I know that;P...but what is realy the problem
lavi
|
|
|
|
|
|
use fopen_s instead
|
|
|
|
|
|
Ranjoy Guha wrote: use fopen_s instead
...and turn your perfectly valid standard portable code to be MS-only
|
|
|
|
|
how do I do this.... ....
lavi
|
|
|
|
|
lavy2883 wrote: warning C4996: 'fopen' was declared deprecated
See here.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
fopen was declared deprecated along with many of the standard C functions. It's replaced by the fopen_s function. In the case of fopen, I think the issue was that it communicated specific error conditions by use of the global errno variable, which isn't thread-safe. That's the only issue I can think of.
VS 2005 is the only compiler I know of that has done this (in fact it may be an MS invention). If portability is a concern, use fopen. Or if laziness is a concern, use fopen in that case too! . There's a preprocessor define that turns off the warnings, and I think that's mentioned in the warning itself.
|
|
|
|
|
I am new to VS2005 so forgive me if I am asking the obvious.
I have a dialog that I want to add an OnInitDialog to. I have a class derived from CDialog tied to the resource. The properties page does not have a WM_INITDIALOG message in the list. Where is it?
Am I missing a setting?
Do I have to hand code this?
(Little things like this make me want to stay with VC6)
Dave
I'm pretty sure I would not like to live in a world in which I would never be offended.
I am absolutely certain I don't want to live in a world in which you would never be offended.
Dave
|
|
|
|
|
It's a virtual function. it's in the "overrides" properties
led mike
|
|
|
|
|
Thanks - I didn't even realize that was there.
-- modified at 11:35 Wednesday 4th April, 2007
(On looking into this further - the overrides is only available when I have the .h file for the dialog up and I was looking at the properties when I had the dialog resource up.
I wonder why it is done that way?
I'm pretty sure I would not like to live in a world in which I would never be offended.
I am absolutely certain I don't want to live in a world in which you would never be offended.
Dave
|
|
|
|
|
Right-Click on the Dialog Class
Select Properties
Check for the "overrides" properties
Check for WM_INITDIALOG
If OnInitDialog is not already beside it
Click on the drop-down beside WM_INITDIALOG
and select it
Then select Edit option
You will be inside OnInitDialog block
enjoy
|
|
|
|
|
I am using the Security SDK for my project. I have to include
WINCRYPT.H in my project. The file has macro defined in the begining:
#ifndef __WINCRYPT_H__
#define __WINCRYPT_H__
While compiling I get a error when I use the Crypt APIs defined in the above header file.
--------------------Configuration: encrypt - Win32 Debug--------------------
Compiling...
encrypt.cpp
C:\crypt\encrypt.cpp(12) : error C2146: syntax error : missing ';' before identifier 'hCryptProv'
C:\crypt\encrypt.cpp(12) : error C2501: 'HCRYPTPROV' : missing storage-class or type specifiers
C:\crypt\encrypt.cpp(12) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
When I remove the above macros, the project compiles correctly. The MSDN says that advapi32.lib should be included in the project settings which I have already included.
Where am I going wrong? Why do I get the error?
|
|
|
|
|
Check if you're #includ ing a different header file that uses the same macros. Consider using the #pragma once directive instead.
/ravi
|
|
|
|
|
Nope...still getting the error. Plesase see the modified message and let me know the solution
|
|
|
|
|
Use
#pragma once
#include <wincrypt.h>
in the header file(s) where you are using Crypt APIs
|
|
|
|
|
As advised, I have added following lines in my encrypt.cpp file
#pragma once
#include <wincrypt.h>
I still get the error. This error seems to occour only with wincrypt.h file. I copied the contents of wincrypt.h into another file test.h and replace
#ifndef __WINCRYPT_H__
#define __WINCRYPT_H__
with
#ifndef __TEST_H__
#define __TEST_H__
and include the test.h file, I do not get any errors. Please help me
|
|
|
|
|
I have serial application, that has it's own thread that polls the serial devices. The thread reads values from the devices and storages them in a private variable. In that thread, when accessing that private variable I critical lock and unlock the variable. I also have public member function that reads that private data member. The member function is used to provide the application with access to value of the private data member. This read does not occur in the same thread.
However, because i am only reading this variable is it still necessary to critical lock and unlock this variable in the public member function?
<br />
<br />
void LENZE_8200_MOTION::ThreadRun(void)<br />
{ <br />
<br />
<br />
while(1)<br />
{<br />
/......./<br />
case LNZ82_OUTPUT_CURRENT:<br />
cResults = get_output_current(lift_address, &dTemp );
EnterCriticalSection(&m_csLiftLock);
m_dLiftOutputCurrent = dTemp; <br />
if( cResults >= 0 ){<br />
lift_cmd.Pop( &cmd );
m_lLiftFailedTxPktSeqCount = 0;
}else{ <br />
m_lLiftFailedTxPktSeqCount++;
m_lLiftFailedTxPktAccumCount++;
}<br />
LeaveCriticalSection(&m_csLiftLock);
break;<br />
<br />
case LNZ82_OPERATING_TEMPERATURE:<br />
cResults = get_temperature(lift_address, &dTemp );
EnterCriticalSection(&m_csLiftLock);
if( cResults >= 0 ){<br />
lift_cmd.Pop( &cmd );
m_lLiftFailedTxPktSeqCount = 0;
}else{ <br />
m_lLiftFailedTxPktSeqCount++;
m_lLiftFailedTxPktAccumCount++;
m_dLiftOutputTemperature = -1;<br />
}<br />
LeaveCriticalSection(&m_csLiftLock);
break;<br />
<br />
<br />
<br />
/......../<br />
}<br />
<br />
}<br />
<br />
<br />
<br />
double LENZE_8200_MOTION::lift_get_output_current(void)<br />
{ <br />
double temp;<br />
???????? Do i need critical lock here<br />
temp = m_dLiftOutputCurrent;<br />
???????? Do i need critical unlock here <br />
return temp; <br />
};<br />
<br />
<br />
double LENZE_8200_MOTION::lift_get_output_temperature(void)<br />
{ <br />
???????? Do i need critical lock here<br />
return m_dLiftOutputTemperature; <br />
???????? Do i need critical unlock here <br />
}<br />
<br />
Scott Dolan
Jernie Corporation
Engineering & Manufacturing
Software, Hardware, & Enclosures
|
|
|
|
|
Yes. The read is not guaranteed to be atomic.
I use them every place I read and write critical variables that might be modified or read from different threads. No problems with the software that way.
Even more important with data longer than the size of a CPU register.
|
|
|
|
|
The only situation where it can be justified to answer 'no' to that question would be if the variables was never written to.
Since you are writing to the variables at different places in your code snippet, you have to protect the data, i.e. you need the calls to ::EnterCriticalSection() and ::LeaveCriticalSection() at the places you were wondering about.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
void SetRows(
int nRows,
BOOL bLarger,
LPRECT lpRect
);
Can anybody plz explain me what is lpRect?
MSDN says :
Points to the CRect object or RECT structure that will receive the new bounding rectangle of the toolbar.
What is this new bounding rectangle?
|
|
|
|
|
It seems that the CRect /RECT pointed to by lpRect will receive the toolbar control's new dimensions.
/ravi
|
|
|
|
|
|
long pointer to CRect/RECT
|
|
|
|