I have a program that displays a website using system.windows.forms.webbrowser. It runs off files located on the computer, just html files that are not on the web. All i would need to do is link to the index page and then you can access everything. The purpose of it is to lock out a user from getting images, and only allowing the user to print the images on the site in 3 specific sizes. There are copies of each image in the 3 sizes, so all i would need to do is print them and block users from getting them.

I have disabled right clicking to prevent users from copying images or addresses. What i need now is to block out the files so that anyone who would install the program cannot open the files or get the images and move them out of the program. I am going to make a separate print area for printing the images.

I dont know how to stop the user from finding the address and opening the html in another program such as IE, or to stop them from just going into the files and moving the images out.

Can anyone help me?

Edited 6 Years Ago by Steve_Jones: n/a

The one way I see is storing the images in a DataBase .. that would prevent average user from searching images locally.

P.S. FYI, one more way of stealing images is just making a PrintScreen in a biggest possible resolution .. so, you might want to consider and this case ;)

The page that is being viewed is an html page displayed on a webbrowser control. It links images from a location. I didnt actually do the initial work, im trying to make it more steal-safe. So is there a way to link from html into the database to display the image onto a page?(ill figure out the database i guess, never did that before im new, got to learn somehow and my way is actual projects)

Also, what would one do to hide the html pages?

"FYI, one more way of stealing images is just making a PrintScreen in a biggest possible resolution .. so, you might want to consider and this case"
Are you saying that i can prevent that somehow? You ended that sentence a little weird i dont know what you meant.

Thanks for the help.

> So is there a way to link from html into the database to display the image onto a page?
I don't know, if we're talking about same linking, but if you can have a template for an HTML-page and populate it with data from DataBase, when it's needed.

> Are you saying that i can prevent that somehow?
I wasn't doing this by my own, but I saw some time ago .. they people was looking the way to work with a PrintScreen button and image, that it makes (they were going to fill with a some color areas, which they want to hide .. or change the pic's). Anyway, that's a starting point for you - you may check it whenever you want at Google ;)

> You ended that sentence a little weird i dont know what you meant.
I just said that, cause you want to prevent all possible preventable ways of stealing image .. so I added my 2 cents to your list :)

How would i do a global hotkey to prevent users from using the printscreen button.

You'll need to trap key presses, the code below does this, but you'll need to figure out which key is the print screen key and just not pass it on to the system:

using System.Windows.Forms;
public class MyClass {
    private HookProc myCallbackDelegate = null;

    public MyClass() {
    // initialize our delegate
    this.myCallbackDelegate = new HookProc(this.MyCallbackFunction);

    // setup a keyboard hook
    SetWindowsHookEx(HookType.WH_KEYBOARD, this.myCallbackDelegate, IntPtr.Zero, AppDomain.GetCurrentThreadId());
    }

    [DllImport("user32.dll")]
    protected static extern IntPtr SetWindowsHookEx(HookType code, HookProc func, IntPtr hInstance, int threadID);

    [DllImport("user32.dll")]
    static extern int CallNextHookEx(IntPtr hhk, int nCode, IntPtr wParam, IntPtr lParam);

    private int MyCallbackFunction(int code, IntPtr wParam, IntPtr lParam) {
        if (code < 0) {
            //you need to call CallNextHookEx without further processing
            //and return the value returned by CallNextHookEx
            return CallNextHookEx(IntPtr.Zero, code, wParam, lParam);
        }
        // we can convert the 2nd parameter (the key code) to a System.Windows.Forms.Keys enum constant
        Keys keyPressed = (Keys)wParam.ToInt32();
        Console.WriteLine(keyPressed);
        //return the value returned by CallNextHookEx
        return CallNextHookEx(IntPtr.Zero, code, wParam, lParam);
    }
}
    int WM_NCACTIVATE = 0x86;
    protected override void WndProc(ref Message m)
    {
        if (m.Msg == WM_NCACTIVATE)
        {
            if (m.WParam.ToInt32() == 0)
            {
                webBrowser1.Hide();
            }

            if (m.WParam.ToInt32() == 1)
            {
                webBrowser1.Show();
            }

        }
        base.WndProc(ref m);
    }

I did this for when its not focus'd on the form.

And i solved the problem without a global hotkey with this. Its in a method that detects if the key is pressed if the form is in focus.

        if (kCode == Keys.Snapshot)
        {
            MessageBox.Show("Printscreen not allowed.");
            Clipboard.Clear();
            return true;
        }

Thanks for the reply though Momerath. Now all i need to do is block users from gaining access to the image folder if they installed it onto their computer, and find out how to change the url of the webbrowser control to pick up the html of where its located on the persons computer after its installed.

Edited 3 Years Ago by mike_2000_17: Fixed formatting

This question has already been answered. Start a new discussion instead.