|
valerie99 wrote:
.looking at call stack, still can't find it stop at which file to get this value either...
Simplest way debugging is to show messagebox containg the values at the point you think there is problem.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
how can i get the md5 hash of something in mfc
|
|
|
|
|
google - there are plenty of MD5 examples available online.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
thats what i am doing write now... but all i am finding is forums about ppl asking what php's md5() function is for...
|
|
|
|
|
First hit[^]
You need to think about what you type into google. I typed md5 C++ source code. md5 by itself would obviously get a lot of other hits.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Any set of C functions would integrate nicely with MFC. Here's[^] one C-implementation. All you have to do is to copy'n'paste, and you're set.
char text[] = "your text here";
md5_context ctx;
md5_starts(&ctx);
md5_update(&ctx, (unsigned char*)text, sizeof(text));
unsigned char md5hash[16];
md5_finish(&ctx, md5hash); There you go! Please note that the contents of md5hash will be in binary format. It's not a string, it's an array of exactly 16 bytes. If you need to convert it into a string, then you'll have to do something like this:
char hashtext[33];
for(int i = 0; i < 16; ++i) {
unsigned char hinibble = ((md5hash[i] & 0xF0) >> 4);
unsigned char lonibble = md5hash[i] & 0xF;
hashtext[i * 2] = hinibble >= ? (hinibble - 10) + 'A' : hinibble + '0';
hashtext[i * 2 + 1] = lonibble >= ? (lonibble - 10) + 'A' : lonibble + '0';
}
hashtext[32] = 0; hashtext will now contain the hash on a hexadecimal form.
Also note that the input can be any kind of data, it doesn't have to be text! Any byte chunk would do.
Good music: In my rosary[^]
|
|
|
|
|
I've had an md5 implementation here on Codeproject for years and years. It works fine, although its pretty old fashioned code. There are several other MD5 examples here.
You can also use the MS Crypto API, look up the documentation for CryptCreateHash in Platform SDK.
|
|
|
|
|
|
I want to be able to show a small dialog box displaying progress while a pre-existing thread does work. I think the UI-threads are the right solution to my problem. I found this page and it looks like just what I need. I don't see how to show a dialog box in the process, only how to utilize CWinThread as a user-interface thread.
|
|
|
|
|
You can start the UI thread. Then display a modeless dialog box from within the thread, and close the modeless dialog box when you are done and about to exit the thread.
I usually have the primary UI thread create the modelss dialog box, then let a worker thread do a job and post messages to the HWND of the modeless dialog box regarding status, then when the worker thread is done, it signals the main UI thread which can remove the modeless dialog box.
You can use RegisterWindowMessage to set up custom messages to communicate from the worker thread to the mdoelss dialog and the main UI thread.
|
|
|
|
|
Thank you for the reply, it's very informative. I looked into a modeless dialog because I doubted I could interface with a modal dialog box. I found the function CreateIndirect(...) but I couldn't close the deal on the arguments so I abandoned it in favor of trying another route which I am not optimistic. I already have a series of handles setup to provide synchronization and I can wait for each event and adjust the dialog appropriately.
Can you give me a more detailed sequence of events, possibly with function names and such. I'm having a hard time filling out my CWinThread-derived class, I can't quite define in my mind what should be in my main controlling function and what should be in the UI thread.
|
|
|
|
|
I have tried Platform SDk, I download the SDK from MS-Website, and installed it. But i found the Platform SDK seem not well! My question are:
1) Some Windows DataType are not declared! for examples:
DWORD_PTR, PDWORD_PTR, ULONGLONG...
I check the SDK Document, Say these data type declared in BaseTsd.h! But
I opened headfile, I did not found these data type declare. Whats wrong?
2) After install Platform SDK, int the c:\C:\Program Files\Microsoft
Platform SDK\ folder, there are many head file'name and system files'name
are same as in the folder : C:\Program Files\Microsoft Visual Studio\VC98
So which file I will be useing in my projects? And how do I use the
different fiels?
|
|
|
|
|
You can configure the Visual Studio default directories to search the newer platform SDK header files and libraries. The ones shippd with Visual Studio are just 'older' versions of many of these same files.
See Tools|Options|Directories... menu item in Visual Studio 6.0 IDE to make changes. Make it search the Platform SDK folders ahead of the older ones that came with VS 6.0.
|
|
|
|
|
(1) Some Windows DataType are not declared! for examples:
DWORD_PTR, PDWORD_PTR, ULONGLONG...
I check the SDK Document, Say these data type declared in BaseTsd.h! But
I opened headfile, I did not found these data type declare. Whats wrong?
Thanks!
|
|
|
|
|
Rule #1 - Don't beleive everything you read in MSDN.
Rule #2 - See Rule #1
I found them defined in a myriad of files.
DWORD_PTR and PDWORD_PTR were defined in GCHOST.H and BaseTsd.h
ULONGLONG was defined in
PROGRAM FILES\MICROSOFT VISUAL STUDIO .NET 2003\SDK\v1.1\Tool Developers Guide\Samples\smc\Win32.h(38):typedef unsigned __int64 ULONGLONG;
and
PROGRAM FILES\MICROSOFT VISUAL STUDIO .NET 2003\Vc7\PlatformSDK\Include\WTypes.h(398):typedef unsigned __int64 ULONGLONG;
and
PROGRAM FILES\MICROSOFT VISUAL STUDIO .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(446):typedef unsigned __int64 ULONGLONG;
|
|
|
|
|
Hi,
I'm trying to write a c++ program that automatically logs me in at an online game. It worked for a few days but then, i think they made a change to their servers and now my code won't work.
It seems that i need to connect to the servers IP address directly instead of using the URL. So my question is: How can i get an URLs (web servers) IP address by its host name?
|
|
|
|
|
|
It does help, thank you very much!
|
|
|
|
|
MiltonFrog wrote:
It seems that i need to connect to the servers IP address directly instead of using the URL.
The URL can contain an IP address. Consider:
http://www.codeproject.com[^] is the same as http://209.171.52.99[^]
MiltonFrog wrote:
So my question is: How can i get an URLs (web servers) IP address by its host name?
Use gethostbyname() .
|
|
|
|
|
Hi, I'm interested in pursuing a career in the IT field as a programmer. My question is, What language should I start out with? I already know BASIC, and was thinking about self-learning C++, but I didnt know if I should just go into .net instead. So, what do you guys think? Is learning c++ important/necessary? Also, is it a good language to kick start my programming knowledge? If not, what is a good language to start learning with?
|
|
|
|
|
|
Hello,
C++ is one of the most difficult languages to learn. Learning C++ requires to learn a lot of stuff that will help you understand things much better for the rest of your career! Some of these things are memory management and pointers.
I started to learn C++ as my first language and by myself. I must say, that in the beginning it was a hard concept to grasp, but with the help of this community, trial and error practice made me understand the language very well.
If you want to learn both the languages, my advice to you is to start with C++. If you start with C#, you'll accommodate certain habits which will make it harder for you to be a good C++ programmer.
If you want to find a job very fast and you don't care much about other things, you should learn C#. Thats the language of the new windows platform and a lot of companies are migrating to .NET.
Good luck with the choice you make!
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Thank you very much, I think I'll continue with c++ so that It makes learning everything else much easier. Im not yet in college, so if I get the hang of C++ it will probably be invaluble in my education to come.
|
|
|
|
|
The other thing is, be careful of how you learn. There's plenty of info out there that teaches C++ in the hardest possible way, or teaches it using stuff that is pre-standard. For example, any book that tells you to include iostream.h, throw away. If you can get The C++ Programming Language by Bjarne Stroustroup, that's definately a good place to start, if a little wordy for a beginner.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
C++ is the best place to start, but you should also get a good book on C (to help improve your understanding of C++).
Stick to learning the basics (console level) as much as possible, because you want to learn the language before learning OS specific stuff.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|