• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 448
  • Last Modified:

install only once

I have developed a CD applicaiton that is to be installed on the client's PC once and only once. To make sure that it can only be installed once, I want the application to contact a PHP website via http and receive a positive (in case this is the first installation) or negative (otherwise) response.

Want I mean is: the app issues a http request, say htpp://www.someserver.com/path/script.php?param=value, and the html output of this script is the confirmation or infirmation of the app installation.

I want this to be transparent to the user, i.e. no browser window, no visible TCppWebBrowser.

Any ideas on how to do that? (or, dou you have any other suggestion on how the installation can be validated just once?)

Thanks in advance,
muntel
0
muntel
Asked:
muntel
  • 4
  • 4
1 Solution
 
George TokasCommented:
You can size TCppWebBrowser to very small size and locate it outside the visible area of your form...
By setting borderstyle property on the form to single the user have no way to stretch and see (if he/she can) that another control exists...
Btw... Same thing I'm developing right now, allready done the client form, and having hard time with PHP....

George Tokas.

P.S. Another way is to use TNMHTTP component but if you want to use SSL will be REALLY HARD...
0
 
George TokasCommented:
The advandage on using TNMHTTP is that there is no trace in the history of IE...
Using TCppWebBrowser you have to use browse flags...

George Tokas.
0
 
muntelAuthor Commented:
Hi, gtokas!

Thanks for the prompt response. I see you are applying the easy solution yourself (i.e. hide a TCppWebBrowser control somewhere on the form), so I'm guessing that there's no need to go at lengths to find something more elaborate... plus the deadline, that is drawing near :)

You said your were done with the client side, could you give me some more hints on how you did this? (I could help with the PHP part, in exchange:-)
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
George TokasCommented:
Is reading the response from TCppWebBrowser->Document as an AnsiString any help??
I think that you allready solved this...
Anyway...
I have a PHP script echoing the IP of the connected PC...
I use the following to get the IP Client side... WB1 is a TCppWebBrowser..
AnsiString __fastcall TForm1::MyRealIP()
{
        AnsiString      S1,S2;
        wchar_t         *s1,*s2;
        S1 = NULL;
        S2 = NULL;
        s1 = NULL;
        s2 = NULL;
        IHTMLDocument2 * Doc;
        IHTMLElement * Element;
       
        Variant url1 = StringToOleStr("http://somesite/subdir/hello.php");
        TVariant flags = {2|4|8};//Here setting the flags for no history and no cache...
        WB1->Navigate2(url1,&flags,NULL,NULL,NULL);

        if(!WB1->Document || !SUCCEEDED(WB1->Document->QueryInterface(IID_IHTMLDocument2,(LPVOID*)&Doc)))
        {
           return NULL;
        }

        if (!Doc )
        {
         ShowMessage("Failed to load document interface to IE");
         return NULL;
        }
        Doc->get_body(&Element);
        Doc->clear();
        Doc->Release();
       
        Element->get_innerHTML(&s1);
        Element->get_innerText(&s2);
        Element->Release();
        S1 = s1;
        S2 = s2;
        if(S2.Length() > 15){
         return NULL;}
        AnsiString      IPSeg1,IPSeg2,IPSeg3,IPSeg4;//todo...

        return NULL;
}

I'm almost certain that it works....

Thx for the offer but in PHP programming I'm at the dummy stage....:-)
btw...My deadline was LAST week...

George Tokas.
0
 
muntelAuthor Commented:
The solution that I will use is to read into an AnsiString the content of the Document property of a hidden TCppWebBrowser control that will navigate to a webpage of my choice.

Thank you, gtokas, for your suggestions. I tried your code, at first sight it returns NULL in the if(!WB1->Document || !SUCCEEDED(WB1->Document->QueryInterface(IID_IHTMLDocument2,(LPVOID*)&Doc))) block, but I'm sure I can find a workaround for this by adapting some other code to meet these requirements (and maybe the deadline, as well...:)

0
 
George TokasCommented:
       S1 = s1;
        S2 = s2;
        if(S2.Length() > 15){
         return NULL;}
        AnsiString      IPSeg1,IPSeg2,IPSeg3,IPSeg4;//todo...

S2 have the IP string...
I'm doing further processing at the last line...
You can just return S2 to get the IP String using the function....

George Tokas.
0
 
muntelAuthor Commented:
I did return S2 to get the IP, but the function returned earlier, in the if(!WB1->Document || !SUCCEEDED... ) {...} block and therefore never got to the last lines of the code, that's what I meant.

Anyway, I will work on this tomorrow, so that the execution DOES get to the last line, i.e. return S2;

0
 
muntelAuthor Commented:
Here's an easier way to get the content of the webpage displayed in the TCppWebBrowser content:


AnsiString aTextContent= "";
Variant vDocument = CppWebBrowser1->ControlInterface->Document;
if (((IDispatch *)vDocument) != NULL)
{
   Variant vBody = vDocument.OlePropertyGet("Body");
   Variant vTextContent = vBody.OlePropertyGet("InnerText");
   aTextContent = vTextContent;
   ShowMessage(aTextContent);
}
else
   ShowMessage("Some error occured");


I found this in an older EE solution (thanks to Greybird, who posted this)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now