|
hi all,
i am using VS2003 for VC++,
but if i create project of MFC, the default resource language is Chinese, so if i click on finish without changing the resource language, i have to delete the project and do all things again to change the resource language.
is there any way to set it to English as default?
thanx in advance!
|
|
|
|
|
So, I need to validate that a workstation exists on a local area network
I can do so in a few ways, like NetServerGetInfo or WNetGetResourceInformation
The annoying thing is, these functions hang for 30 seconds or so when passed
a workstation name that does not exist, example "\\notThere"
I thought of using some of the picg samples, but they require UDP protocol, which I cant depend on.
Does anyone know of a fast way to see if there is such a machine on the network?
Bill in PA/USA
|
|
|
|
|
Is IsDestinationReachable("\\\\notThere", NULL) of any help?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yes that is better - about a 3 second wait for a non machine, versus about 30 seconds if GetFileAttributes() is called on a bad share.
Thanks for the tip.
Bill in PA/USA
|
|
|
|
|
Before anyone can provide an intelligent answer, do you need to know of a system (any system) is running at the IP address that the workstation name you provide resolves to, or do you need to make sure that a real Windows system is there?
If the former, something like a naive ping or routing tests will work. If the latter, you may be stuck with the functions you are using now. You could always throw up a "Please Wait" dialog while you are doing the test - like if you need to validate something against a license server...
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
We find illegal copies of our software in several countries.
Currently we hope a new developped software can be installed only on buyer's computer. In other words, the software only can be installed on buyer's windows OS.
To do so, I need to get Unique Windows ID, and software is installed by checking the ID - my plan is: buyer sends the ID to us before we submit software to him.
I posted a post before which asks for Windows CD-key, but repliers said it is impossible.
Do u know any idea to get Unique Windows ID to help me?
thx.
|
|
|
|
|
includeh10 wrote: Do u know any idea to get Unique Windows ID to help me?
Several copy protection schemes resort to using the network adapters MAK.
I dont think you can get the windows code.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
includeh10 wrote: Do u know any idea to get Unique Windows ID to help me?
Have you considered Guidgen?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
includeh10 wrote: We find illegal copies of our software in several countries.
Welcome to the club!
What you can do, as others have done, is not use the Windows registration key, but use other things that are system specific. Here is a list of a few of them, in order of increasing fragility (i.e. likelihood of changing):
o CPUID value (Google for the CPUID instruction)
o Motherboard/BIOS ID
o Number of IDE/SATA controllers
o Geometries of physical drives (not partitions or drive letter, and be sure to allow for additional drives to be added)
o On-board devices (# of COM and Parallel ports)
o NIC address(s)
o Computer Name
Not all of the items are easy to get, mind you, and ones that are easy to get like drive letters, computer name, OS version/patch level, etc. are more likely to change, and remember that it is a serious PAIN IN THE ASS to have to contact a software vendor to get a new key each time you upgrade your memory or drives.
Be prepared for more users to contact you about system-level changes invalidating their system-locked installation.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Are there any functions to round the decimal value to its nearest decimal.
For eg:
1. float fVal = 5.26 The final result should be fVal = 5.30
2. float fVal = 5.23 The final result should be fVal = 5.20
using ceil it gives 6 and using floor it gives 5; but i m looking for nearest decimal.
Answers are appreciated.
|
|
|
|
|
Try adding 0.05 to the number.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
If you need two decimal places, multiply with 100 and use ::ceil() or ::floor() , and then divide by 100.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
You can do...
float RoundedABit (float fVal)
{
fVal *= 10.0;
fVal = floor (fVal + 0.5);
fVal /= 10.0;
return fVal;
}
So, just shift it one decimal place, do your rounding, and shift it back.
You could probably also add 0.05, and use fmod .
Iain.
|
|
|
|
|
Thank You Iain good logic.
|
|
|
|
|
Iain had good answer for positive numbers.
RoundABit(-1.59999) would return -1.5, not -1.6 as it should.
Corrected to allow positive or negative, added Factor for variable decimal place position, and made it execute faster...
float RoundedABitToo (float fVal, float fFactor = 10.0)
{
return (floor((fVal * fFactor) + (fVal >= 0.0 ? 0.5 : -0.5)))/fFactor;
}
Gary
|
|
|
|
|
Thank You Gary for correction.
|
|
|
|
|
Silly question
<br />
main()<br />
{<br />
list[char*] pRecords = NULL; (*** proper list tag not used because HTML encoding ***)<br />
while(bRepeatForever)<br />
{<br />
pRecords = SomeFunc();<br />
ProcessRecords(pRecords);<br />
<br />
delete pRecords; <--- QUESTION: Do I need to delete individual list element?<br />
}<br />
<br />
...<br />
}
Then
list * SomeFunc()<br />
{<br />
char * pszData =NULL;<br />
...<br />
list<char*> pRecords = new list<char*>;
<br />
for(int i=0; i<1000; i++)<br />
{<br />
pszData = new char[10];<br />
pData=GetSomeData(i);<br />
strcpy(pszData, pData);<br />
pRecords->push_back(pszData);<br />
}<br />
...<br />
}<br />
Please note:
list[char*] pRecords = NULL; *** proper list tag not used because HTML encoding ***
|
|
|
|
|
If I understand your question and the related code :
yes.
|
|
|
|
|
You did not use the <pre>-tags for your code, so the < and > and anything in between are lost. So I can not see what type of list you created.
But in general, you need to delete every single object if you are having a list of pointers to objects you new ed. In that case, you could use smart-pointers (like boost::shared_ptr[^] [but not std::auto_ptr]) in your list.
Have you considered using a string class?
-- modified at 9:14 Thursday 23rd August, 2007
clickety
-- modified at 9:19 Thursday 23rd August, 2007
I did not read his code hard enough.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
jhwurmbach wrote: smart-pointers (like boost::shared_ptr[^] [but not std::auto_ptr])
why not standard ones ?
|
|
|
|
|
Reference counting vs. ownership differences may be significant depending on how the objects are used?
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Because when you copy an auto_ptr , ownership of the object pointed to by the auto_ptr is transfered to the copying auto_ptr , and the copied auto_ptr is set to NULL.
So, simply copying an auto_ptr changes its value!
And internally, STL-container copy their content whenever needed. They require their content to be copy-constructible.
Also, the standard forbids containers of std::auto_ptr , but real-world STL-Implementation compile them nonetheless.
From "Scott Myers, Effective STL, Item 8"
For this reason, boost did invent smart pointers exhibiting a more intuitive behavior.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
|
Thanks, these are char*
They were gone because of HTML formatting!
Ang good beginner tutorial on Smart Pointer?
|
|
|
|
|
devvvy wrote: Ang good beginner tutorial on Smart Pointer?
Hmm - no, sorry. Google gives a lot of hints with tips, but no concise tutorial.
You construct them like this
boost::shared_ptr<Object> Obj( new Object);
and now use Obj like any pointer to an object: use as function parameters, return from function etc.
At the time when the last copy of the smart_ptr goes out of scope, the contained object is delete d.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|