|
I don't expect you will find much code out there that you can use. It is very hard (as in phd's get it wrong all the time) to create something like this that isn't easy to break. So nobody shares their code as sometimes that is the only thing protecting them.
Read Applied Cryptography, if you read between the lines it will at least prevent you from making stupid mistakes.
Depending on how much effort you feel this is worth, you can get more and more complex. However coimplexity doesn't mean that your system is any better. Remember, the bad guys can disassemble code.
The company I work for uses the keys to allow us to ship a demo, and depending on what you buy we enable more features. However it is understood that any cracker who couldn't break our scheme isn't worth the name. We are just keeping the honest people honest.
One warning: don't make this too intrusive. I know people who buy legitimate copies of software, put it on a shelf. Then they go to the pirates and get an illegal copy that they actually run, just because the illegal copy isn't so intrusive. Harddrive keys work, but they are annoying, and belive it or not, not every system has a harddrive. (though you can likely ignore those few systems without one)
Hardware dongles are worse, some comptuers don't have USB ports. They often interfer subtilly with printers on the printer port. (or worse a non-printer device) And you have just thrown away the (small) market for people who use Wine to run your program under linux, (I'm assuming you target windows) not something you should do if you can help it. Last, the libraries to use dongles are not always bug free, in some cases your program is much less reliable just because of all the problems the dongles cause. That said, there is a time and place for a hardware dongle, if you are one use them, just beware of the downside.
|
|
|
|
|
how could I disable the function when I click escape, dialog auto close.
just like overwrite OnOk() function?
but it seems there's no OnEscape()
|
|
|
|
|
The function you are looking for is OnCancel . Add a button with the ID IDCANCEL if you don't already have one, double click it to create a handler (in MSVC++ 6.0). Remove the call to the base class OnCancel and - finally - remove the button if you don't need it (although of course not the handler )
|
|
|
|
|
hmmm, if I overwrite OnCancel function, Esc key terminating the application is disabled, but I also can't terminate the application by click the top right cross button. What I want is just disable the key meanwhile the cross button still works.
|
|
|
|
|
Then you might want to kill the keypress as early as possible, adding the virtual function PreTranslateMessage :
BOOL CSomeDlg::PreTranslateMessage(MSG* pMsg)
{
BOOL result = FALSE:
if( pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE )
result = TRUE;
else
result = CDialog::PreTranslateMessage(pMsg);
return result;
}
|
|
|
|
|
yes, this is what I want, thanks
|
|
|
|
|
HI ,,
i m using CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
but compiler gives error Undecleared Identifer.
while i m using its header file and lib file
but CoInitialize gives no error
wets problm
thanx
|
|
|
|
|
Add this to a header file.
#define _WIN32_DCOM
Kuphryn
|
|
|
|
|
My apologies if you already answered this question, but I've looked all over the web and in book stores for information on how to get the html content of a webpage that was Navigated to with the CHtmlView class. To be more clear, I am using a CHtmlView class and navigating to a webpage on a specific server that I maintain. That webpage does some serverside work and gives me a new webpage. This new webpage will display some data that I need to process before moving on to do something else within the application. Any hints suggestions or solutions as to how to get this data while using the CHtmlView class would be greatly appreciated. Other solutions are welcomed as well. Thank you.
Sincerely,
Testtests
|
|
|
|
|
Hi there,
Firstly, override the OnDocumentComplete virtual function (event), then we can get access to the DOM, e.g.
virtual void OnDocumentComplete(LPCTSTR lpszURL);
void CMyHTMLView::OnDocumentComplete(LPCTSTR lpszURL)
{
USES_CONVERSION;
MSHTML::IHTMLDocument2Ptr spDoc(this->GetHtmlDocument());
if (spDoc)
{
MSHTML::IHTMLDocument3Ptr spDoc3 = spDoc;
if (spDoc3)
{
MSHTML::IHTMLElementPtr spElem = spDoc3->getElementById(_bstr_t("idDataCell1"));
if (spElem)
{
CString strValue = W2T(spElem->innerText);
}
}
}
CHtmlView::OnDocumentComplete(lpszURL);
}
With the above code, remember to import the MSHTML type library to help give us smart pointer wrappers around the interfaces, e.g. insert into your views .h file
#import <mshtml.tlb> no_auto_exclude
Also, we use are performing unicode conversion here (macros USES_CONVERSION and W2T) so dont forget to add:
#include <AFXPRIV.H>
into your stdafx.h file.
I've assumed that the document returned has tags labelled with ID's - if this isn't how the data is 'structured' then you need to give me an example of the HTML. We can use the DOM to recurse through the hierarchy to retrieve the information you want. I must point out though, if you can use ID's then this is the preferred approach.
Hope this helps,
Andy
|
|
|
|
|
Thanks Andy. I'm trying to use what you gave me, but I'm such a dolt I still don't know how to use it to process the info. I think my problem is I am really confused as to how a doc/view app works (any one give me a hand?). Anyway, right now, I made the strValue a member of the CmyHtmlView class so I can get acess to it. I'm trying to display it so I can see what's inside it with a dialog but I'm having a fun time trying to play with the CString class. If you or anyone have an easy way of getting at the webpage (which is just "1" to get the value, that would be cool.
Sincerely,
Testtests
|
|
|
|
|
Hi again,
If the value is just in the body, then the following code will work...
void CMyHTMLView::OnDocumentComplete(LPCTSTR lpszURL)
{
USES_CONVERSION;
MSHTML::IHTMLDocument2Ptr spDoc(this->GetHtmlDocument());
if (spDoc)
{
CString strValue = W2T(spDoc->body->innerText);
}
CHtmlView::OnDocumentComplete(lpszURL);
}
I'm not sure what you are trying to achieve though? Is the HTML View being used to display information to the user or as a way of sending information from the web server to your application? (a web service if you like)
You say, also, that you are creating a dialog to display the value - is this something that will feature in your application or is it just for your benefit? If so, are you not developing in debug? You can also use AfxMessageBox if you want to display information quickly - just remember to remove them in production code
Hope this helps,
Andy
|
|
|
|
|
Thanks again Andy,
Basically, I have an initial webpage that CHtmlView initially navigates to. From this webpage, they type in a special key and submit it by clicking a button on the form. This webpage then in turn posts the data to an ASP webpage that does some work with a database to check if this special key exists or not in its database. It replies back a 1 if it exists and a 0 if it doesn't. It is based upon these replies that the application must now decide to allow the user to retry entering the special key or to allow the user to move forward in the application. All in all, the processing is to determine the success or failure of the special key so the program will know how to react.
I hope this clears up some confusion. Thanks for your input Andy. I really appreciate it and look forward to hearing from you again.
Sincerely,
Testtests
|
|
|
|
|
Hi,
The first problem I guess is that the user will see a page in the HTML view with the contents '1'. A better approach would be that the page returned by ASP would be more user friendly, e.g.
<html>
<body>
<h1>Key incorrect</h1>
<input type='hidden' value='1' id='idRetVal'>
</body>
</html>
So the page returned would have visible information for the user and a hidden element for the application to use. Because we've given the element an id, you can use the code I gave you at the beginning to get the value.
Once they've entered a valid key, what should your application do next? Is the interface of your application all through HTML, e.g. once verified you then display the next HTML page in the view? If so, is there a reason why you are using C++?
Or is the HTML view purely for verifying the key is valid?
If the first statement is true, have you thought about using an Internet Explorer HTML application?
Let me know
Cheers,
Andy
|
|
|
|
|
Hi!
Yes, the HTML is purely for verifying the key is valid. As soon as that is done, the executable, coded in C++, takes over and generates non-html user interfaces to move the user forward within the program. I can not use an Internet Explorer HTML application since the program involves manipulation of files and the creation of non HTML interfaces that will create other processes. Furthermore, the application is required to be a standalone executable (myHtml.exe) able to run on older Window operating systems, excluding Win95.
Thanks in advance,
Testtests
|
|
|
|
|
HI.
From where i can Download installshield for VC++
n how to use it
thanx
|
|
|
|
|
|
Which Version i use ... for VC++ and Operating system XP
Is there any built in for VC++
as there is in VB its own component..
wt abut VC++
thanx.
|
|
|
|
|
i don't know of any built specifically for VC++
there are other installation programs that dont' cost $$$
i don't know of a name off the top of my head, but they have been mentioned several times on CP
|
|
|
|
|
|
I want to begin a project with vc6 + sp5 + directx8,but I do not know how to beigin this!!
Any suggestion is welcome!
buaa_chenx@hotmail.com
|
|
|
|
|
First Download DirectX SDK
then study it ,, it has Samples for VC++
choose utr area on which u want to work ...
means DirectShow / DirectSound / DirectPlay etc.
i Hope SDK will Help u to Study it
GOOD LUCK
|
|
|
|
|
damn it, you beat my message by 2 mins
great minds think alike!!
|
|
|
|
|
My first step would be to get the DirectX SDK. Last I looked it had lots of samples.
DirectX 9.0 SDK[^]
|
|
|
|
|
Hi!
in the onpaint function of a dialog i've got this code:
CString temptext;
this->m_EditTexto.GetWindowText(temptext);
CSize size=dlgDC.GetTextExtent(temptext);
CRect rect;
rect.left=m_pto_pers_texto.x-size.cx/2;
rect.right=rect.left+size.cx;
rect.top=m_pto_pers_texto.y;
rect.bottom=rect.top+size.cy;
dlgDC.DrawText(temptext,-1,rect,DT_CENTER);
it's a part of a drag and drop operation, when i drag something, it writes what the user inserts.
if i drag the from the same place, the old text disappaers and the new one shows up, in the new position where i've dropped the object.
is the problem here?
thanks!
Another thing. i'm just storing what i draw in a list of CPoint's. Is it posible to transfer the text to points? sounds quite hard to me.
should i put everything in a CRgn?
|
|
|
|