|
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.
|
|
|
|
|
It should be. Anyway, i think this API must be the fastest:
DWORD dw;
RGNDATA *lp;
HRGN hRgnCopy;
dw=::GetRegionData(hRgn, sizeof(RGNDATA), NULL);
lp=(RGNDATA *)(new char[dw]);
hRgnCopy=::ExtCreateRegion(NULL, dw, lp);
delete lp;
rechi
|
|
|
|
|
Ummm. Maybe you can copy the region (CopyRgn ) before passing it on to the windows with SetWindowRgn so that you have always a fresh copy to work with.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hello,
maybe this is a little off-topic, but i don't know where to post this problem - sorry. I need to determine if my source-code is compiled by vc60 or .net, because i have to include different header-files depending on the compiler-version. I want to do it in a way like this :
#ifdef _VC60
#include <..\src\afximpl.h>
#else
#include <..\src\mfc\afximpl.h>
#endif
I think that there must exist a global constant or variable that describes the compiler-version. But what is the name of this constant or variable (it's not _VC60 ).
Best regards
tabor25
|
|
|
|
|
You can get the compiler version with _MSC_VER. Look into the online help for the possible values.
However from your example I guess that you really want to use _MFC_VER which gives you the MFC version (>= 0x0700 for MFC 7 or higher).
Oliver
|
|
|
|
|
Thank you very much, Oliver. I will use the online-help to figure out the rest.
Best regards
tabor25
|
|
|
|
|
Hi,
can anyone help me with this prob ??? I am at a total lost
I have several pointers (using them as matrix) and i have always allocate mem to them using the "new" operator. However i encounter a strange problem with one of them (temp). Whenever my program trys to access the pointer 'temp' up to a location, it would generate an "First-chance exception: 0xC00000005: Access violation" error.
an eg of the code is like this:
double * temp
temp = new double (5000);
for (i = 0; i < 5000; i ++)
{
temp[i] = x*y;
}
I use breakpoints and see that the index of temp from 1 to 2577 is valid. However when i > 2578 all the values are invalid ("CXX0030: Error: expression cannot be evaluated") and hence causing my program to hit the ""First-chance exception: 0xC00000005: Access violation" error. This seems so strange to me and i am at a lost of what to do......
Can anyone tell me why is it so ?? and how can i solve this problem??
Thank you very much for your kind attention !!
|
|
|
|
|
Must be:
temp = new double [ 5000] ;
rechi
|
|
|
|
|
Hi rechi,
Really thanx a lot ... I guess i made a silly typo without realizing !! You save my day
bk
|
|
|
|
|
Hello everybody,
My task is to interrupt a job (click on a button) that takes a lot of time for execution (a kind of endless loop). This code is in a DLL.
I tried different methods without success.
If the code is executed in the same thread, I can solve this problem with the ::PeekMessage() function.
Is the DLL executed in a different thread?
Can you help me?
Thanks,
Gelu
|
|
|
|
|
In principle, DLL code is executed in the same thread as the EXE that invokes it, unless the DLL launches a secoondary thread on purpose.
Anyway, I'm curious about how you plan to terminate the llop using PeekMessage . Good luck.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Obviously, when I work in a executable my code seems like this:
fct()
{
.... init loop ...
MSG msg;
while(!(::PeekMessage(&msg, GetDlgItem(IDC_STOP)->m_hWnd, 0, 0, PM_NOREMOVE))
{
...... do a step ...
}
}
where IDC_STOP is a button.
If I put the same code in a DLL
fct()
{
.... init loop ...
MSG msg;
while(!(::PeekMessage(&msg, 0, 0, 0, PM_NOREMOVE))
{
...... do a step ...
}
}
The GUI freezes and I have to use the task manager to kill the task
Thanks,
Gelu
|
|
|
|
|
Hi,
First create a new thread for your endless loop function. Then the first line of the thread execute the following
[code]
PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE)
[/code]
This will force the OS to create a non windowed message loop. Inside your loop you can the use PeekMessage or GetMessage to receive messages for that thread. Obviously the hWnd member of the MSG struct will contain NULL because is has no window.
To post a message to the thread message loop use PostThreadMessage. This will fail if you haven't created the message loop at the start of the thread
Hope this helps
Ceri
|
|
|
|
|
Hi Ceri,
My experience on creating threads in Windows system is very limited. Can you recommend me some code?
Thanks,
Gelu
|
|
|
|
|
Try this
[code]
#include "stdafx.h"
#define CUSTOMSTOPMSG WM_USER + 1
DWORD WINAPI ThreadProc(LPVOID lpParameter);
void StartThread();
void StopThread();
//the thread ID. Must give this ID to PostThreadMessage
DWORD dwThreadID = 0;
//this function is the thread function - contains the infine loop
DWORD WINAPI ThreadProc(LPVOID lpParameter)
{
MSG msg;
int iRetVal = 1;
PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE); //forces creation of non windowed message loop
while(!(PeekMessage(&msg, NULL, CUSTOMSTOPMSG, CUSTOMSTOPMSG, PM_REMOVE)))
{
//....do processing here
};
//.... do clean up here
return(iRetVal);
}
//execute this function from your standard thread
void StartThread()
{
HANDLE hThread;
//you can use this to pass a parameter to your thread
//(usualy a pointer to a struct or some other kind of user data)
LPVOID pParam = NULL;
hThread = CreateThread(NULL,0,ThreadProc,pParam,0,&dwThreadID);
}
void StopThread()
{
//obviously wParam and lParam in the PostThreadMessage could be some value also
if(dwThreadID)
PostThreadMessage(dwThreadID,CUSTOMSTOPMSG,0,0);
}
[/code]
Call StartThread when you want to initialize the loop and StopThred when you want to stop (I guess you would use your button for this)
Let me know how you get on
|
|
|
|