I was tinkering around with loading libcurl.dll in TSE a little last
night, but didn't get anywhere and not sure how to troubleshoot.
From http://curl.haxx.se/download.html I tried both the "Win32 -
Generic" and "Win32 - MSVC" versions.
TSE Reports "Cannot load DLL: C:\tse32\mymac\libcurl.dll" (as opposed
to "cannot find...")
GetLastError() reports 127, though I'm sure there's a lot going on
behind the scenes, so I don't know what part of loading the DLL this
error code is related to. 127 seems to mean "ERROR_PROC_NOT_FOUND" but
I've used depends and found that these functions are there and named
that way and there's no external dependencies missing. Maybe there's
just something odd about these DLLs?
I haven't done a lot with loading DLLs into TSE, but from the existing
macros, and what I've seen discussed here, the below shouldn't be too
far off.
If anyone has any thoughts on this, I'd appreciate it.
Thanks!
===
libcurl.s
___
dll "libcurl.dll"
integer proc curl_global_init( integer flags )
proc curl_global_cleanup()
integer proc curl_easy_init()
proc curl_easy_cleanup( integer curlHandle )
end
DLL "<kernel32.dll>"
integer proc GetLastError()
end
proc main()
integer h
integer error
h = curl_easy_init()
error = GetLastError()
warn( error )
curl_easy_cleanup( h )
end
___
1. Download the dll from the offcial CURL site
http://www.gknw.net/mirror/curl/win32/curl-7.21.3-ssl-sspi-zlib-static-bin-w32.zip
2. Unzip the file and get the libcurl.dll
3. Put the file libcurl.dll in the same directory as the macro
4. Run this program
dll "libcurl.dll"
integer proc curl_easy_init()
end
proc main()
integer h = curl_easy_init()
end
5. It will give the error
"Cannot load <your directory>\libcurl.dll
6. I think currently some initializing information (e.g. in the TSE macro here)
is probably missing.
with friendly greetings,
Knud van Eeden
DDL Dependency walker
http://www.dependencywalker.com
2. then load libcurl.dll
3. then click on libcurl.dll in the left pane
4. then you see the functions defined in that DLL,
of which easy_curl_init is one,
5. my first thought was to adapt the TSE macro to as usual include that name
dll "libcurl.dll"
integer proc curl_easy_init() : "curl_easy_init"
end
proc main()
integer h = curl_easy_init()
end
6. But running gave still the same error "Cannot load libcurl.dll"
So Sammy could maybe look into it.
Thanks
My thanks (again) to sysinternals procmon.
-Windows system32 directory (c:\windows\system32\libcurl.dll)
-Windows directory (c:\windows\libcurl.dll)
-current directory (.\libcurl.dll)
-TSE working directory (that is the directory where you land if you press <F9>
'Shell')
===
But the only location where I got it working was
when I put the lib*.dll files
the *main*I irectory for TSE.
(there where g32.exe is located by default)
E.g.
c:\TSE\
So as far as I can tell here, it is probably not the working directory,
but the main directory, and also there must be 3 dependent DLLs present.
Otherwise it does not work and you get either "Cannot load" or "Cannot find"
errors
with regard to libcurl.dll.
===
Steps to run successfully:
1. Download the zip via the offcial cURL site
http://www.gknw.net/mirror/curl/win32/curl-7.21.3-ssl-sspi-zlib-static-bin-w32.zip
2. Unzip the file and get this 3 files in it
libcurl.dll
libeay.dll
libssl32.dll
3. Put these files all in the main TSE directory
e.g. c:\TSE\
4. Then compile and run this program libcurl.s
dll "libcurl.dll"
integer proc curl_easy_init()
end
proc main()
integer h = curl_easy_init()
end
5. That will now not produce an error anymore.
===
Questions:
1. It is strange that you get an error message
"Cannot load libcurl.dll"
while the solution is in making sure that the 3 dependent DLLs are present.
2. I did run PROCMon, put a filter on the PID (process id) for g32.exe
(e.g. PID is 8332), then cleared the display (CTRL X)
then did run the TSE macro.
I saw indeed that first libcurl.dll is loaded, then libeay.dll
But no suggestion that this is a root cause when libeay.dll is not present
that it will cause that TSE starts complaining that libcurl.dll can not be
loaded
3. It is further interesting to know for which purpose you want to
use libcurl.dll with TSE. I am very interested to know, and even better
seeing it used in a TSE macro.
Thanks
with friendly greetings,
Knud van Eeden
My thought process:
Step 1. Get libcurl.dll loaded in TSE
Step 2. Figure out how to use libcurl within TSE
Step 2 is where everything falls apart since curl either uses
callbacks to capture the data, or it requires a FILE * to write to.
TSE has fopen, but I dont' know that they wrap FILE *, but it doesn't
much matter since I can't get past curl_easy_setopt( void*,enum, ...)
where "..." is a varg
I tried to be tricky:
constant CURLOPT_URL = 2
integer proc curl_easy_setopt1string( integer curlHandle, integer
option, string value: cstrval ) : "curl_easy_setopt"
error = curl_easy_setopt1string( h, CURLOPT_URL, "http:\\google.com" )
It always returns 2 which is the fall-through failure if the option is invalid.
Not a big deal, I was just curious if it could be done.
Interesting, following the tutorial
at http://curl.haxx.se/libcurl/c/libcurl-tutorial.html
and looking at your earlier source code, this is where I am working with right
now:
dll "libcurl.dll"
integer proc curl_easy_init()
proc curl_easy_setopt( integer handle, integer CURLOPT_URL, VAR string url :
strptr )
proc curl_easy_cleanup( integer curlHandle )
end
proc main()
integer h = 0
integer CURLOPT_URL = 2
string s[255] = "http://www.semware.com"
h = curl_easy_init()
curl_easy_setopt( h, CURLOPT_URL, s )
curl_easy_cleanup( h )
end
===
----- Original Message ----
From: gregg conklin
E.g. you need to pass 'callback' functions, and I do not think this is possible
in TSE
at this moment??
http://curl.haxx.se/libcurl/c/libcurl-tutorial.htm
What (specific) goal(s) are you trying to achieve??
It might be that Microsoft DLLs do the job (also), like URLMon
===
FYI
===
My thought process:
--
TSEPro Mailing List
List Maintenance: www.semware.com/html/list.htm
I checked e.g. using WireShark if I see some network traffic going
when I run this
dll "libcurl.dll"
integer proc curl_easy_init()
proc curl_easy_setopt( integer handle, integer CURLOPT_URL, VAR string url :
strptr )
proc curl_easy_cleanup( integer curlHandle )
end
proc main()
integer h = 0
integer CURLOPT_URL = 2
string s[255] = "http://www.semware.com"
h = curl_easy_init()
curl_easy_setopt( h, CURLOPT_URL, s )
curl_easy_cleanup( h )
end
Of course when running
I can see the HTTP traffic going in Wireshark.
OK, the idea of libcurl is thus that it can send or receive data (e.g. files)
over the network (using all kind of protocols, HTTP, HTTPS, FTP, LDAP, ...)
In general
1. you first initialize
2. Then choose some action
3. Then execute that action
4. and then you clean up.
For example thus something like this
dll "libcurl.dll"
integer proc curl_easy_init()
proc curl_easy_setopt( integer handle, integer CURLOPT_URL, VAR string url :
strptr )
proc curl_easy_perform( integer handle )
proc curl_easy_cleanup( integer handle )
end
proc main()
integer h = 0
integer CURLOPT_URL = 2
string s[255] = "http://www.semware.com"
h = curl_easy_init()
curl_easy_setopt( h, CURLOPT_URL, s )
// curl_easy_perform( h )
// curl_easy_recv( h, BUFFER, BUFLEN, SIZE )
curl_easy_cleanup( h )
end
Typically for uploading something, you will use e.g. curl_easy_send()
and to download something your use e.g. curl_easy_receive()
===
Now maybe Sammy knows if e.g. curl_easy_receive() is possible in TSE.
Can you initialize and pass e.g. a BUFLEN in TSE,
as described here?
CURLcode curl_easy_recv( CURL * curl , void * buffer , size_t buflen , size_t *
n );
http://curl.haxx.se/libcurl/c/curl_easy_recv.html
Thanks,
<?php
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://www.google.com/");
curl_setopt($ch, CURLOPT_HEADER, 0);
print CURLOPT_URL;
// grab URL and pass it to the browser
curl_exec($ch);
// close cURL resource, and free up system resources
curl_close($ch);
?>
if your run the example program on that PHP page, it will load and show the
index page
from http://www.google.com.
The same effect thus if you type on the command line
curl http://www.google.com
which will show in both case a page '302 Moved'
===
So the equivalent TSE program should be using
curl_easy_recv()
to do the similar action.
As you said the resulting page should be stored somewhere in a buffer,
or directly be loaded in TSE as a file maybe, using e.g. fOpen() or something.
dll "libcurl.dll"
integer proc curl_easy_init()
proc curl_easy_setopt( integer handle, integer CURLOPT_URL, VAR string url :
strptr )
proc curl_easy_perform( integer handle )
proc curl_easy_cleanup( integer handle )
end
proc main()
integer h = 0
integer CURLOPT_URL = 10002
string s[255] = "http://www.semware.com"
h = curl_easy_init()
curl_easy_setopt( h, CURLOPT_URL, s )
curl_easy_perform( h ) // for sending, but just checking if I see something
happening on the network
// curl_easy_recv( h, BUFFER, BUFLEN, SIZE )
curl_easy_cleanup( h )
end
If I run this program I do not see anything happening in WireShark,
and curl_easy_recv() is thus not activated at all.
Note that URLMon.dll does the same action, that is downloading a web page or in
general some file from
a website, and this I have used a lot in TSE and elsewhere.
Not working yet.
This is the current state.
dll "libcurl.dll"
integer proc curl_easy_init()
proc curl_easy_setopt( integer handle, integer option, string parameter )
proc curl_easy_perform( integer handle )
proc curl_easy_cleanup( integer handle )
end
//
#define CURLOPT_NOTHING 0
#define CURLOPT_URL 1
#define CURLOPT_USERPWD 2
#define CURLOPT_HTTPHEADER 3
#define CURLOPT_POSTFIELDS 4
#define CURLOPT_CONNECTTIMEOUT 5
#define CURLOPT_TIMEOUT 6
#define CURLOPT_RETURNTRANSFER 7
#define CURLOPT_COOKIE 8
#define CURLOPT_NOBODY 9
#define CURLOPT_USERAGENT 10
#define CURLOPT_HEADER 11
//
proc main()
integer h = 0
h = curl_easy_init()
curl_easy_setopt( h, CURLOPT_URL, "http://www.semware.com" )
curl_easy_setopt( h, CURLOPT_HEADER, "0" ) // should be integer 0 and not
string 0
curl_easy_perform( h ) // for sending, but just checking if I see something
happening on the network
// curl_easy_recv( h, BUFFER, BUFLEN, SIZE )
curl_easy_cleanup( h )
end
I believe further that e.g. 10002 for CURLOP_URL might be right,
because my default PHP installation and asking for its value gave that answer.
It is probably simply 10000 + 2
which adds thus some base value 10000 to it.
Base values seem to be 0, 10000 and 20000, so combining it with 2 (or 1 if you
look at your list).
WireShark still does not show any reaction when I run the program.
with friendly greetings,
Knud van Eeden
----- Original Message ----
> From: Peter Birch
____________________________________________________________________________________
The fish are biting.
Get more visitors on your site using Yahoo! Search Marketing.
http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php
> proc curl_easy_setopt( integer handle, integer option, STRING parameter )
there you have to pass a parameter which should be an integer in some cases,
but otherwise also a string (e.g. "http://www.semware.com" ).
So it should possibly be some string pointer or something.
===
According to the cURLlib documentation:
"That 'parameter' can be a long, a function pointer, an object pointer or
a curl_off_t"
See
http://curl.haxx.se/libcurl/c/curl_easy_setopt.html
===
So I think if I manage to replace the STRING by the correct type
(e.g. long, otherwise maybe a pointer to a string
(as I have to pass proc curl_easy_setopt() also
e.g. a URL like "http://www.semware.com")
according to the example
curl_easy_setopt(handle, CURLOPT_URL, "http://domain.com/");
at http://curl.haxx.se/libcurl/c/libcurl-tutorial.html
Any suggestions are welcome.
Thanks,
with friendly greetings,
Knud van Eeden
===
I did mention the problem with curl_easy_setopt being a (...) type
parameter which turns into a va_list. I think this is probably where
parameters are getting munged. I tried to get around it by specifying
2 functions for setopt, but I don't think the dll procs are being
calling correctly.
integer proc curl_easy_setopt1string( integer curlHandle, integer
option, string value: cstrval ) : "curl_easy_setopt"
integer proc curl_easy_setopt1integer( integer curlHandle, integer
option, integer value ) : "curl_easy_setopt"
anyway, this is where i am. curl_easy_perform returns
CURLE_COULDNT_RESOLVE_HOST, /* 6 */
i can see it hit the network, but for some reason the URL is not there.
since most of what i need of this library is through callbacks, i may
just have to write a wrapper DLL. i don't think i can use urlmon
because it does not give such fine grained control over the request
and i also need every bit of connection info i can get. such as IP
connected to, all the headers sent and received and any errors.
doing this in TSE was really more of a curiosity. there's far better
ways for me to implement what i need to do.
_____________
constant CURL_GLOBAL_SSL = (1 SHL 0)
constant CURL_GLOBAL_WIN32 = (1 SHL 1)
constant CURL_GLOBAL_ALL = (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32)
constant CURL_GLOBAL_NOTHING = 0
constant CURL_GLOBAL_DEFAULT = CURL_GLOBAL_ALL
constant CURLOPT_WRITEDATA = 10001
constant CURLOPT_URL = 10002
dll "libcurl.dll"
integer proc curl_global_init( integer flags )
proc curl_global_cleanup()
integer proc curl_easy_init()
proc curl_easy_cleanup( integer curlHandle )
integer proc curl_easy_setopt1string( integer curlHandle, integer
option, string value: cstrval ) : "curl_easy_setopt"
integer proc curl_easy_setopt1integer( integer curlHandle, integer
option, integer value ) : "curl_easy_setopt"
integer proc curl_easy_perform( integer curlHandle )
integer proc curl_version()
end
proc main()
integer h
integer error
integer hFile
string url[255]
hFile = fOpen( "c:\\dumptest", _OPEN_READWRITE_ )
curl_global_init( CURL_GLOBAL_ALL )
h = curl_easy_init()
url = "http:\\www.google.com"
error = curl_easy_setopt1string( h, CURLOPT_URL, url )
warn( error )
error = curl_easy_setopt1integer( h, CURLOPT_WRITEDATA, hFile )
warn( error )
error = curl_easy_perform( h )
warn( error )
curl_easy_cleanup( h )
curl_global_cleanup()
fClose( hFile )
EditFile( "c:\\dumptest" )
end
-For those interested, here are further many examples of using cURLlib routines
in C
http://curl.haxx.se/libcurl/c/example.html
E.g. using this as a starting point to get it working in TSE
http://curl.haxx.se/libcurl/c/simple.html
-One of the really very intesting side effects will be that the capabilities
regarding e.g. FTP, HTTP, HTTPS, ...
upload and download from TSE could be very much increased if we get this
working.
Continuing to get it working...
with friendly greetings,
Knud van Eeden
===
----- Original Message ----
> From: gregg conklin
thanks.
On Sat, Feb 12, 2011 at 11:20 AM, knud van eeden
error = curl_easy_perform( h )
Do you get the same?
===
> i can see it hit the network, but for some reason the URL is not there.
Interesting, I do not see anything happening (using a 'http' filter in
WireShark), if I run the below program
using the (backslash) URL http:\\www.google.com
How are you testing the network activity?
Thanks,
with friendly greetings,
Knud van Eeden
----- Original Message ----
> From: gregg conklin
> lol :)
> thanks.
On Sat, Feb 12, 2011 at 11:20 AM, knud van eeden
<knud_va...@yahoo.com> wrote:
>> CURLE_COULDNT_RESOLVE_HOST, /* 6 */
>
> I see this
> "http:\\www.google.com"
>
> that should be
>
> "http://www.google.com"
>
> Thanks
>
> with friendly greetings,
> Knud van Eeden
>
>
> ----- Original Message ----
> From: gregg conklin
-> Sent: Sat, February 12, 2011 4:46:36 PM
On Sat, Feb 12, 2011 at 12:27 PM, knud van eeden
=================
constant CURL_GLOBAL_SSL = (1 SHL 0)
constant CURL_GLOBAL_WIN32 = (1 SHL 1)
constant CURL_GLOBAL_ALL = (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32)
constant CURL_GLOBAL_NOTHING = 0
constant CURL_GLOBAL_DEFAULT = CURL_GLOBAL_ALL
constant CURLOPT_WRITEDATA = 10001
constant CURLOPT_URL = 10002
dll "libcurl.dll"
integer proc curl_global_init( integer flags )
proc curl_global_cleanup()
integer proc curl_easy_init()
proc curl_easy_cleanup( integer curlHandle )
integer proc curl_easy_setopt1string( integer curlHandle, integer
option, string value: cstrval ) : "curl_easy_setopt"
integer proc curl_easy_setopt1integer( integer curlHandle, integer
option, integer value ) : "curl_easy_setopt"
integer proc curl_easy_perform( integer curlHandle )
proc url_easy_strerror( integer error )
integer proc curl_version()
end
proc main()
integer h
integer error
integer hFile
string url[255]
hFile = fOpen( "c:\\dumptest", _OPEN_READWRITE_ )
curl_global_init( CURL_GLOBAL_ALL )
h = curl_easy_init()
url = "http://www.google.com"
error = curl_easy_setopt1string( h, CURLOPT_URL, url )
warn( error )
// error = curl_easy_setopt1integer( h, CURLOPT_WRITEDATA, hFile )
// warn( error )
error = curl_easy_perform( h )
warn( error )
curl_easy_cleanup( h )
curl_global_cleanup()
fClose( hFile )
EditFile( "c:\\dumptest" )
end
===========
E.g. if I use http://www.semware.com
and choose 'Intercept TCP stream' in Wireshark,
this is part of the expected HTTP response.
=======================================
GET / HTTP/1.1
Host: www.semware.com
Accept: */*
HTTP/1.1 200 OK
Date: Sat, 12 Feb 2011 18:38:27 GMT
Server: Apache/2.2
Transfer-Encoding: chunked
Content-Type: text/html
ff4
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<meta name="google-site-verification"
content="-HQMsOrHa6lr5Fl-tCDjD7Dy4Us47rd5S0sspVGI6jI">
<META NAME="keywords" content="editor,TSE Jr,formerly called QEdit,TSE Pro,TSE
Pro/32,GUI,Windows,WIN,95,98,98SE,Me,NT,2000,XP,Vista,demo,features,text
editor,programmers editor,programmers text editor,source editor,source code
editor,syntax highlighting,color syntax highlighting,macros,macro
language,script language,SemWare Applications Language,regular
expressions,column blocks">
<META NAME="description" content="The SemWare Editor Junior (TSE Jr) and The
SemWare Editor Professional (TSE Pro and TSE Pro/32) products">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<META NAME="Author" CONTENT="Kyle">
<META NAME="GENERATOR" CONTENT="(Win16; U)">
<META NAME="Creation_Date" CONTENT="05/06/2002 14:50:46">
=======================================
Thanks,
- error = curl_easy_perform( h )
I think that using the below technique
you would be able to get libcurl.dll to work in TSE
(that is that it indeed loads the downloaded file automatically in TSE)
===
I think thus you can thus pass the data structure (e.g. to return) in the DLL.
dll "<shell32.dll>"
integer proc ShellExecute(
integer h, // handle to parent window
string op:cstrval, // specifies operation to perform
string file:cstrval,// filename string
string parm:cstrval,// specifies executable-file parameters
string dir:cstrval, // specifies default directory
integer show) // whether file is shown when opened
:"ShellExecuteA"
===
Please let us know what you see as possibility.
Thanks,
with friendly greetings,
Knud van Eeden
----- Original Message ----
From: S.E. Mitchell
Sent: Mon, July 19, 2010 12:53:00 PM
Subject: [TSEPro] Re: Assigning memory to DLLs in TSE (or in general getting the
process handle of a program)
Yes - an example follows - note that not all of the constants are
needed - it was just easier to copy the entire list from the header
file they were in:
constant SW_HIDE = 0
constant SW_SHOWNORMAL = 1
constant SW_NORMAL = 1
constant SW_SHOWMINIMIZED = 2
constant SW_SHOWMAXIMIZED = 3
constant SW_MAXIMIZE = 3
constant SW_SHOWNOACTIVATE = 4
constant SW_SHOW = 5
constant SW_MINIMIZE = 6
constant SW_SHOWMINNOACTIVE =7
constant SW_SHOWNA = 8
constant SW_RESTORE = 9
constant SW_SHOWDEFAULT = 10
constant SW_MAX = 10
constant SEE_MASK_NOCLOSEPROCESS = 0x00000040
constant STATUS_WAIT_0 = 0x00000000
constant STATUS_ABANDONED_WAIT_0 = 0x00000080
constant STATUS_TIMEOUT = 0x00000102
constant WAIT_FAILED = 0xFFFFFFFF
constant WAIT_OBJECT_0 = ((STATUS_WAIT_0 ) + 0 )
constant WAIT_ABANDONED = ((STATUS_ABANDONED_WAIT_0 ) + 0 )
constant WAIT_ABANDONED_0 = ((STATUS_ABANDONED_WAIT_0 ) + 0 )
constant WAIT_TIMEOUT = STATUS_TIMEOUT
dll "<shell32.dll>"
integer proc ShellExecute(
integer h, // handle to parent window
string op:cstrval, // specifies operation to perform
string file:cstrval,// filename string
string parm:cstrval,// specifies executable-file parameters
string dir:cstrval, // specifies default directory
integer show) // whether file is shown when opened
:"ShellExecuteA"
integer proc ShellExecuteEx(
var integer lpExecInfo // ptr to SHELLEXECUTEINFO structure
)
end
dll "<kernel32.dll>"
integer proc WaitForSingleObject(
integer hHandle, // handle of object to wait for
integer dwMilliseconds // time-out interval in milliseconds
)
integer proc GetExitCodeProcess(
integer hProcess, // handle to the process
var integer lpExitCode // addr to receive termination status
)
integer proc CloseHandle(integer object)
end
/***************************************************************
typedef struct _SHELLEXECUTEINFO {
DWORD cbSize;
ULONG fMask;
HWND hwnd;
LPCSTR lpVerb;
LPCSTR lpFile;
LPCSTR lpParameters;
LPCSTR lpDirectory;
int nShow;
HINSTANCE hInstApp;
// Optional members
LPVOID lpIDList;
LPCSTR lpClass;
HKEY hkeyClass;
DWORD dwHotKey;
HANDLE hIcon;
HANDLE hProcess;
} SHELLEXECUTEINFO, FAR *LPSHELLEXECUTEINFO;
***************************************************************/
// shellexecuteinfo structure
integer cbSize
integer fMask
integer hwnd
integer lpVerb
integer lpFile
integer lpParameters
integer lpDirectory
integer nShow
integer hInstApp
integer lpIDList
integer lpClass
integer hkeyClass
integer dwHotKey
integer hIcon
integer hProcess
string program[] = "notepad.exe" + Chr(0)
proc main()
integer exit_code
Set(Break, On)
cbSize = 60
fMask = SEE_MASK_NOCLOSEPROCESS
hwnd = GetWinHandle()
lpVerb = 0
lpFile = Addr(program) + 2
lpParameters = 0
lpDirectory = 0
nShow = SW_SHOWNORMAL
if ShellExecuteEx(cbSize)
loop
if not GetExitCodeProcess(hProcess, exit_code)
Warn("could not get exit code")
break
endif
if WaitForSingleObject(hProcess, 1000) == WAIT_OBJECT_0
GetExitCodeProcess(hProcess, exit_code)
break
endif
endloop
CloseHandle(hProcess)
endif
end
On Sun, Jul 18, 2010 at 3:24 PM, knud van eeden
<knud_va...@yahoo.com> wrote:
> Hi,
>
> Question:
> Is it possible to (manually) assign memory to DLLs in TSE?
>
> E.g. I want to kill a program launched using ShellExecute.
>
> (e.g. something like killing a browser launched using
> ShellExecute( "iexplore", "http://www.someurl.com", ..., _START_HIDDEN_ )
>
> 1. What you usually do in other computer languages is to assign some memory to
>a
> data structure for use by ShellExecute.
> 2. Then you launch ShellExecute.
> 3. That will by design fill the process handle associated with that program.
> 4. Knowing that you can use the APIs WaitForSingleObject and TerminateProcess
> using that process handle
> to kill the process and thus completely stop that program.
>
> ===
>
> Here examples of how it is done in some other computer languages:
>
> ===
>
> Example 1:
>
> SHELLEXECUTEINFO sei;
> ZeroMemory ( &sei, sizeof ( SHELLEXECUTEINFO ) );
> sei.cbSize = sizeof ( SHELLEXECUTEINFO );
> sei.lpVerb = "OPEN";
> sei.lpFile = "cmd.exe";
> sei.lpParameters = "acNetCmd;
> sei.nShow = SW_HIDE;
> sei.fMask = SEE_MASK_NOCLOSEPROCESS;
> ShellExecuteEx ( &sei);
> WaitForSingleObject( sei.hProcess, INFINITE);
> TerminateProcess( sei.hProcess);
> CloseHandle( sei.hProcess);
>
> Example 2:
>
> DEF PROCexecuteandwait(prog$,parm$,cdir$,show%)
> REM {} is equivalent to a 'struct' in C and C++
> LOCAL sei{}, res%
> DIM sei{cbSize%, fMask%, hwnd%, lpVerb%, lpFile%, lpParameters%,
lpDirectory%,
> nShow%, \
> \ hInstApp%, lpIDList%, lpClass%, hkeyClass%, dwHotKey%, hIcon%,
> hProcess%}
> prog$ += CHR$0
> parm$ += CHR$0
> cdir$ += CHR$0
> sei.cbSize% = !!^sei{}
> sei.fMask% = 64 : REM SEE_MASK_NOCLOSEPROCESS
> sei.hwnd% = @hwnd%
> sei.lpFile% = !^prog$
> sei.lpParameters% = !^parm$
> sei.lpDirectory% = !^cdir$
> sei.nShow% = show%
> SYS "ShellExecuteEx", sei{}
> IF sei.hProcess% = 0 THEN ENDPROC
> REPEAT
> SYS "WaitForSingleObject", sei.hProcess%, 100 TO res%
> UNTIL res%<>258 : REM WAIT_TIMEOUT
> ENDPROC
>
> You can then call this function using e.g.
>
> PROCexecuteandwait("notepad.exe", "test.txt", "C:\", 1)
>
> or
>
> PROCexecuteandwait("iexplore", "http://www.myurl.com", "C:\", 1)
>
> Thanks,
>
> with friendly greetings,
> Knud van Eeden
>
>
----- Original Message ----
From: gregg conklin <gr...@gate.net>
To: sem...@googlegroups.com
Cc: TSEPro Support <tse...@freelists.org>
Sent: Sat, February 12, 2011 7:28:34 PM
Subject: Re: [TSEPro] Re: [TSE] Re: Re: dll "libcurl.dll"