|
Iain Clarke wrote: If you want the top and bottom to be the opposite numbers, try setting the range with opposite numbers too.
Dear Iain Clarke
before open this thread, i have tried it lots of times
SetRange (100,0); << this locks slider have you tried it..?
is it works for you..? if so please tell me what i have to do aditionally
i have used either TBS_DOWNISLEFT and TBS_REVERSED
i have defined different WINVER s
i thing i am doing something wrong but what i do not know
thanks
|
|
|
|
|
I owe you an apology - I was thinking of the up/down control, and just setting the range works fine.
eg:
SendDlgItemMessage (IDC_SEGMENTEDGECORRSPIN, UDM_SETRANGE, 0, MAKELONG((short)20, (short)-20));
is operational.
But the trackbar (as windows rather than MFC) calls it, is a different control.
Rather than MFCs set range, have you tried using: TBM_SETRANGEMIN , TBM_SETRANGEMAX .
TBS_REVERSED is just cosmetic.
Last but not least, just reverse it in your code:
SendDlgItem (hDlg, IDC_zzzzz, TBM_SETPOS, TRUE, (LPARAM)(1000-nPos));
Iain.
Iain Clarke appears because CPallini still cares.
|
|
|
|
|
Grettings everyone, today im dealing with Crypto552 created by Wei Dai.
im converting a project my father did long ago. since we think different i didnt want to have all the crypto files spread across my solution so i created a project for them.
in my visual studio 8 solution i have 2 projects: CRYPTO (In wich the cryptography solucion is written in c++) and builds perfectly; ZEUS08 (Wich is the project thats gonna have the conversion of what my father did in C++) both projects are in C++
inside CRYPTO theres a namespace called CryptoPP. (NAMESPACE_BEGIN(CryptoPP)) wich is in all the files .h and.cpp
since im copying parts from the last version im having some problems.
the most important one is:
im trying to use the namespace CryptoPP in ZEUS08 but it wont allow me...
i have tried
USING_NAMESPACE(CryptoPP);
using namespace CryptoPP;
but it keeps telling me:
error C2781 : 'CryptoPP' : a namespace with this name does not exist
does anybody have an idea why it tortures me with that nonsense?, i mean the project is in my solution why it wont recognize it?
help would be apreciated.
|
|
|
|
|
pabloraul wrote: NAMESPACE_BEGIN
what the heck is that?
pabloraul wrote: i mean the project is in my solution why it wont recognize it?
That means nothing. You have to have the namespace header file included for the compiler to know about the namespace.
led mike
|
|
|
|
|
about the NAMESPACE_BEGIN(CryptoPP), i really dont know. the compiler understands that it its the beggining of the namespace and at the end of the file theres a NAMESPACE_END. when i look at the object browser it has something like this:
CRYPTO
{}CryptoPP //meaning that cryptopp is inside crypto
{}Std
about including the header file of the namespace, i dont now which one since every file of the class has that thing inside...
by the way, i cant even include the files of CRYPTO into de files of ZEUS
example:
#include "config.h" //cannot include file, no such file or directory
modified on Tuesday, April 1, 2008 1:13 PM
|
|
|
|
|
pabloraul wrote: i dont now which one since every file of the class has that thing inside
Well you have to include every header file that defines any class that you want to use anyway. If you are really this confused about header files and namespaces you might need to learn a little more about C++ fundamentals before attempting your project.
led mike
|
|
|
|
|
that would be perfect but try explaining that to my dad.
lets try this example:
file structure:
CRYPTO
-config.h
ZEUS08
-myfile.cpp
config.h
NAMESPACE_BEGIN(CryptoPP)<br />
<br />
typedef unsigned short word16;<br />
typedef unsigned int word32;<br />
<br />
#if defined(__GNUC__) || defined(__MWERKS__) || defined(__SUNPRO_CC)<br />
#define WORD64_AVAILABLE<br />
typedef unsigned long long word64;<br />
#define W64LIT(x) x##LL<br />
#elif defined(_MSC_VER) || defined(__BORLANDC__)<br />
#define WORD64_AVAILABLE<br />
typedef unsigned __int64 word64;<br />
#define W64LIT(x) x##ui64<br />
#endif
since it has the definition for W64LIT i decided to include it.
so i put into my file
#include "config.h"
but it gives me fatal error C1083: Cannot open include file: 'config.h': no such file or directory
would u please help me with that or give me a link to c++ basics¿?
|
|
|
|
|
pabloraul wrote: but it gives me fatal error C1083: Cannot open include file: 'config.h': no such file or directory
Looks like a n include path problem, not a namespace problem.
I'm still curious what the NAMESPACE_BEGIN macro expands to...
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
include path problem, im gonna research about that.
about the namespace begin im gonna post few of the files for you to see at least how its supposed to work. wei dai wrote it somehow and it works, i just need to use that library in order to use cryptography in my solution.
here is a picture of the object browser for you to see that CryptoPP is a namespace
argnames.h
#ifndef CRYPTOPP_ARGNAMES_H<br />
#define CRYPTOPP_ARGNAMES_H<br />
<br />
#include "cryptlib.h"<br />
<br />
NAMESPACE_BEGIN(CryptoPP)<br />
<br />
DOCUMENTED_NAMESPACE_BEGIN(Name)<br />
<br />
#define CRYPTOPP_DEFINE_NAME_STRING(name) inline const char *name() {return #name;}<br />
<br />
CRYPTOPP_DEFINE_NAME_STRING(ValueNames)
CRYPTOPP_DEFINE_NAME_STRING(Version)
CRYPTOPP_DEFINE_NAME_STRING(Seed)
CRYPTOPP_DEFINE_NAME_STRING(Key)
CRYPTOPP_DEFINE_NAME_STRING(IV)
CRYPTOPP_DEFINE_NAME_STRING(StolenIV)
CRYPTOPP_DEFINE_NAME_STRING(Rounds)
CRYPTOPP_DEFINE_NAME_STRING(FeedbackSize)
CRYPTOPP_DEFINE_NAME_STRING(WordSize)
CRYPTOPP_DEFINE_NAME_STRING(BlockSize)
CRYPTOPP_DEFINE_NAME_STRING(EffectiveKeyLength)
CRYPTOPP_DEFINE_NAME_STRING(KeySize)
CRYPTOPP_DEFINE_NAME_STRING(ModulusSize)
CRYPTOPP_DEFINE_NAME_STRING(SubgroupOrderSize)
CRYPTOPP_DEFINE_NAME_STRING(PrivateExponentSize)
CRYPTOPP_DEFINE_NAME_STRING(Modulus)
CRYPTOPP_DEFINE_NAME_STRING(PublicExponent)
CRYPTOPP_DEFINE_NAME_STRING(PrivateExponent)
CRYPTOPP_DEFINE_NAME_STRING(PublicElement)
CRYPTOPP_DEFINE_NAME_STRING(SubgroupOrder)
CRYPTOPP_DEFINE_NAME_STRING(Cofactor)
CRYPTOPP_DEFINE_NAME_STRING(SubgroupGenerator)
CRYPTOPP_DEFINE_NAME_STRING(Curve)
CRYPTOPP_DEFINE_NAME_STRING(GroupOID)
CRYPTOPP_DEFINE_NAME_STRING(PointerToPrimeSelector)
CRYPTOPP_DEFINE_NAME_STRING(Prime1)
CRYPTOPP_DEFINE_NAME_STRING(Prime2)
CRYPTOPP_DEFINE_NAME_STRING(ModPrime1PrivateExponent)
CRYPTOPP_DEFINE_NAME_STRING(ModPrime2PrivateExponent)
CRYPTOPP_DEFINE_NAME_STRING(MultiplicativeInverseOfPrime2ModPrime1)
CRYPTOPP_DEFINE_NAME_STRING(QuadraticResidueModPrime1)
CRYPTOPP_DEFINE_NAME_STRING(QuadraticResidueModPrime2)
CRYPTOPP_DEFINE_NAME_STRING(PutMessage)
CRYPTOPP_DEFINE_NAME_STRING(TruncatedDigestSize)
CRYPTOPP_DEFINE_NAME_STRING(HashVerificationFilterFlags)
CRYPTOPP_DEFINE_NAME_STRING(SignatureVerificationFilterFlags)
CRYPTOPP_DEFINE_NAME_STRING(InputBuffer)
CRYPTOPP_DEFINE_NAME_STRING(OutputBuffer)
CRYPTOPP_DEFINE_NAME_STRING(InputFileName)
CRYPTOPP_DEFINE_NAME_STRING(InputStreamPointer)
CRYPTOPP_DEFINE_NAME_STRING(InputBinaryMode)
CRYPTOPP_DEFINE_NAME_STRING(OutputFileName)
CRYPTOPP_DEFINE_NAME_STRING(OutputStreamPointer)
CRYPTOPP_DEFINE_NAME_STRING(OutputBinaryMode)
CRYPTOPP_DEFINE_NAME_STRING(EncodingParameters)
CRYPTOPP_DEFINE_NAME_STRING(KeyDerivationParameters)
CRYPTOPP_DEFINE_NAME_STRING(Separator)
CRYPTOPP_DEFINE_NAME_STRING(Terminator)
CRYPTOPP_DEFINE_NAME_STRING(Uppercase)
CRYPTOPP_DEFINE_NAME_STRING(GroupSize)
CRYPTOPP_DEFINE_NAME_STRING(Pad)
CRYPTOPP_DEFINE_NAME_STRING(PaddingByte)
CRYPTOPP_DEFINE_NAME_STRING(Log2Base)
CRYPTOPP_DEFINE_NAME_STRING(EncodingLookupArray)
CRYPTOPP_DEFINE_NAME_STRING(DecodingLookupArray)
CRYPTOPP_DEFINE_NAME_STRING(InsertLineBreaks)
CRYPTOPP_DEFINE_NAME_STRING(MaxLineLength)
CRYPTOPP_DEFINE_NAME_STRING(DigestSize)
CRYPTOPP_DEFINE_NAME_STRING(L1KeyLength)
<br />
DOCUMENTED_NAMESPACE_END<br />
<br />
NAMESPACE_END<br />
<br />
#endif<br />
aes.h
#ifndef CRYPTOPP_AES_H<br />
#define CRYPTOPP_AES_H<br />
<br />
#include "rijndael.h"<br />
<br />
NAMESPACE_BEGIN(CryptoPP)<br />
<br />
DOCUMENTED_TYPEDEF(Rijndael, AES);<br />
<br />
typedef RijndaelEncryption AESEncryption;<br />
typedef RijndaelDecryption AESDecryption;<br />
<br />
NAMESPACE_END<br />
<br />
#endif
basecode.h
#ifndef CRYPTOPP_BASECODE_H<br />
#define CRYPTOPP_BASECODE_H<br />
<br />
#include "filters.h"<br />
#include "algparam.h"<br />
#include "argnames.h"<br />
<br />
NAMESPACE_BEGIN(CryptoPP)<br />
<br />
class CRYPTOPP_DLL BaseN_Encoder : public Unflushable<Filter><br />
{<br />
public:<br />
BaseN_Encoder(BufferedTransformation *attachment=NULL)<br />
{Detach(attachment);}<br />
<br />
BaseN_Encoder(const byte *alphabet, int log2base, BufferedTransformation *attachment=NULL, int padding=-1)<br />
{<br />
Detach(attachment);<br />
IsolatedInitialize(MakeParameters(Name::EncodingLookupArray(), alphabet)<br />
(Name::Log2Base(), log2base)<br />
(Name::Pad(), padding != -1)<br />
(Name::PaddingByte(), byte(padding)));<br />
}<br />
<br />
void IsolatedInitialize(const NameValuePairs ¶meters);<br />
size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking);<br />
<br />
private:<br />
const byte *m_alphabet;<br />
int m_padding, m_bitsPerChar, m_outputBlockSize;<br />
int m_bytePos, m_bitPos;<br />
SecByteBlock m_outBuf;<br />
};<br />
<br />
class CRYPTOPP_DLL BaseN_Decoder : public Unflushable<Filter><br />
{<br />
public:<br />
BaseN_Decoder(BufferedTransformation *attachment=NULL)<br />
{Detach(attachment);}<br />
<br />
BaseN_Decoder(const int *lookup, int log2base, BufferedTransformation *attachment=NULL)<br />
{<br />
Detach(attachment);<br />
IsolatedInitialize(MakeParameters(Name::DecodingLookupArray(), lookup)(Name::Log2Base(), log2base));<br />
}<br />
<br />
void IsolatedInitialize(const NameValuePairs ¶meters);<br />
size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking);<br />
<br />
static void CRYPTOPP_API InitializeDecodingLookupArray(int *lookup, const byte *alphabet, unsigned int base, bool caseInsensitive);<br />
<br />
private:<br />
const int *m_lookup;<br />
int m_padding, m_bitsPerChar, m_outputBlockSize;<br />
int m_bytePos, m_bitPos;<br />
SecByteBlock m_outBuf;<br />
};<br />
<br />
class CRYPTOPP_DLL Grouper : public Bufferless<Filter><br />
{<br />
public:<br />
Grouper(BufferedTransformation *attachment=NULL)<br />
{Detach(attachment);}<br />
<br />
Grouper(int groupSize, const std::string &separator, const std::string &terminator, BufferedTransformation *attachment=NULL)<br />
{<br />
Detach(attachment);<br />
IsolatedInitialize(MakeParameters(Name::GroupSize(), groupSize)<br />
(Name::Separator(), ConstByteArrayParameter(separator))<br />
(Name::Terminator(), ConstByteArrayParameter(terminator)));<br />
}<br />
<br />
void IsolatedInitialize(const NameValuePairs ¶meters);<br />
size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking);<br />
<br />
private:<br />
SecByteBlock m_separator, m_terminator;<br />
size_t m_groupSize, m_counter;<br />
};<br />
<br />
NAMESPACE_END<br />
<br />
#endif<br />
and a cpp
algparam.cpp
<br />
#include "pch.h"<br />
<br />
#ifndef CRYPTOPP_IMPORTS<br />
<br />
#include "algparam.h"<br />
<br />
NAMESPACE_BEGIN(CryptoPP)<br />
<br />
PAssignIntToInteger g_pAssignIntToInteger = NULL;<br />
<br />
bool CombinedNameValuePairs::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const<br />
{<br />
if (strcmp(name, "ValueNames") == 0)<br />
return m_pairs1.GetVoidValue(name, valueType, pValue) && m_pairs2.GetVoidValue(name, valueType, pValue);<br />
else<br />
return m_pairs1.GetVoidValue(name, valueType, pValue) || m_pairs2.GetVoidValue(name, valueType, pValue);<br />
}<br />
<br />
bool AlgorithmParametersBase::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const<br />
{<br />
if (strcmp(name, "ValueNames") == 0)<br />
{<br />
ThrowIfTypeMismatch(name, typeid(std::string), valueType);<br />
GetParent().GetVoidValue(name, valueType, pValue);<br />
(*reinterpret_cast<std::string *>(pValue) += m_name) += ";";<br />
return true;<br />
}<br />
else if (strcmp(name, m_name) == 0)<br />
{<br />
AssignValue(name, valueType, pValue);<br />
m_used = true;<br />
return true;<br />
}<br />
else<br />
return GetParent().GetVoidValue(name, valueType, pValue);<br />
}<br />
<br />
NAMESPACE_END<br />
<br />
#endif
|
|
|
|
|
pabloraul wrote: include path problem, im gonna research about that.
That's absolutely necessary, since any other problems will be un-fixable until you can successfully include the header files you need.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
by the way, do you have any interesting link about including? cant find anything useful yet...
|
|
|
|
|
|
yay! thenks Mark, that was the answer i was looking for, ill code it later since i have to go out. take care everyone
|
|
|
|
|
zzzzzzzzzzzzzzzzzzzt
What's that sound I hear? Seems familiar. This is almost reel interesting
led mike
|
|
|
|
|
pabloraul wrote: that would be perfect but try explaining that to my dad.
Give him the keyboard and I will. Is he the one telling you that you don't need to learn how to do C++ development to do C++ development? Who ever is telling you that is wrong. If you try to Internet Forum your way through this project it's going to take you like 1000 times longer than it would if you just stopped and learned C++ fundamentals first and then did the project. Also after you are done you will have learned about a 1 tenth of what you would had you spent the time actually focusing on learning fundamentals rather than focusing on getting the project done.
led mike
|
|
|
|
|
led mike wrote: NAMESPACE_BEGIN
what the heck is that?
Some compilers introduced namespaces pretty recently (gcc, for instance), and some libraries are using such macros to take this into account. Xerces-C is doing something similar.
|
|
|
|
|
|
hi, i am creating a ftp program using winInet in win32... in non asynchronous mode(no callback). it is connecting and when i use the ftpgetcurrentdirectory then return value whether true or false is immediate but actually the operation takes some time... how to detect whether the function has ended or not...? i dont want to use callbacks for this... but what i did was i used a timer to check the buffer whether the function returned any string... i feel this aint a proper way... and when i used the asynchronous mode i used a callback function in that there are many defined constants for which the compiler says undefined symbol... i am using dev-c++ IDE bu including the needed library in my project...
the call back function is called for opening and connecting to the server but not when i use the ftp_ functions... i am toggling between various methods to acheive some positive result but there wasnt a favorable result... phew and then i tried to use sockets like i used it for my own http request to my server... what will be the better way to use sockets to connect to the ftp server??? oh this line is the actual purpose of this big explanation... so this is my problem... so i am calling this command : CTRL + A and F1 ...
|
|
|
|
|
Jach Mullan wrote: then return value whether true or false is immediate but actually the operation takes some time
I don't know what that means. If you make a blocking call it is complete when it returns, period.
led mike
|
|
|
|
|
Jach Mullan wrote: but what i did was i used a timer to check the buffer whether the function returned any string
How did you do that on a blocking call? That shouldn't work at all.
Jach Mullan wrote: i feel this aint a proper way...
I agree.
Have you seen this: FTP Sessions (WinINet)[^]
Looks like sample code for many common FTP tasks using WinINet.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
in the end .. wininet connect through socket!
|
|
|
|
|
Dear all,
Please give me some clues to construct a screen which can display the points of x, y and z axis in 3d, point by point, by inputing 3 txt files, which each of these txt files contains the value of points in a particular axis, by c++.
If C++ cannot make it, can other program like java achieve this task??
Thank you,
John
|
|
|
|
|
Bad news: You've not got one problem, but many different ones.
Good news: None of those are amazingly tough, so you can pick them off one by one.
1/ Read the spec for the files? Can you trust them to have the same number of coords in each?
2/ How will the user tell you what those files are?
3/ Read in the files one line at a time, build a 3d point, and add it to an array
(CStdioFile/ReadString is good for this.)
4/ As your monitor is 2d, go on codeproject and look at some directx / opengl demo applications, and modify them to plot your shiny new points.
You may end up posting help questions for some of these, but at least you'll be doing bite size problems!
Iain.
Iain Clarke appears because CPallini still cares.
|
|
|
|
|
Depends what you want to achieve exactly. Do you want just a 3D chart (like something you can find in excell) ? If that's the case, just search on codeproject, there are some 3D charts.
If that's not what you want, then you should elaborate your request.
But anyway, a lot of things are possible (probably by using DirectX or OpenGL), the problem is the amount of time you are willing to spend on that.
|
|
|
|
|
johndoelee wrote: If C++ cannot make it, can other program like java achieve this task??
Please don't swear.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|