|
If you want the key value try this article:
http://www.codeproject.com/cpp/plaintextsessionkey.asp
Raphael Amorim Dantas Leite
VC++, VB, Java, .NET and eMbedded Programmer
|
|
|
|
|
|
I was wondering, pondering even, what would be the easiest way to check 1 character in a CString to see if it was a number?
The scenario is I have a string that could either be www.blah.com or it could be 123.123.123.132 or some other domain name or IP. I want to check whether its a domain name or IP address before I process the details, but I can't decide on the easiest way to do it.
Would a nasty if (string.GetAt(0}=='1')||(string.GetAt(0)=='2'.......
be the easiest way or is there some other technique I've not noticed?
Cheers lads & lassies
|
|
|
|
|
|
fantastic, I knew there was something I was missing but I just couldn't see it.
Thanks for the great fast help
|
|
|
|
|
|
maybe something along the line of IsNumeric(string.GetAt(0)) ? I am not sure of output of string.GetAt(0), there fore assuming that you are extracting the first character from the string.
hope this helps
|
|
|
|
|
How can I prevent my MFC SDI app from trying to load the related file type when a user opens the file type from windows explorer. I'm gettting it form the view class..How do I keep the doc class from opening it?
-Steven
By reading this message you are held fully responsible for any of the mispelln's or grammer, issues, found on, codeproject.com.
For those who were wondering, actual (Linux) Penguins were harmed in creating this message.
|
|
|
|
|
Do you still want the application to load, but not load the document? Or do you not want any associations made at all (i.e. file type wont even get a new icon)?
To answer the first is to simply ignore any command-line parameters that request a file to be opened. i.e. when you CCommandLineInfo objects m_nShellCommand member equals CCommandLineInfo::FileOpen .
As for the second, remove the following entries to your InitInstance.
EnableShellOpen();<br />
RegisterShellFileTypes(TRUE);
Also, if you've already run you application, which if my assumption is correct, you already have, you'll have to go and physically remove the associations from the registry (HKCL\.ext--where ext is the extension of the file you’re project was initially created to modify).
cheers,
-B
|
|
|
|
|
Hello,
i need to realize a dropdown-button within a toolbar by using mfc70. I added the extended style TBSTYLE_EX_DRAWDARROWS to the toolbar and also i modified the style of the corresponding button (TBSTYLE_DROPDOWN). Clicking on the arrow will call the message-handler i defined in the following way :
afx_msg void OnToolbarDropDown(NMHDR* pnmh, LRESULT* plRes);
The message-map-entry is the following :
ON_NOTIFY(TBN_DROPDOWN, AFX_IDW_TOOLBAR, OnToolbarDropDown)
In the msdn-description the NMHDR-structure is defined as
typedef struct tagNMHDR {
HWND hwndFrom;
UINT idFrom;
UINT code;
} NMHDR;
I thought that i could read the idFrom-value to determine the resource-ID of the button where the arrow was clicked. But for different dropdown-buttons the value is always the same and it matches to no button-ID available! So how can i determine the id of the corresponding dropdown-button by using the NMHDR-structure instead of the NMTOOLBAR-structure (used in vc60)?
Best regards
tabor25
|
|
|
|
|
hi all!!
I need to take a look at some good shareware / registration coding techniques /tips.
I have made an app. that im going to release as shareware, and now i just need to plug in some kind of reg. code scheme to enable the features once they enter my code or something like this.
id like pros / cons of the various standards available, and some links would be great too...
thanks for anyones help in advance...
josh
todo....
:: insert inpirational text here ::
|
|
|
|
|
Don't bother with registration and stuff like that.... if it's a good shareware, it will be cracked and hacked.
just make a "free" shareware nag-ware, with pop-up dialogs showing from time to time, remove some basic functionnalities ( like save/export ... ), limit some other functionalities ( e.g. limiting input size, limit number of files loaded in one runtime, ... )
One thing, you can do, is to have the user need to send you a valid Email to download the software, in the Email, you give a one-time only full download path; but that is extra work on the web site.
Max.
|
|
|
|
|
Hello,
You should keep it simple: it will be cracked anyway if it catches some attention! I used an encryption algorithm (Blowfish in my case): I encrypt the e-mail of the registered user using a private key and the algo. You will get an hexadecimal buffer (16 chars ranging from 0 to 255) that you can translate to something that can be typed: for instance change each character to its written hexadecimal representation on two characters: this has the disadvantage of doubling the length of your serial number but that's the way it is. You get something like B0AA7D4350A88F... and so on.
If you want to do an evaluation period for it you should refer to http://www.codeproject.com/system/cexpire01.asp[^], a good stuff available.
Regards,
mynab
|
|
|
|
|
Forgot to mention that big disadvantage is that private key appears in the binary. Try to hide it for instance by creating a 64-char random string and then start your private key at say character 10. Again this is easily crackable but as I said if your shareware is worth being cracked it will be anyway.
|
|
|
|
|
first, everything is breakable.
second, the fewer restrictions you place on users, the more registrations you get - really. if you make it a pain in the ass to use your app on a trial basis, people won't get to really use and grow dependent on your app (the ultimate goal!).
a simple time limit (14 or 30 days) is easy to implement, and easy to beat, but it does get a lot of registrations simply because people get tired of having to reset their clocks or track down your registry keys.
a two part key is pretty simple to do, too:
get some user info, get some user options. combine these into a string of bytes (hash the username, add the user option bytes to the end of the buffer). encrypt the whole thing. convert it to a string of hex chars, send this to the user.
when the user enters his name to register, hash it. decrypt the license, compare the hash to the hashed name in the key. if they match, get the user option bytes and things are all set.
to do this, you need
a) a hash function (any cipher can do this, block or stream). this goes in your app and the key gen. even CRC or checksum would work here.
b) a cipher to encrypt/decrypt the key. you'll need this in your app and the key gen. (public key is best)
c) a function to combine and encrypt the data in the key gen.
d) a function to decrypt and split the key data in your app.
-c
I'm not the droid you're looking for.
|
|
|
|
|
I have the following piece of code:
------------------------
FtpConnection* pConnect = NULL;
try
{
pConnect = sess.GetFtpConnection(host,username,password);
CFtpFileFind finder(pConnect);
BOOL bWorking = finder.FindFile(_T("*"));
while (bWorking)
{
bWorking = finder.FindNextFile();
if (finder.IsDirectory())
{
m_list.AddString((LPCTSTR) finder.GetFileURL());
pConnect->SetCurrentDirectory(finder.GetFileName());
CFtpFileFind finder2(pConnect);
BOOL bWorking2 = finder2.FindFile(_T("*"));
while (bWorking2)
{
bWorking2 = finder2.FindNextFile();
m_list.AddString(" "+finder2.GetFileName());
}
pConnect->SetCurrentDirectory("/..");
}
}
}
catch (CInternetException* pEx)
{
TCHAR sz[1024];
pEx->GetErrorMessage(sz, 1024);
//printf("ERROR! %s\n", sz);
m_list.AddString("ERROR!");
pEx->Delete();
}
// if the connection is open, close it
if (pConnect != NULL)
pConnect->Close();
delete pConnect;
-----------------------------------------
The idea is to connect to an ftp site and list (adding strings in the list box thru its control variable m_list) all the folders and all the subfolders and files in the folders.
So far, the program lists all the folders in the site, but doesn't list the folders and files in these folders.
I'm using two different CFtpFileFind objects for the two searches.
Could anybody PLEASE help me with this?
thanks a lot!
-- narada
|
|
|
|
|
Its not easy to tell from your code because of the way the site skews the formatting, but it looks like you're checking if its a directory and ignoring the files. So it checks and if the next item is a file it just falls through the loop.
I'd recommend only using the 1 CFtpFileFind object instead of the two, because MFC's ftp classes are a bit quirky sometimes and it may cause more problems than good.
|
|
|
|
|
In the first level I only want to list the directory and ignore the files. Now, if what I've found is a directory, then I get into it (with SetCurrentDirectory), and then I look for files AND directories. I use a different CFtpFileFind because when I get out of that directory again, I want the directory search to continue.
Is this correct, then?
Why am I getting no list of the files/directories in the second level? (The program flow never gets into de second 'while' - while (bWorking2) - ).
Thanks a lot, Carrie
|
|
|
|
|
carrie wrote:
Its not easy to tell from your code because of the way the site skews the formatting
If people only could learn not to use TABs in their source,it would look nicer.
|
|
|
|
|
Sorry, I wasn't aware of this. I apologize.
-- narada
|
|
|
|
|
carrie wrote:
Its not easy to tell from your code because of the way the site skews the formatting
If people only could learn not to use TABs in their source,it would look nicer.
Gisle V.
"If you feel paranoid it doesn't mean they're not after you" -- Woody Allen
|
|
|
|
|
Hi,
I have a audio player that is skinned. There are 4 seperate regions (different states in the player). I create these regions before hand on program start up. My problem is that when I try to set a region that has already been used before the SetWindowRgn function fails (I'm guessing because windows deleted it or something)
I want to avoid creating the region on the fly because it takes a second or so to create the region from the bitmaps that I use for skinning.
Is there anyway to stop windows from deleteting the region after you set the window region to a different one.
Thanks
|
|
|
|
|
Ceri wrote:
Is there anyway to stop windows from deleteting the region after you set the window region to a different one
No. MSDN states:
After a successful call to SetWindowRgn, the operating system owns the region specified by the region handle hRgn. The operating system does not make a copy of the region, so do not make any further function calls with this region handle, and do not close this region handle
But you can use CRgn::CopyRgn() to make a local copy of your region, before you feed it to the API.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
Is the CopyRgn function of the CRgn class fast enough so that it does not show a delay.
|
|
|
|
|
Sorry, I have no idea.
Just remember to tell here if you find out
Good luck with you project!
My opinions may have changed, but not the fact that I am right.
|
|
|
|