JWS client application with remote mysql security

I'm fairly new to this sphere of web security programming. I'm trying to write JWS client application that can communicate with webhosting's mysql server. Is there a better way to secure the data communication between the two since webhosting's mysql server is not SSL enabled? I'll appreciate any tools, advices or techniques to accomplish this.

zhadum wrote:
I'm aware of that I'll have to encrypt password and user's private information. Since the JWS client will need to decrypt the password and user info the decryption key will need to be stored in the application. Once again, easy to extract.
I have been researching and thought of using JSSE to establish secure connection between client application and Java Servlet on the server for database communication without the direction connection to the database. That is the way is is normally done. You only provide the database functionality needed by the client and you make the client log on to the Web Server before allowing access to the servlet.
I know hackers can or could decompile my client application and learn how to access the database directly so I thought of using the Servlet will make the hacker's tasks more difficult.Yep. That and the use of HTTPS.
>
Is there a sample code I can use with my client and servlet for secured database communications?There are tons of examples of creating a logon page which is the first thing you will need. The user of servlets for database access is exactly the same as you have used for your JWS client.

Similar Messages

  • "Unspecified Error" or "Runtime Error" 7 when launching application with AcroPDF on Secured Vista PC.

    We have a client application written in Visual Basic 6 that uses the AcroPDF ActiveX DLL to view PDF files in our app.  The app works fine the clients secured Windows XP SP 3 PC, and on my Windows Vista Business 32 bit Virtual Machine.  However, the application will not launch on the client's highly secured Vista Enterprise 32 bit PC's.  The form with the Acrobat Browser control does not even initialize before a "Runtime Error 7: Out of Memory" message is presented.  I created a VB 6 test app that has just the form and the Acrobat Browser control on it, and this test application will not initialize either.  It gets an "System Error &H80004005 (-2147467259). Unspecified Error" message on attempting to launch.  I get the same error message if I attempt to add the Acrobat Browser control to a form in an MS Excel Macro in Excel 2003 on the same PC.  Test VB6 applications using the other controls and references in the application launch fine.
    The Acrobat installed on these PC's is Acrobat Professional 9.0.0 and/or 9.1.0.  In two cases, we have been able to have the application load after uninstalling /reinstalling Acrobat 9.x on the PC, but ONLY for the profile that did the installation.  And in one case, after removing that user profile and then logging back on, that user started getting the same errors above.
    What policy or registry setting is needed to get this control to initialize on a secured Vista PC for all users?

    I have done the following on my Vista Business VM and I still have not been able to duplicate the error that I see at the client site.
    1.  Enabled UAC.
    2.  Implemented Software Restriction Policies.
    3.  Set the Default Security Level to Basic User (except for Local Administrators).
    4.  Lowered the Integrity Level on my AcroTest1.EXE and on my actual executable to "Low".
    The sample application and the user application loaded the form and initialized the AcroPDF control when logged in as a normal user account (the account is only a member of the "Users" group on the local Vista PC).
    Since this application is an actual Windows application (not an Internet Browser plug in), the default integrity level should be "Medium".

  • Linking Azure website with Remote mysql database in Cpanel

    I am creating an azure website eg calvynlee.azurewebsites.net
    In my hosting cpanel account, I create a mysql db & user, in order to link the azure website with this mysql db, I had place a "%" in the remote mysql section.
    It works, but when I remove the % from the remote mysql section. Azure website unable show error connection with my database.
    Question:
    Understand that placing % is allow all remote connection to my database. For security purpose, placing % is not recommended, and placing the website IP address is the most suitable practice.
    Unfortunately, I place the website IP (by ping the website and obtain the IP) in remote mysql section is not working.
    My cpanel service provider mention that the IP I obtain is not the right IP, there will be another host sever IP
    What is the actual IP address I should put? and How to find this right IP?

    Hi,
    Based on your description, your mysql db is created in cpanel, and want to let the azure website connect with this db, I don't familar with cpanel, in general way the azure website request may be stopped by something, such as firewall etc.., as far as I
    know, the azure Hybrid Connections may meet your requirement, you can connect a website on Microsoft Azure to any on-premises resource that uses a static TCP port, such as SQL Server, MySQL, HTTP Web APIs, Mobile Services, and most custom Web Services, refer
    to
    http://azure.microsoft.com/en-us/documentation/articles/web-sites-hybrid-connection-get-started/ for more details, hope this helps, if not, please feel free to let me know.
    Best Regards,
    Jambor 
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Search Server 2010 Express: Open a PDF document from list of search results invokes adobe reader client application with error

    Hi community,
    I set up search server 2010 express on a windows 2008 r2 server.
    The Adobe PDF iFilter 9 64 bit is installed and search is correctly configured to find PDF-files.
    When doing a search and clicking on a link of the result page, the PDF is not opened in the browser, instead the adobe reader XI client application (11.0.04) is invoked and an error raised like "could not open document .. check syntax of url..."
    Right click on a link to open in new tab works fine. And PDF-Files from other arbitrary Internet Sites opens in browser correctly. Moreover when configure Adobe Acrobat Pro 9 as default application on the client it also open in Browser correctly.
    I noticed googling the web there are several challenges when dealing with PDF-files in sharepoint. The following settings are made so far:
    1. In IE: Add-On to open PDF in Browser is enabled for all sites.
    2. Client Integration is enabled
    3. The OpenControl attribute in the DOCICON.xml is left empty OpenControl="" for the pdf entry.
    4. The Browser File Handling is set to "Permissive".
    Please feel free to ask for more information if needed.
    I appreciate any help on this. I don't know what to do further.
    Thanks in advance.

    Thanks for the reply.
    Before responding to your points I want to give a little more context:
    We have an intranet based on pure html and a little aspx containing many of those pdf- files. By clicking on the links in the intranet the files open correctly in browser handled by the adobe plugin. Now we set up this search server crawling the file system
    accessed through a share to the root folder of the intranet. In the search server settings a host mapping rule is applied to replace the file://[share] with http://[intranet host+domain+port] to access files over http.
    And now to answer your question. The resulting urls are the same, copying the link from intranet and copying the link from the search result (except some case issues).
    The event viewer not seem to show any errors on this, though I'm not very familiar using it.
    If any further information are from interest and any ideas come to your mind - please let me know.
    Thanks.

  • How to use HR application with Remote Database ?

    Hi,
    I tested the HR application but it working on local database.
    How can I create same application which will communicate with Remote Database.
    Any guideline ?
    Regards,
    Ajay Sharma

    Hi,
    Thanks for the reply.
    My scenario is that there is one web service and this web service has one method name "getQueryOutput".
    Input parameter to this method is Select query
    select ename form empthe return type of this method is Document. Currently I hard coded the select statement as I want to display all employee name as application starts.
    But I am getting following error
    Unable to read DataControl Usages, on loadDataControl for id: Genericwebfollowing is the code of method where I am calling Webservice data control
        public void Execute() {
            Trace.log(Utility.ApplicationLogger, Level.INFO, EmployeeList.class, "Execute",
                      "##############Inside Execute");
            List pnames = new ArrayList();
            List params = new ArrayList();
            List ptypes = new ArrayList();
            pnames.add("query");
            ptypes.add(String.class);
            params.add("select ename from emp");
            try {
                Trace.log(Utility.ApplicationLogger, Level.INFO, EmployeeList.class, "Execute",
                          ">>>>>> Before invokeDataControlMethod");
                // This calls the DC method and gives us the Return
                GenericType result =
                    (GenericType)AdfmfJavaUtilities.invokeDataControlMethod("Genericweb", null, "getQueryOutput",
                                                                            pnames, params, ptypes);
                GenericType cfgt = (GenericType)result.getAttribute("Results");
                int count = cfgt.getAttributeCount();
                for (int i = 0; i < count; i++) {
                    GenericType fgt = (GenericType)cfgt.getAttribute(i);
                    Employee e = (Employee)GenericTypeBeanSerializationHelper.fromGenericType(Employee.class, fgt);
                    GenericType tempgt = (GenericType)fgt.getAttribute("ENAME");
                    e.setEname((String)tempgt.getAttribute(0));
                    s_employees.add(e);
            } catch (AdfInvocationException e) {
                Trace.log(Utility.ApplicationLogger, Level.SEVERE, EmployeeList.class, "Execute",
                          ">>>>>> AdfInvocationException=" + e.getMessage());
                //AdfException ex = new AdfException("Error Invoking Web Service.  Please try later", AdfException.WARNING);
                AdfException ex = new AdfException(e.getMessage(), AdfException.WARNING);
                throw ex;
            } catch (Exception e2) {
                Trace.log(Utility.ApplicationLogger, Level.SEVERE, EmployeeList.class, "Execute",
                          ">>>>>> Exception=" + e2.getMessage());
                //AdfException ex = new AdfException("Error Invoking Web Service.  Please try later", AdfException.WARNING);
                AdfException ex = new AdfException(e2.getMessage(), AdfException.WARNING);
                throw ex;
        }Regards,
    Ajay sharma

  • Uninstalling applications with Remote desktop

    Hi
    I am new administering Mac OS X servers and clients and needed a little help.
    I have learned how to distribute packages and applications but have yet to discover how to uninstall applications from remote clients.
    Is there a tutorial that will show me how this is done?
    Cheers
    Jonathon

    There is no method built into ARD (nor in Mac OS X) for uninstalling applications. For simple applications, you can just do a search in ARD for the application and then delete it. But for more complex applications, ones that install multiple components in several places, those may require running a developer-provided uninstaller on each system.
    Regards.

  • Sync local SQLite DB with remote MySQL DB

    I am working on a Flex AIR application where I need to synchronize the data between local SQLite DB and the remote MySQL DB. I am using AMFPHP and have a date modified field for items in the remote MySQL DB. How can I perform this synchronization?

    I just discovered this developer's github page yesterday and perhaps his air_amf_sync project may be beneficial to you.
    https://github.com/dima/air_amf_sync
    Let us know on your outcome.

  • Can i build a JMS client application with J2ME ?

    I need to know which configuration and profile will allow me to build a application that will run on a windows ce / pocketpc PDA and send JMS messages to a server. I need the J2ME application to be a JMS client
    I also need messaging
    pda -> server (text or byte message)
    server -> pda text messages
    pda -> pda text messages
    any helps/comments would be appreciated

    maybe what i need to look at is the new wireless messaging (WMA) ?

  • Upgrade to SQL Anywhere16, is application w.Remote Client 9 running the same ?

    Hi SQLAnywhere folks,
    My customer is running SQL Anywhere9 + Remote Client 9(WinCE 5.0), however,
    they have to upgrade OS Windows sever 2003 to 2012, thus they have to upgrade SQL Anywhere 16.
    And I found from <http://scn.sap.com/docs/DOC-35934>
    " SQL Anywhere 16 database servers support connections from client applications using software from version 6.0.0 or
    later." i.e SQL Anywhere 16 supports Remote Client 9. Right ?
    Then the question is the applications with Remote Client 9(WinCE 5.0) are running well with SQL Anywhere 16.
    Any application modification required ?
    Any consideration/advice would be highly appreciated.
    Thanks a lot.
    JY Yang

    Hi Chris,
    Thanks for your reply.
    I'm afraid I don't have enough infomation how complex the application it is.
    Hence, we'll try it first, and then share the result.
    Thank you again.
    JH.

  • How to setup the client application for the RMI?

    Question:
    I write a short program of RMI It contain server and client
    if server and client are run on localhost they are running ok
    but run client application on remote machine it occure issuses.
    How to setup the client on remote machine?

    hello Dhanraj K, for gmail accounts there shouldn't be much manual configuration required. please try to set it up like described in [[Add an email account to the Mail app in Firefox OS]]

  • Help needed in running the RMI application with multiple clients

    Hi
    I have my RMI application with one server and 6 clients. I keep all the server and client programs in the same directory. When i run the clients, the first 2 clients work properly but when the third or the fourth client starts, it works normally in getting the data and after a while it crashes. If teh third crashes the 4th works and if the 4th crashes the 3rd, 4th and 5th works ...randomly atleast one or 2 clients crash always.
    following is the error message generated for a client named controller:
    [ code ]
    Exception in thread "main" java.lang.NullPointerException
    at PostOfficeImpl.isinputAvail(PostOfficeImpl.Java:315)
    at PostOfficeImpl_Skel.dispatch(Unknown Source)
    at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:375)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)
    at sun,rmi.transport.Transport$1.run(Transport.java:153)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun,rmi.transport.Transport.serviceCall(Transport.java:149)
    at sun,rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
    at sun,rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
    at java.lang.Thread.run(Thread.java:595)
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:343)
    at PostOfficeImpl_Stub.isinputAvail(Unknown Source)
    at CONTROLLER.main(CONTROLLER.java:167)
    my ser ver program is as follows:
    class PostOfficeServer extends java.rmi.server.UnicastRemoteObject implements java.rmi.Remote {
    // Instance of ourselves
    public static String name;
    private static PostOfficeServer rmi;
    // public No-argument constructor
    public PostOfficeServer() throws RemoteException {
         super();
    public static void main(String[] args){
    if(System.getSecurityManager() == null) {
         System.setSecurityManager(new RMISecurityManager());
    try {
         new PostOfficeServer();
         PostOffice postOfficeserver = new PostOfficeImpl();
    try {
         getIP ipAdd1 = new getIP();
         String ip1 = ipAdd1.getIP();
         name = "//" + ip1 + "/PostOffice";
    catch (Exception e){
         System.out.println();
    Naming.rebind(name, postOfficeserver);
    System.out.println("RemoteServer bound");
    System.out.println("initialise Data Structure");
    postOfficeserver.initDatastructure();
    System.out.println("initilised");
    catch (java.rmi.RemoteException e) {
         System.out.println("Cannot create remote server object");
    catch (java.net.MalformedURLException e) {
         System.out.println("Cannot look up server object");
    System.out.println("Server started.");
    System.out.println("Enter <CR> to end.");
    try {
         int serve2end = System.in.read();
    }catch (IOException ioException) {
    System.exit(0);
    //endoffilePlease advise as this is very urgent

    Hi
    the following is the code for PostOfficeImpl...its a long code but i include it so that I get your help please...
    import java.io.*;
    import java.net.*;
    import java.lang.*;
    import java.rmi.*;
    import java.rmi.server.*;
    import java.rmi.RemoteException;
    import java.util.HashMap;
    import java.util.*;
    public class PostOfficeImpl extends java.rmi.server.UnicastRemoteObject implements PostOffice {
    //Implementations must have an explicit constructor in order to declare the
    //RemoteException exception
    public PostOfficeImpl() throws java.rmi.RemoteException {
         super();
    public static LinkedListImpl list = new LinkedListImpl();
    public static oListImpl ovarList  = new oListImpl();
    public static iListImpl ivarList =new iListImpl();
    public static lipsList llfirst;
    public static oList opchannel, ofirst, onext;
    public static iList ipchannel, ichan, ifirst;
    public static  String[] variNumber= new String[100];
    public static String[] inoutChan, inChan, outChan,inVAR, invarLIST,outVAR, outvarLIST ;
    public static String[][] driveMat;
    DriverMatrix_mthds drive = new DriverMatrix_mthds();
    private static  Boolean All_Vacant;
    private static  Boolean tAll_Vacant;
    public void sendAll_Vacant(Boolean All_Vacant) throws RemoteException {
         tAll_Vacant = All_Vacant;
    public Boolean getAll_Vacant() throws RemoteException{
          return tAll_Vacant;
    public  void initDatastructure() throws RemoteException{
    ifirst = null;
    ofirst=null;
    int i=0, j=0, k=0, ind1=0, ind2=0;
    try{/// initialise list
         drive = new DriverMatrix_mthds();
         drive.VarTypeArray();
         drive.nodeHeadVarType();
         String[] variablel = drive.Variablelist();
         drive.lipsvariablist();
         drive.NodeOrigin();
    drive.nodeInput();
         drive.numOfnodes();
         drive.noOfVariables();
         drive.Assignlist();
         drive.novarType();
         drive.varNameType();
         drive.nodeNumName();
         drive.driverMat();
         String[][] lookupvar = drive.varNameType();
         //tempdrive = drive.driverMat();
         long leng1 = variablel.length;
         int varlistlength = (int) leng1;
         int counter;
         String s1="";
         String s2="";
         String s3 = "";
         String s4 = "";
         String s6 = "";
         int s5=0, c=0;
         while(variablel[k] !=null){
              k=k+1;
         int i1, j1;
         String  varname, varnumber;
         varnumber = "";
    while(i<=variablel.length-1){
         if(variablel!=null){
         c=c+1;
         i=i+1;
    try{
         ind1=0; ind2 = 0;i=0;
    while(!(variablel[i].equals("end of file"))){
         s1 = variablel[i];
         i=i+1;
         s2 = variablel[i];
         i=i+1;
         System.out.println("     " + s1+"     "+s2);
    while(!(variablel[i].equals("end of input variable"))){
         s4 = variablel[i];
         i1=0;
         Brkwhile:while(i1<=lookupvar.length-1){
         j1=1;
         if(lookupvar[i1][j1] != null){
         if(lookupvar[i1][j1].equals(s4)){
              s3 = lookupvar[i1][0];
              break Brkwhile;
         i1=i1+1;
    //ifirst.varNum = varnumber;
    s5 = 0;
    s6 = null;
    ifirst= new iList(s3,s4, s5, s6);
    ivarList.add(ifirst);
    System.out.println(s3+"     "+s4+"     "+s5+"     "+s6);
    i=i+1;
    i = i + 1;
    System.out.println("input list finished ");
    while(!(variablel[i].equals("end of output variable"))){
         s4 = variablel[i];
         i1=0;
         j1=1;
         Brkwhile:while(lookupvar[i1][j1] != null){
              if(lookupvar[i1][j1].equals(s4)){
              s3 = lookupvar[i1][0];
              break Brkwhile;
         i1=i1+1;
         s5 = 0;
         s6 = null;
         ofirst= new oList(s3,s4, s5, s6);
         ovarList.add(ofirst);
         System.out.println(s3+"     "+s4+"     "+s5+"     "+s6);
         i=i+1;
         llfirst = new lipsList(s1, s2, ivarList, ovarList);
         list.add(llfirst);
         System.out.println("output list finished ");
         i=i+1;
         catch (NullPointerException ne){
         catch (Exception d){}
    public int isitOK(reqPacket sndNodetail)
         throws RemoteException{
         String nodnum = sndNodetail.srcNum;
         String varnum = sndNodetail.varNum;
         int status = 0;
         llfirst = list.getFirst();
         try{mainbegin:while (llfirst != null){
              if((llfirst.nodeNum).equals(nodnum)){
              ofirst = ovarList.getFirst();
              while(ofirst != null){
                   if((ofirst.varNum).equals(varnum)){
                   if(ofirst.varVal==null){
                   status = 1;
                   break mainbegin;
         ofirst = ofirst.next;
         llfirst = llfirst.next;
         catch (NullPointerException nl){}
         return status;
    public int senData(dataPacket sendToRTS)
         throws RemoteException{
    dataPacket datDetail = sendToRTS;
    String nnum, vnum,typename, dval;
    String dtype = "";
    nnum = datDetail.nodeNum;
    vnum = datDetail.varNum;
    typename = datDetail.dataType;
    dval = String.valueOf(datDetail.dataVal);
    String [][] tempdrive, varnametype;
    int status =0;
    System.out.println("data received is from node " nnum " is "+ dval+"var num " +vnum);
    status =0;
    try{
    //DriverMatrix_mthds drive = new DriverMatrix_mthds();
    drive.VarTypeArray();
    drive.Variablelist();
    drive.NodeOrigin();
    drive.nodeInput();
    drive.numOfnodes();
    drive.noOfVariables();
    String[][] lookupvar = drive.novarType();
    drive.varNameType();
    drive.nodeNumName();
    drive.driverMat();
    tempdrive = drive.driverMat();
    String varname="";
    int i,j;
    //with the recived var name get the var num
    for(i=0; i<=lookupvar.length-1; i++){
         j=0;
         if(lookupvar[i][j] != null){
              if(lookupvar[i][j].equals(typename)){
                   dtype = lookupvar[i][1];
         }//varname is moved to dtype n used for checking
         for(i=0; i<=tempdrive.length-1; i++){j=0;
         if (tempdrive[i][j] != null){
         if (tempdrive[i][0].equals(vnum)){
              if (tempdrive[i][1].equals(nnum)){
              if(tempdrive[i][2].equals(dtype)){
              status = 1;
         }//System.out.println("received data " vnum " "+ nnum +" " + dtype +" "+dval);// after checking status if the status is 1 then set the counter n olist// to no of times the value has to be ditributed
    int Ccount =0;
    //opchannel = llfirst.olist;
    try{
         System.out.println("status"+status);
         if (status == 1){
              llfirst = list.getFirst();
         mainWhile: while (llfirst != null){
              if((llfirst.nodeNum).equals(nnum)){
                   ofirst = ovarList.getFirst();
                   while(ofirst != null){
                   if((ofirst.varNum).equals(vnum)){
                        ofirst.varVal =dval;
                        //setting the counter for the varname
                        //check driver matrix fr the no of occurances
                   for(i=0; i<=tempdrive.length-1; i++){
                   j=0;
                   if (tempdrive[i][j] != null){
                        if (tempdrive[i][0].equals(vnum)){
                        for(j= j+3;j<=tempdrive.length-1;j++){
                        if(tempdrive[i][j] != null){
                        if(tempdrive[i][j].equals("1")){
                        Ccount = Ccount + 1;
    System.out.println("count"+Ccount);
    ofirst.counter = Ccount;
    ofirst.varNum = vnum;for(i=0; i<=lookupvar.length-1; i++){
    for(j=0; j<=2; j++){
         if(lookupvar[i][j] != null){
         if(lookupvar[i][j].equals(vnum)){
              varname = lookupvar[i][1];
         ofirst.varName = varname;
         Ccount=0;
         break mainWhile;
         ofirst = ofirst.next;
         llfirst = llfirst.next;
         catch(NullPointerException s){}
    /*use the vnum in the driver matrix and find out the nodes to which this variable
    *has been sent as input , i mean destination nodes..
    *find the node numbers ..knowing the node numbers parse through data structure
    and set the input values to value and status 1./
    llfirst = list.getFirst();
    while(llfirst != null){
         ifirst = llfirst.ilist.getFirst();
         while(ifirst != null){
              if (ifirst.varNum.equals(vnum)){
              ifirst.varStat = 1;
              ifirst.varVal = dval;
              //     System.out.println("nodenum "+llfirst.nodeNum+" varval     " + ifirst.varVal +"     stat "+ifirst.varStat+" vnum " + ifirst.varNum);
         ifirst=ifirst.next;
         llfirst=llfirst.next;
         catch (Exception e){};
         return status;
    public int isinputAvail(reqPacket inputReq)
         throws RemoteException{
         String srcnum = inputReq.srcNum;
         String varnum = inputReq.varNum;
         int availstatus =0;
         llfirst = list.getFirst();
         //System.out.println("llfirst.nodeNum     "+ llfirst.nodeNum);
         whileloop:while (llfirst != null){
              if((llfirst.nodeNum).equals(srcnum)){
              ifirst = llfirst.ilist.getFirst();
              breakloop: while(ifirst != null){
              //System.out.println("var num " + varnum + "     " + "status outside" + ifirst.varStat);
              if((ifirst.varNum).equals(varnum)){
              if (ifirst.varStat == 1){
                   availstatus = 1;
                   ifirst.varStat = 0;
                   // System.out.println("var num " + varnum + "     " + "status" + availstatus);
                   break whileloop;
         ifirst = ifirst.next;
         llfirst = llfirst.next;
         //System.out.println("var num " + varnum + "     " + "status" + availstatus);
         return availstatus;
    public dataPacket senDatatoNode(reqPacket sendFromRTS)
         throws RemoteException {
         String nnum, vnum, dtype, dval;
         //nnum = "";
         dtype="";
         //opchannel = llfirst.olist;
         //     ipchannel = llfirst.ilist;
         reqPacket sendfromrts = sendFromRTS;
         nnum = sendfromrts.srcNum;
         vnum = sendfromrts.varNum;
         //     dtype = sendFromRTS.dataType;
         dval = "";
         int ctrchk=0;
         try{
         //send data to process node n reduce the counter by 1
         llfirst = list.getFirst();
              mainWhile: while (llfirst != null){
              if((llfirst.nodeNum).equals(nnum)){
              ofirst = llfirst.olist.getFirst();
         whileofirst: while(ofirst != null){
              if((ofirst.varNum).equals(vnum)){
              dval = ofirst.varVal;
              ofirst.counter = ofirst.counter - 1;
              //     System.out.println(ofirst.counter);
              ctrchk=ofirst.counter;
              break whileofirst;
         ofirst = ofirst.next;
    //set the status of respective input channel to 0 as data has been sent
         ifirst = llfirst.ilist.getFirst();
         if(ctrchk == 0){
         whileifirst: while(ifirst != null){
              if((ifirst.varNum).equals(vnum)){
              //ifirst.varVal = dval;
              ifirst.varStat =0;
              break whileifirst;
         llfirst = llfirst.next;
         //System.out.println(llfirst);
         catch(NullPointerException s){}
    //find type
    try{
         DriverMatrix_mthds driver = new DriverMatrix_mthds();
         driver.VarTypeArray();
         driver.Variablelist();
         driver.NodeOrigin();
         driver.nodeInput();
         driver.numOfnodes();
         driver.noOfVariables();
         driver.novarType()     ;
         String[][] lookupvar = driver.varNameType();
         int i, j;
         String varNum = vnum;
         for(i=0; i<=lookupvar.length-1; i++){
              j=0;
              if(lookupvar[i][j] != null){
              if(lookupvar[i][j].equals(vnum)){
              dtype = lookupvar[i][2];
         catch (Exception d){}
         dataPacket retpac = new dataPacket(nnum, vnum, dtype, dval);
         System.out.println("msg sent "+ nnum +"     " + vnum+" "+ dtype+"     "+ dval);
         return retpac;
    public String findnodeName(String nodeNum)
         throws RemoteException{
    String nnum = nodeNum;
    llfirst = list.getFirst();
    while (llfirst != null){
         if((llfirst.nodeNum).equals(nnum)){
         return llfirst.nodeName;
         llfirst = llfirst.next;
         System.out.println("node Number does not match with the list of node numbers generated..try again");
         return null;
    //find the nodenum given the node name
    public String findnodenum(String nodename)
         throws RemoteException{
         String nodenumber ="";
         String nodname = nodename;
         try{DriverMatrix_mthds driver = new DriverMatrix_mthds();
         driver.VarTypeArray();
         driver.Variablelist();
         driver.NodeOrigin();
         driver.nodeInput();
         driver.numOfnodes();
         driver.noOfVariables();
         driver.novarType()     ;
         driver.varNameType();
         String[][] lookupnode = driver.nodeNumName();
         int i, j;
         for(i=0; i<=lookupnode.length-1; i++){
         for(j=0; j<=2; j++){
              if(lookupnode[i][j] != null){
              if(lookupnode[i][j].equals(nodname)){
                   nodenumber = lookupnode[i][2];
         catch (Exception d){}
         return nodenumber;
    public String findvarnum(String variablename)
         throws RemoteException{
         String varnumber = "";
         try{
         DriverMatrix_mthds driver = new DriverMatrix_mthds();
         driver.VarTypeArray();
         driver.Variablelist();
         driver.NodeOrigin();
         driver.nodeInput();
         driver.numOfnodes();
         driver.noOfVariables();
         driver.novarType()     ;
         String[][] lookupvar = driver.varNameType();
         int i, j;
         String varname = variablename;
         for(i=0; i<=lookupvar.length-1; i++){
         for(j=0; j<=2; j++){
              if(lookupvar[i][j] != null){
              if(lookupvar[i][j].equals(varname)){
                   varnumber = lookupvar[i][0];
    catch (Exception d){}
    return varnumber;
    public String findvartype(String varname)
         throws RemoteException{
         String vartype = "";
         try{
         DriverMatrix_mthds driver = new DriverMatrix_mthds();
         driver.VarTypeArray();
         driver.Variablelist();
         driver.NodeOrigin();
         driver.nodeInput();
         driver.numOfnodes();
         driver.noOfVariables();
         driver.novarType();
         String[][] lookupvar = driver.varNameType();
         int i, j;
         String varName = varname;
         for(i=0; i<=lookupvar.length-1; i++){
         for(j=0; j<=2; j++){
              if(lookupvar[i][j] != null){
              if(lookupvar[i][j].equals(varName)){
                   vartype = lookupvar[i][2];
    catch (Exception d){}
    return vartype;
    public String findtypenum(String vartype){
    String varnum = "";int i;
    try{
         DriverMatrix_mthds driver = new DriverMatrix_mthds();
         driver.VarTypeArray();
         driver.Variablelist();
         driver.NodeOrigin();
         driver.nodeInput();
         driver.numOfnodes();
         driver.noOfVariables();
         String varNum[][] =      driver.novarType()     ;
         String varType = vartype;
         for(i=0; i<=9-1; i++){
              if(varNum[i][0] != null){
              if(varNum[i][0].equals(varType)){
                   varnum = varNum[i][1];
    catch (Exception d){}
    return vartype;
    //return input variable list
    public String[] inoutchanlist(String nodenum, String nodenam)
         throws RemoteException{
    try{
         DriverMatrix_mthds drive = new DriverMatrix_mthds();
         String[] varLIST = drive.Variablelist();
         int i=0;int j;
         while(varLIST[i]!=null){
              i=i+1;
         int arrlength = i;
         inoutChan = new String[arrlength];
         i=0; j=0;
         WHILELOOP:
         while(!(varLIST[i].equals("end of file"))){
         while(varLIST[i].equals(nodenum)){
              i=i+1;
              while(varLIST[i].equals(nodenam)){
                   i=i+1;
                   while(!(varLIST[i].equals("end of input variable"))){
                        inoutChan[j] = varLIST[i];
                        i=i+1;
                        j=j+1;
              System.out.println("endofinput");
              inoutChan[j]="endofinchan";
              j=j+1;
              i=i+1;
              while(!(varLIST[i].equals("end of output variable"))){
         inoutChan[j] = varLIST[i];
         i=i+1;
         j=j+1;
         System.out.println("endofoutput");
         inoutChan[j]="endofoutchan";
         break WHILELOOP;
         i=i+1;
         arrlength =j;
         for(j=0; j<=arrlength-1; j++){
         System.out.println(inoutChan[j]);
         catch (Exception e){}
         return inoutChan;
    public String[] inchannel(String[] inoutChan) throws RemoteException{
    int count=0;int i=0, j=0;
    System.out.println("entered");
    while(inoutChan[count]!=null){
         System.out.println(count + " " +inoutChan[count]);
         count=count+1;
         inChan = new String[count];
         while(!(inoutChan[i].equals("endofinchan"))){
         inChan[j] =inoutChan[i];
         j=j+1; i=i+1;
    return inChan;
    public String[] outchannel(String[] inoutChan) throws RemoteException{
    int count=0;int i=0, j=0;
    System.out.println("entered");
    while(inoutChan[count]!=null){
         System.out.println(count + " " +inoutChan[count]);
         count=count+1;
         outChan = new String[count+1];
         while(!(inoutChan[i].equals("endofinchan"))){
              i=i+1;
         i=i+1;
         while(!(inoutChan[i].equals("endofoutchan"))){
              outChan[j] =inoutChan[i];
              j=j+1; i=i+1;
         return outChan;
    public String[] invarChan(String nodename, int guardno)throws RemoteException{
    try{
    DriverMatrix_mthds drive = new DriverMatrix_mthds();
    invarLIST = drive.invarlist();
    int i=0;int j;
    while(invarLIST[i]!=null){
         i=i+1;
         int arrlength = i;
         inVAR = new String[arrlength];
         i=0; j=0;
              WHILELOOP: while(!(invarLIST[i].equals("end of file"))){
                   if (invarLIST[i].equals(nodename)){
         i=i+1;
         while(!(invarLIST[i].equals(nodename+String.valueOf(guardno)))){
         i=i+1;}
         i=i+1;
         while(!(invarLIST[i].equals("endofguard"))){
         System.out.println(invarLIST[i]);inVAR[j]=invarLIST[i]; i=i+1; j=j+1;}
         break WHILELOOP;}
         i=i+1;}
    }catch (Exception d){}
    return inVAR;
    public String[] outvarChan(String nodename, int guardcount)throws RemoteException{
         try{
         DriverMatrix_mthds drive = new DriverMatrix_mthds();
         outvarLIST = drive.outvarlist();
         int i=0;int j;
         while(outvarLIST[i]!=null){
              i=i+1;
         int arrlength = i;
         outVAR = new String[arrlength];
         i=0; j=0;
         WHILELOOP: while(!(outvarLIST[i].equals("end of file"))){
              if (outvarLIST[i].equals(nodename)){
                   i=i+1;
                   while(!(outvarLIST[i].equals(nodename+String.valueOf(guardcount)+"guard"))){
                        i=i+1;}
              i=i+1;
              while(!(outvarLIST[i].equals("end guard"))){
              System.out.println(outvarLIST[i]);outVAR[j]=outvarLIST[i]; i=i+1; j=j+1;}
              break WHILELOOP;}
         i=i+1;}
    }catch (Exception d){}
    return outVAR;
    private static Boolean start;
    private static Boolean tstart;
    public void sendstart(Boolean start) throws RemoteException {
         tstart = start;
    public Boolean getstart() throws RemoteException{
         return tstart;
    private static Boolean done;
    private static Boolean tdone;
    public void senddone(Boolean done) throws RemoteException {
         tdone = done;
    public Boolean getdone() throws RemoteException{
         return tdone;
    private static Boolean vac_busy1;
    private static Boolean tvac_busy1;
    public void sendvac_busy1(Boolean vac_busy1) throws RemoteException {
         tvac_busy1 = vac_busy1;
    public Boolean getvac_busy1() throws RemoteException{
         return tvac_busy1;
    private static int cus1_rit1;
    private static int tcus1_rit1;
    public void sendcus1_rit1(int cus1_rit1) throws RemoteException {
         tcus1_rit1 = cus1_rit1;
    public int getcus1_rit1() throws RemoteException{
         return tcus1_rit1;
    private static int cus1_rit2;
    private static int tcus1_rit2;
    public void sendcus1_rit2(int cus1_rit2) throws RemoteException {
         tcus1_rit2 = cus1_rit2;
    public int getcus1_rit2() throws RemoteException{
         return tcus1_rit2;
    private static int cus1_rit3;
    private static int tcus1_rit3;
    public void sendcus1_rit3(int cus1_rit3) throws RemoteException {
         tcus1_rit3 = cus1_rit3;
    public int getcus1_rit3() throws RemoteException{
         return tcus1_rit3;
    private static int cus1_it1;
    private static int tcus1_it1;
    public void sendcus1_it1(int cus1_it1) throws RemoteException {
         tcus1_it1 = cus1_it1;
    public int getcus1_it1() throws RemoteException{
         return tcus1_it1;
    private static int cus1_it2;
    private static int tcus1_it2;
    public void sendcus1_it2(int cus1_it2) throws RemoteException {
         tcus1_it2 = cus1_it2;
    public int getcus1_it2() throws RemoteException{
         return tcus1_it2;
    private static int cus1_it3;
    private static int tcus1_it3;
    public void sendcus1_it3(int cus1_it3) throws RemoteException {
         tcus1_it3 = cus1_it3;
    public int getcus1_it3() throws RemoteException{
         return tcus1_it3;
    private static int stkit_11;
    private static int tstkit_11;
    public void sendstkit_11(int stkit_11) throws RemoteException {
         tstkit_11 = stkit_11;
    public int getstkit_11() throws RemoteException{
         return tstkit_11;
    private static int stkit_12;
    private static int tstkit_12;
    public void sendstkit_12(int stkit_12) throws RemoteException {
         tstkit_12 = stkit_12;
    public int getstkit_12() throws RemoteException{
         return tstkit_12;
    private static int stkit_13;
    private static int tstkit_13;
    public void sendstkit_13(int stkit_13) throws RemoteException {
         tstkit_13 = stkit_13;
    public int getstkit_13() throws RemoteException{
         return tstkit_13;
    private static int c1_it1;
    private static int tc1_it1;
    public void sendc1_it1(int c1_it1) throws RemoteException {
         tc1_it1 = c1_it1;
    public int getc1_it1() throws RemoteException{
         return tc1_it1;
    private static int c1_it2;
    private static int tc1_it2;
    public void sendc1_it2(int c1_it2) throws RemoteException {
         tc1_it2 = c1_it2;
    public int getc1_it2() throws RemoteException{
         return tc1_it2;
    private static int c1_it3;
    private static int tc1_it3;
    public void sendc1_it3(int c1_it3) throws RemoteException {
         tc1_it3 = c1_it3;
    public int getc1_it3() throws RemoteException{
         return tc1_it3;
    //endoffile

  • How can one develop "view only" client applications in Lookout?This is to develop remote monitoring without control functionality.

    How can one develop "view only" client applications in Lookout?This is to develop remote monitoring without control functionality.
    We have 10 Client Nodes in the field and we need two "View Only" functionality in Client machines located on Supervisory Desks.

    I have done this. There are many ways to approach this but I will offer what I think is the easiest. This will work ONLY if you have been assigning security levels to your objects (objects that actually control devices in the field) greater than zero AND allowing a security level of zero to view all panels. When I develop interfaces I do this just for creating a non control client.
    Basically, you remove all users from the Lookout client in the user manager. You will not be able to remove the built-ins, "Guest" and "Administrator". Now when the end users tries to login using his normal login he will be denied. Consequently, he will not be able to control. But, he will still be able to view all the information since a no login can view a panel with a viewing se
    curity level of zero. You must ensure any pushbuttons that are used to open panels have a security level of zero.
    Now you can copy this security profile by finding the lookout.sec file and copying it to another non-control client computer. In Windows NT this file is located in the system32 directory.
    There are many other ways but I find this the easiest.
    Regards,
    Tommy Scharmann

  • Windows 8 64 bit issues with Cisco AnyConnect Secure Mobility Client version 3.1.04072

    I am having an issue with the Cisco AnyConnect Secure Mobility Client version 3.1.04072 on a Windows 8 64 bit laptop.
    I am able to create the VPN connection but the connection will not allow data to be transferred.
    Stats from a manual connection:
    Cisco AnyConnect Secure Mobility Client Version 3.1.04072
    VPN Stats
        Bytes Received:  14375
        Bytes Sent:  0
        Compressed Bytes Received:  0
        Compressed Bytes Sent:  0
        Compressed Packets Received:  0
        Compressed Packets Sent:  0
        Control Bytes Received:  0
        Control Bytes Sent:  0
        Control Packets Received:  0
        Control Packets Sent:  0
        Encrypted Bytes Received:  7820
        Encrypted Bytes Sent:  1207
        Encrypted Packets Received:  9
        Encrypted Packets Sent:  3
        Inbound Bypassed Packets:  0
        Inbound Discarded Packets:  0
        Outbound Bypassed Packets:  0
        Outbound Discarded Packets:  0
        Packets Received:  4
        Packets Sent:  0
        Time Connected:  00:03:01
    Protocol Info
        Inactive Protocol
            Protocol Cipher:  RSA_3DES_168_SHA1
            Protocol Compression:  None
            Protocol State:  Disconnected
            Protocol:  DTLS
        Active Protocol
            Protocol Cipher:  RSA_3DES_168_SHA1
            Protocol Compression:  Deflate
            Protocol State:  Connected
            Protocol:  TLS
    OS Version
        Windows 8 : WinNT 6.2.9200
    Log from the data transmission software:
    24/12/2013 12:51:13 - Application version = 1.11.28.0
    24/12/2013 12:51:13 - Lodgement Library Version =  1.11.28.0
    24/12/2013 12:51:13 - Connection Method =  INTERNET
    24/12/2013 12:51:13 - DIS Connection Type = Automatic
    24/12/2013 12:51:13 - VPN Client =  ACTIVE
    24/12/2013 12:51:13 - Check Available Connections =  NOT ACTIVE
    24/12/2013 12:51:13 - Windows 8 (6.2.9200 SP )
    24/12/2013 12:51:13 - Language: English (Australia)
    24/12/2013 12:51:13 -
    24/12/2013 12:51:13 - Connected to ISP via LAN
    24/12/2013 12:51:13 - Checking for presence of VPN client.
    24/12/2013 12:51:13 - VPN client found. (C:\Program Files (x86)\Cisco\Cisco AnyConnect Secure Mobility Client\vpncli.exe)
    24/12/2013 12:51:13 - The Cisco AnyConnect Secure Mobility Client application is in use.
    24/12/2013 12:51:18 - Terminating Cisco AnyConnect Secure Mobility Client in progress ...
    24/12/2013 12:51:18 -
    24/12/2013 12:51:18 - Checking Cisco AnyConnect  version.
    24/12/2013 12:51:19 - Cisco AnyConnect Secure Mobility Client (version 3.1.04072) .
    24/12/2013 12:51:19 - Copyright (c) 2004 - 2013 Cisco Systems, Inc.  All Rights Reserved.
    24/12/2013 12:51:19 - Config file directory:C:\Program Files (x86)\Cisco\Cisco AnyConnect Secure Mobility Client\
    24/12/2013 12:51:19 -
    24/12/2013 12:51:19 - Loading profile:C:\ProgramData\Cisco\Cisco AnyConnect Secure Mobility Client\Profile\ELS-IMelAde-TCP.xml
    24/12/2013 12:51:19 -
    24/12/2013 12:51:19 - Initializing the VPN connection.
    24/12/2013 12:51:19 - Ready to connect.
    24/12/2013 12:51:19 - Ready to connect.
    24/12/2013 12:51:19 - Contacting ELS-IMelAde-TCP.
    24/12/2013 12:51:23 - Authenticating user.
    24/12/2013 12:51:23 - Connected to VPN concentrator.
    24/12/2013 12:51:23 - Establishing VPN session...
    24/12/2013 12:51:23 - Checking for profile updates...
    24/12/2013 12:51:23 - Checking for product updates...
    24/12/2013 12:51:23 - Checking for customization updates...
    24/12/2013 12:51:23 - Performing any required updates...
    24/12/2013 12:51:23 - Establishing VPN session...
    24/12/2013 12:51:23 - Establishing VPN - Initiating connection...
    24/12/2013 12:51:24 - Establishing VPN - Examining system...
    24/12/2013 12:51:24 - Establishing VPN - Activating VPN adapter...
    24/12/2013 12:51:24 - Establishing VPN - Configuring system...
    24/12/2013 12:51:24 - Establishing VPN...
    24/12/2013 12:51:24 - Connected to VPN concentrator.
    24/12/2013 12:51:24 - Connected to ELS-IMelAde-TCP.
    24/12/2013 12:51:24 - Connected to VPN concentrator.
    24/12/2013 12:51:24 - Connection to VPN client return code = 0.
    24/12/2013 12:51:24 - Connected to VPN concentrator.
    24/12/2013 12:51:24 - Connecting : Connecting to 203.202.43.2.
    24/12/2013 12:51:45 - Error in ConnectToDIS - Socket Error # 10060
    Connection timed out.
    24/12/2013 12:51:46 -
    24/12/2013 12:51:46 - Disconnecting from the VPN concentrator.
    24/12/2013 12:51:46 - Disconnect in progress, please wait...
    24/12/2013 12:51:46 - Detaching AnyConnect, please wait...
    24/12/2013 12:51:47 - Detached.
    24/12/2013 12:51:47 - Disconnected from VPN concentrator.
    24/12/2013 12:51:47 - *****************************************************
    24/12/2013 12:51:47 -               END OF LODGEMENT PROCESS
    24/12/2013 12:51:47 - *****************************************************
    Issue history:
    - Previously running Cisco VPN client on Windows 8 64 bit laptop (VPN working and able to transmit data over VPN)
    - Upgrade to Windows 8.1 stopped the VPN client working
    - Refreshed system back to Windows 8 and reinstalled all software
    - Cisco VPN client would not install on system
    - Cisco AnyConnect Secure Mobility Client installs and is able to connect to VPN host
    - Cisco AnyConnect Secure Mobility Client downloads and installs software from VPN host
    - Data transmission software returns error code #10060
    Any assistance would be greatly appreciated.

    anyone found the fix for this?

  • Weblogic 10.0 web application with CLIENT-CERT suddenly redirect with 401

    Hi everybody,
    we currently have a Weblogic Portal 10.2 web application with an integrated Windows authentication.
    I configured a Negociate Identity Asserter and an Active Directory provider.
    I configure Kerberos services, so we have succefully access to our application through the Windows session.
    But, most of time we have 401 errors on any page when navigating. In fact, the error occures when clicking on a link when a page is not fully loaded.
    For our tests, we use the security webapp provided by BEA/Oracle, and it just work.
    The web.xml used in our webapp :
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>sso</web-resource-name>
    <description>Desc</description>
    <url-pattern>/appmanager/*</url-pattern>
    <http-method>GET</http-method>
    <http-method>POST</http-method>
    </web-resource-collection>
    <auth-constraint>
    <description>desc</description>
    <role-name>ssoRole</role-name>
    </auth-constraint>
    </security-constraint>
    <login-config>
    <auth-method>CLIENT-CERT</auth-method>
    <realm-name/>
    </login-config>
    <security-role>
    <description>Authenticated user</description>
    <role-name>ssoRole</role-name>
    </security-role>

    which version of web server r u using here ? 6.1 or 7.0 ? if it is 6.1 then there is no easy <If> syntax. if u r using 7.0, then u need to be aware that the processing of 'ppath' is slightly different in 7.0
    in any case, this would be the syntax
    <Object name="weblogic" ppath="/hw/">
    Service fn="wl_proxy" WebLogicHost="------------------" WebLogicPort="------"
    # gateway timeout - back end web logic not responding handle differently
    <If code='504'>
    # send it to a different post..
    Service fn="wl_proxy" WebLogicHost="------------------" WebLogicPort="------"
    </If>
    </Object>
    - sriram

  • Get screenshot with mouse cursor and send for client application

    I took
    this function for getting a screenshot from a client application. I to tried adapt this function in my project, but I can not capture desktop showing mouse cursor (coming from a remote pc) in my server application (controller).
    Here is my adaptation (in client side) but without success:
    void SendScreenProc()
    // Send First Bitmap
    MemoryStream streamScreen = new MemoryStream();
    this.bmpScreenSend = CaptureScreen(true);//new Bitmap(this.boundScreen.Width, this.boundScreen.Height, PixelFormat.Format24bppRgb);
    Graphics g = Graphics.FromImage(this.bmpScreenSend);
    g.CopyFromScreen(0, 0, 0, 0, this.boundScreen.Size);
    this.bmpScreenSend.Save(streamScreen, System.Drawing.Imaging.ImageFormat.Png);
    Compress.CompressStream(streamScreen);
    Byte[] bufferScreen = streamScreen.ToArray();
    mreSendData.WaitOne();
    this.queueSendData.AddScreen(streamScreen.GetBuffer());
    streamScreen.Close();
    this.receivedScreen = 0;
    while (this.remoted)
    // Send next bitmap result by difference with previous bitmap.
    if(this.receivedScreen == 0) {
    } else {
    Bitmap bmpCurrentScreen = CaptureScreen(true);//new Bitmap(this.boundScreen.Width, this.boundScreen.Height, PixelFormat.Format24bppRgb);
    g = Graphics.FromImage(bmpCurrentScreen);
    g.CopyFromScreen(0, 0, 0, 0, this.boundScreen.Size);
    if (this.receivedScreen == 1) {
    if(this.bmpScreen != null) {
    this.bmpScreen.Dispose();
    this.bmpScreen = this.bmpScreenSend;
    } else if(this.receivedScreen == 2) {
    if (queueSendData.AvailableScreenAdd && IsDifferent(bmpCurrentScreen, this.bmpScreen))
    streamScreen = new MemoryStream();
    Bitmap bmpDiff = XorBitmap(this.bmpScreen, bmpCurrentScreen);
    bmpDiff.Save(streamScreen, System.Drawing.Imaging.ImageFormat.Png);
    this.bmpScreenSend.Dispose();
    bmpDiff.Dispose();
    this.bmpScreenSend = bmpCurrentScreen;
    mreSendData.WaitOne();
    this.queueSendData.AddScreen(streamScreen.GetBuffer());
    streamScreen.Close();
    this.receivedScreen = 0;
    else
    bmpCurrentScreen.Dispose();
    Thread.Sleep(30);

     Hi FlashCoder,
    Do you mean like this capture? Use mouse cursor to capture the specified area.
    If so, here is a sample that I wrote. It should meet your requirement.  If not, please feel free to let me know.
    The following is ScreenForm code
    public partial class ScreenForm : Form
    public ScreenForm()
    InitializeComponent();
    public event copyToFatherTextBox copytoFather;
    public bool begin = false;
    public bool isDoubleClick = false;
    public Point firstPoint = new Point(0, 0);
    public Point secondPoint = new Point(0, 0);
    public Image cachImage = null;
    public int halfWidth = 0;
    public int halfHeight = 0;
    /*Copy the entire screen, and form fill the screen*/
    public void copyScreen()
    Rectangle r = Screen.PrimaryScreen.Bounds;
    Image img = new Bitmap(r.Width, r.Height);
    Graphics g = Graphics.FromImage(img);
    g.CopyFromScreen(new Point(0, 0), new Point(0, 0), r.Size);
    //Maximize form
    this.Width = r.Width;
    this.Height = r.Height;
    this.Left = 0;
    this.Top = 0;
    pictureBox1.Width = r.Width;
    pictureBox1.Height = r.Height;
    pictureBox1.BackgroundImage = img;
    cachImage = img;
    halfWidth = r.Width / 2;
    halfHeight = r.Height / 2;
    this.Cursor = new Cursor(GetType(), "MyCursor.cur");
    private void ScreenForm_Load(object sender, EventArgs e)
    copyScreen();
    /*Begins when the mouse is pressed screenshots*/
    private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
    if(!isDoubleClick)
    begin = true;
    firstPoint = new Point(e.X, e.Y);
    changePoint(e.X, e.Y);
    msg.Visible = true;
    /*Displayed when the mouse moves to intercept the border*/
    private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
    if (begin)
    //Redraw the background image
    secondPoint = new Point(e.X, e.Y);
    int minX = Math.Min(firstPoint.X, secondPoint.X);
    int minY = Math.Min(firstPoint.Y, secondPoint.Y);
    int maxX = Math.Max(firstPoint.X, secondPoint.X);
    int maxY = Math.Max(firstPoint.Y, secondPoint.Y);
    Image tempimage = new Bitmap(cachImage);
    Graphics g = Graphics.FromImage(tempimage);
    //Picture cropping frames
    g.DrawRectangle(new Pen(Color.Red),minX,minY,maxX-minX,maxY-minY);
    pictureBox1.Image = tempimage;
    //Calculation of coordinate information
    msg.Text = "Upper left corner coordinates:(" + minX.ToString() + "," + minY.ToString() + ")\r\n";
    msg.Text += "Lower right corner coordinates:(" + maxX.ToString() + "," + maxY.ToString() + ")\r\n";
    msg.Text += "Screenshot size:" + (maxX - minX) + "×" + (maxY - minY) + "\r\n";
    msg.Text += "Double-click end screenshots anywhere!";
    changePoint((minX + maxX) / 2, (minY + maxY) / 2);
    /*Dynamically adjusts the displayed location, enter the parameters for the current screen mouse position*/
    public void changePoint(int x, int y)
    if (x < halfWidth)
    if (y < halfHeight)
    { msg.Top = halfHeight; msg.Left = halfWidth; }
    else
    { msg.Top = 0; msg.Left = halfWidth; }
    else
    if (y < halfHeight)
    { msg.Top = halfHeight; msg.Left = 0; }
    else
    { msg.Top = 0; msg.Left = 0; }
    /*Screenshot is completed when you let go of the mouse operation */
    private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
    begin = false;
    isDoubleClick = true;
    /*When I double-click a screenshot when notifying parent form complete screenshot action, while closing the form*/
    private void pictureBox1_DoubleClick(object sender, EventArgs e)
    if (firstPoint != secondPoint)
    int minX = Math.Min(firstPoint.X, secondPoint.X);
    int minY = Math.Min(firstPoint.Y, secondPoint.Y);
    int maxX = Math.Max(firstPoint.X, secondPoint.X);
    int maxY = Math.Max(firstPoint.Y, secondPoint.Y);
    Rectangle r = new Rectangle(minX, minY, maxX - minX, maxY - minY);
    copytoFather(r);
    this.Close();
    //msg.Text = r.ToString();
    This is the mainFrom code.
    public delegate void copyToFatherTextBox(Rectangle r);
    public partial class Form1 : Form
    public Form1()
    InitializeComponent();
    /*Start screenshot*/
    private void button1_Click(object sender, EventArgs e)
    ScreenForm screen = new ScreenForm();
    screen.copytoFather += new copyToFatherTextBox(copytoTextBox);
    screen.ShowDialog();
    /*Screenshot of subsequent operations*/
    public void copytoTextBox(Rectangle rec)
    Rectangle rec2=rec;
    if(rec.Width>2&&rec.Height>2)
    rec2= new Rectangle(rec.X + 1, rec.Y + 1, rec.Width - 2, rec.Height - 2);
    Rectangle r = Screen.PrimaryScreen.Bounds;
    Image img = new Bitmap(rec2.Width, rec2.Height);
    Graphics g = Graphics.FromImage(img);
    g.CopyFromScreen(rec2.Location, new Point(0, 0), rec2.Size);
    Clipboard.SetDataObject(img, false);
    richTextBox1.Paste();
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for

  • Image browser / album application for Nokia E63

    Dear Friends, Could you please suggest a good application (free/add/share ware) for Image browsing or Album for my Nokia E63? I would like to browse the images folder to folder basis. Narottam Das Kolkata, India

  • IChat video/screensharing Problems

    I cannot get any non-text connectivity on IChat to another user. Be it on leopard, Tiger, or a windows machine. There are no firewalls. When I connect to appleu3test, I get a green screen, sometimes with audio, sometimes without. I can record videos

  • Forms6i behaviour

    hello everyone.. i have master-detail block form.. my header block has 2 fields .. - tdate (defaulted wth sysdate) and - tno (disabled at runtime) - tref a Non-required field my detail block has - actno - acode and - acamt Join relation is set to cas

  • Can't open mime-attachment in mail

    Sometimes mail is forwarded to my iPhone from my Yahoo! account as a mime-attachment and the iPhone won't open it, so I can't read the message. Any suggestions?

  • Material for ABAP Certification

    Hi everybody, I wish to appear for ABAP certification exam. Does any one has TAW10 and TAW12. Thanks & regards, Sarika Kedia