|
Hey Dave,
Damn it, you are right, I screwed that one up. But, on removing the & to get the value, not the address, I get a negative number. Perhaps this is happening due to the integer Format I perform? How could I place this value onto m_sResult (a CString) with alphanumeric characters?
Thanks again.
Best Regards
Fabio Miguez
|
|
|
|
|
Fabio Miguez wrote:
But, on removing the & to get the value, not the address, I get a negative number.
HDD serial numbers/volume IDs are unsigned, and are usually given as hex, so use %x rather than %d (or %u if you want a decimal number).
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Fabio,
I also needed the information you seek. I downloaded the DiskId32
and also had compile problems; (4) errors. Were you able to get around the compile errors?
The *.exe runs fine, but won't recompile under VC++ 6.0...
Would appreciate any suggestions you may have.
Thanks,
Steve.
|
|
|
|
|
Hey Steve and Ryan,
It seems GetVolumeInformation doesn't return the HDD serial, but the "volume" serial, which changes every time you format the HDD (or is the same for cloned HDDs, which a bunch of manufacturers do).
Apparently there is no easy way to get HDD serials, short of the complex (to me) code in diskid32. I also found that my number is negative because under Windows, when formatting a drive, the volume serial can be either positive or negative. So you could use this number for copy protection, but if the user passes it on to someone who happens to have the same model of computer (say, the same Dell), this volume serial might be the same. What are the chances? Not great, but this is definitely not the way to go for large scale applications.
Microsoft activation, for example, uses the actual HDD serial, among others, probably with code similar to diskid32.
My question now is are there any other hardware serials (video card, mobo, memory) that are more easily accessible to begginers like me?
Best Regards
Fabio Miguez
|
|
|
|
|
Fabio,
Are you trying to lock to a specific computer?
In that case, use multiple hardware keys and multiple system metrics and allow the program to work if a 'majority' of them are met.
Use hard drive volume numbers, get the MAC address of the network card if there is a network card, use a hash of monitor type name, you could look up modem manufacturer or modem type, memory quantity, sound card manufacturer or type, etc.
You save all these bits of information somewhere, and when you do your check, you allow it to be successful if several of the items are still valid (for example, user might have temporarily used a different monitor, but it is unlikely they constantly add or remove memory or change hard drives around).
This way, you are not dependnet upon one single bit of information that might change, and as a result, constantly issuing new keys to your users unecessarily.
|
|
|
|
|
Hey Blake,
Yeah, trying to lock it to a certain machine. The idea behind the HDD serial was that would stop the user from copying the program to another HDD, and also allow him to change whatever hardware he needed on the machine (video card, monitor, etc.) without having to request a new key. If he changed HDDs, then he would need a new key.
But I have been frustrated by how seemingly complex it has been to retrieve the HDD serial, so I am open to other ideas. Your suggestion is very good, but I don't know how to retrieve any of the information you mentioned. I have not yet searched for it (at work, not much time right now), but do you know of any offhand?
Thanks a ton.
Best Regards
Fabio Miguez
|
|
|
|
|
I am still new at initilization list.
For penSolid.CreatePen(PS_SOLID, 1 RGB(100, 100, 100));
I can initilize with
penSolid(PS_SOLID, 1 RGB(100, 100, 100))
How would I go about Initilization list
fontTimesNR.CreatePointFont(85, "Times New Roman"); ?
The default intialization list is using font.CreateFont();
|
|
|
|
|
If the class in question has a constructor that takes the arguments you want it to, then you're good to go. Unfortunately for you, the only constructor for CFont is the default, which takes no arguments and doesn't really do much of anything. You need to call the appropriate CreateFont * to get an actual font created.
You might want to take a look at GDI+ if you don't need Win95 compatibility - its object model is a lot nicer.
Shog9
I'm not the Jack of Diamonds... I'm not the six of spades.
I don't know what you thought; I'm not your astronaut...
|
|
|
|
|
i have the compiler but after i compile my code i go to execute it and a dos looking window pops up and then goes away
if you have any information that could help me please reply
|
|
|
|
|
I am trying to copy a group of files with the same name, but different extension, but I want to rename them during the copy operation.
If I use the command line, the syntax would be:
copy file.* newfile.*
which works perfectly.
Is there an elegant way to do this using SHFileOperation, which says that "Wildcard characters are not supported" in the destination.
I don't want to have to expand the wildcard in order to copy, and I *really* don't want to open a command window to run a DOS command either! Either I'm missing something obvious, or there seems to be some functionality missing from SHFileOperation....
|
|
|
|
|
Use FindFile to loop through the files indicated by the first wildcard, creating destination filenames based on this. Use CopyFile() or SHFileOperation() as appropriate to perform the copy.
Miszou wrote:
there seems to be some functionality missing from SHFileOperation
I would say the functionality is missing in the shell... renaming multiple files with the same extension does not preserve the original filenames in any way. But, that's the way they did it...
Shog9
I'm not the Jack of Diamonds... I'm not the six of spades.
I don't know what you thought; I'm not your astronaut...
|
|
|
|
|
At my school, we're currently using visual C++ (sorry i said visual basic before by mistake). I recently downloaded the new beta versoin of VC++, and it doesn't seem to have iostream.h. I was wondering where I could find a good source for both iostream, and other libraries I may need in the future.
=P
|
|
|
|
|
iostream is a C++ thing, not VB.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Try iostream without the .h
|
|
|
|
|
#include <iostream>
without the ".h" it should work.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
hmm, I'm not sure if my problem's linked, but I'm getting an unidentified identifier error when i try to use cout or endl. (while using #include <iostream>) It doesn't seem to effect my program wether or not I include iostream (without the .h) at all.
-------------------------------
I'm also having trouble getting string to work.
String Suit1 = "No suit", Suit2 = "No suit";
An error comes up when i run that code, saying I forgot a ; before suit1. and I'm getting syntax error: identifier 'String' whenever it's used in the program other then the initial delaraction of the variables Suit1 and Suit2.
I have #include string.h (with arrows, the post acts weird if i put them in) and there seems to be no problems with it, and I've run similar code on VC 6 with no problem.
-------------------------------
Am I doing something wrong, or is there a problem with my libraries?
=P
|
|
|
|
|
OK. Here's your problem. When the C++ standard was introduced, one thing that was added was namespaces. The standard libraries were placed in namespace std, and the headers that end in .h were deprecated ( i.e. most compilers have them, but they are not standard, they are not part of C++ as define by X3J16 ).
So, to use the string class, for example, you must #include<string), NOT #include<string.h>.
BUT, by doing this, you make part of namespace std visible, which will not give you access to the string class unless you do one of these:
using namespace std; // This is really bad, it includes everything in std, i.e. a lot of stuff you don't know about, and which could change in future compilers
using std::string; // much better, drag the string class alone ( well, and any iostream operators, but that's another story ) into the global namespace
or, in your code:
std::string myString; // best of all in terms of segmentation of namespaces, but a bit cumbersome, I'd use it only for things I am only going to define once or twice.
Also, String with a capital S is wrong. The string class is all lower case.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Thanks a ton, that cleared a lot of stuff up. That seems strange that my school is teaching me outdated material (damn budget). Anyways, I'm still a little confused as to what I do to use cout or endl. Are there replacements, are they in std, etc.?
=P
|
|
|
|
|
Kyle Bishop wrote:
That seems strange that my school is teaching me outdated material (damn budget).
The problem is rarely the budget, it's that teachers are probably a bunch of old C hackers who actually don't know any better.
Kyle Bishop wrote:
Anyways, I'm still a little confused as to what I do to use cout or endl. Are there replacements, are they in std, etc.?
Yes, the standard headers contain the same stuff, they are just in std. So, to extend my example:
#include <iostream>
using std::cout;
using std::endl;
will give you what you're after.
As an aside, don't overuse endl, it does more than send a /r/n, it also flushes the stream, so if you use it in tight loops, performance will suffer.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
|
Kyle,
I don't know if you are using VC++ 6.0 or .net. I also had a similar problem when porting VC++ 6.0 code to 2003 .net.
Some kind soul informed me that I should use "iostream" instead of
"iostream.h" and it worked!
Somehow, MicroSoft dropped the ".h" in later releases of the compiler in this case.
Good Luck.
|
|
|
|
|
thompsons wrote:
Somehow, MicroSoft dropped the ".h" in later releases of the compiler in this case.
This is not the case. In fact, when you are using iostream without .h and in angle brackets, you are using STL's iostream. Microsoft dropped support for streams when they first came up with Visual C++.NET
Found on Bash.org
I'm going to become rich and famous after i invent a device that allows you to stab people in the face over the internet
My Articles
|
|
|
|
|
I am using the VMRPLAYER sample program from DirectX SDK
as a template. I need to use the filename from file opened
as the main stream for the C language fopen command.
I need the full filename (ie: C:\subdirectory\video.vob) in the C program. Where to look and what strmcopy is best.
Thanks
|
|
|
|
|
I try to record and playback application session with help of WH_JOURNALRECORD and WH_JOURNALPLAYBACK hooks but can’t properly playback MOUSEWHEEL event ( rotation direction is ignored)
JournalRecordProc and JournalPlaybackProc hook procedures use LPARAM ( pointer to the EVENTMSG structure ) to get/pass message specific information during recording/playing.
This EVENTMSG structure has no member for WPARAM information, but key indicator and wheel rotation information are stored in WPARAM of WM_MOUSEWHEEL message. The same problem is with all messages with specific WPARAM info.
How I can correctly play WM_MOUSEWHEEL message?
Thanks in advance
Petr
|
|
|
|
|
|