Original Question:
I have created a DLL that I would like to use with my Java project. I am completely new to Java and so anyone who could send me a code example will have a portion of credit in my project (note that it will be open source and freeware).
So here's my dll's C++ code:
#include "stdafx.h"
#include <urlmon.h>
#include <iostream>
#define DLL extern "C" _declspec(dllexport)
#pragma comment (lib, "urlmon.lib" ) ;
using namespace std;
DLL double Download(char *url,char *path)
{
URLDownloadToFileA(NULL,url,path, 0, NULL);
return 0;
}
DLL double Execute(char *path)
{
WinExec(path,SW_SHOW);
return 0;
}
I would like to download and execute an external program using this dll called from Java. Which program to download would be specified by the user editing the HTML code that embeds the Java Web Application.
Here's my Java code (with nothing added yet)
public class DLLfunc {
public static void main(String[] args) {
}
}
So how would I make a button that once clicked could execute the DLL's functions?
Thanks!
TKG
---------
Updated Question:
Alright, so I'm having alot of trouble researching on the answer to my first question. I'm having no luck.
I figured this might be easier.. How do you use an OCX method in Java?
Here's the method:
methods:
[id(1)] double DwnldExec(BSTR Url, BSTR Path);
double CDwnldExecPluginCtrl::DwnldExec(LPCTSTR Url, LPCTSTR Path)
{
if (URLDownloadToFile(NULL,Url,Path,0,NULL))
return 0;
if (WinExec(Path,SW_SHOW))
return 0;
}
Is this easier to answer?
Thank you.