Hi Folks,
after a long time of just looking at X# (even as a Fox subscriber since last the last conference) I finally started
to have a close look.
This will for sure cost a lot of time but i think it is worth the effort.
Just now I'm stuck with the followin little problem.
In VO these two lines brings up the default browser and shows the image of a ip-camera:
cCommandstring := "http://123.456.789.000:xxx/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=xxx&pwd=xxxx"
ShellExecute(0, psz("open"), psz(cCommandString), NULL_PSZ , ;
NULL_PSZ , ;
SW_SHOWMAXIMIZED )
How can this be done in X#?
The final goal would be to store the image as jpg-file instead of just diplaying it.
Looking foward to a good time with X#
greetings
Thomas
Let's get this started
Let's get this started
Thomas,
System.Diagnostics.Process.Start( "C:Program FilesMozilla Firefoxfirefox.exe", "google.com") opens Google.
etc.
Karl
System.Diagnostics.Process.Start( "C:Program FilesMozilla Firefoxfirefox.exe", "google.com") opens Google.
etc.
Karl
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Let's get this started
Hi Thomas,
First of all, the exact same code should compile and run fine in X#, by simply referencing the Win32 SDK dll in your app. Secondly, you can use the "more .Net" version of the same thing that Karl provided. And thirdly, you can use one of the dedicated web related classes that are offered in the .Net framework for using http, ftp, mail etc in a very powerful OOP way. Unfortunately I have very little experience with them, somebody else may chip in with more detailed advice using those.
Chris
First of all, the exact same code should compile and run fine in X#, by simply referencing the Win32 SDK dll in your app. Secondly, you can use the "more .Net" version of the same thing that Karl provided. And thirdly, you can use one of the dedicated web related classes that are offered in the .Net framework for using http, ftp, mail etc in a very powerful OOP way. Unfortunately I have very little experience with them, somebody else may chip in with more detailed advice using those.
Chris
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Let's get this started
Hi Thomas,
First of all, the exact same code should compile and run fine in X#, by simply referencing the Win32 SDK dll in your app. Secondly, you can use the "more .Net" version of the same thing that Karl provided. And thirdly, you can use one of the dedicated web related classes that are offered in the .Net framework for using http, ftp, mail etc in a very powerful OOP way. Unfortunately I have very little experience with them, somebody else may chip in with more detailed advice using those.
Chris
First of all, the exact same code should compile and run fine in X#, by simply referencing the Win32 SDK dll in your app. Secondly, you can use the "more .Net" version of the same thing that Karl provided. And thirdly, you can use one of the dedicated web related classes that are offered in the .Net framework for using http, ftp, mail etc in a very powerful OOP way. Unfortunately I have very little experience with them, somebody else may chip in with more detailed advice using those.
Chris
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Let's get this started
Chris,
i copied Thomas' lines in the Start of a newly created VO-MDI app,
like
VAR cCommandstring := "http://123.456.789.000:xxx/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=xxx&pwd=xxxx"
ShellExecute(0,String2Psz("open"), String2Psz(cCommandString), NULL_String , ;
NULL_String , ;
1 )
first got warnings that the PSZ could provide leaks, replaced them with the suggestet String2PSZ, but then got strange error as
error XS0103: The name 'Xs$Return' does not exist in the current context 3,1 Start.prg MdiApp1
Line 3 being the Function Start() one.
??
Have the Win32Library referenced, how would i add the Win32SDK (as it is not listed in the dialog?
Karl
i copied Thomas' lines in the Start of a newly created VO-MDI app,
like
VAR cCommandstring := "http://123.456.789.000:xxx/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=xxx&pwd=xxxx"
ShellExecute(0,String2Psz("open"), String2Psz(cCommandString), NULL_String , ;
NULL_String , ;
1 )
first got warnings that the PSZ could provide leaks, replaced them with the suggestet String2PSZ, but then got strange error as
error XS0103: The name 'Xs$Return' does not exist in the current context 3,1 Start.prg MdiApp1
Line 3 being the Function Start() one.
??
Have the Win32Library referenced, how would i add the Win32SDK (as it is not listed in the dialog?
Karl
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Let's get this started
Hi Thomas,
For VO this may help (not tested in X# yet):
In your case 'sUser' and 'sPsw' could be empty. Some error handling should be implemented ( I removed this for better readability).
Stefan
For VO this may help (not tested in X# yet):
Code: Select all
oHttp := CHttp{}
oHttp:ConnectRemote("http://123.456.789.000:xxx", sUser, sPsw)
oHttp:GetFile("cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=xxx&pwd=xxxx", sDestFile, FALSE)
oHttp:CloseRemote()
Stefan
- lumberjack
- Posts: 727
- Joined: Fri Sep 25, 2015 3:11 pm
- Location: South Africa
Let's get this started
Hi Thomas,
Think you will find everything there that you need.
Regards,
Please have a look at System.Net.WebClient class of .netThomasVenus wrote:Hi Folks,
In VO these two lines brings up the default browser and shows the image of a ip-camera:
cCommandstring := "http://123.456.789.000:xxx/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=xxx&pwd=xxxx"
ShellExecute(0, psz("open"), psz(cCommandString), NULL_PSZ , ;
NULL_PSZ , ;
SW_SHOWMAXIMIZED )
How can this be done in X#?
The final goal would be to store the image as jpg-file instead of just diplaying it.
Think you will find everything there that you need.
Regards,
______________________
Johan Nel
Boshof, South Africa
Johan Nel
Boshof, South Africa
- lumberjack
- Posts: 727
- Joined: Fri Sep 25, 2015 3:11 pm
- Location: South Africa
Let's get this started
Hi Thomas,
Not near my laptop with example of http, but here is hopefully something to get you going. It is reading the directory structure of a ftp site:
HTH,
Not near my laptop with example of http, but here is hopefully something to get you going. It is reading the directory structure of a ftp site:
Code: Select all
METHOD UpgradeCheck() AS VOID
LOCAL wc AS WebClient
LOCAL nc AS NetworkCredential
LOCAL fwr, fwd AS WebRequest
LOCAL sr AS StreamReader
LOCAL enumerator AS IEnumerator
LOCAL aDirectory, aStr AS STRING[]
LOCAL aFolders AS Stack<STRING>
LOCAL s, sName, sFolder, sTmp, sApp, sEnv AS STRING
LOCAL nIndex AS INT
nc := NetworkCredential{"eval", "demo"}
wc := WebClient{}
wc:Credentials := nc
wc:BaseAddress := SELF:oIni:GetString("__servers", SELF:cEnvironment)
TRY
SELF:aAppFolders := Stack<STRING>{}
SELF:aFiles := Stack<STRING>{}
aFolders := Stack<STRING>{}
sFolder := ""
SELF:slbAction:Text := "Checking application folder layout..."
REPEAT
fwr := WebRequest.Create(wc:BaseAddress + sFolder)
fwr:Credentials := nc
fwr:@@Method := WebRequestMethods.Ftp.ListDirectoryDetails
sr := StreamReader{fwr:GetResponse():GetResponseStream()}
aDirectory := sr:ReadToEnd():Split((CRLF):ToCharArray(), StringSplitOptions.RemoveEmptyEntries)
______________________
Johan Nel
Boshof, South Africa
Johan Nel
Boshof, South Africa
Let's get this started
Hi Karl,
Yes, that's what I meant, to reference the Win32Library. About the error, I did not get it in my tests, can you please show the complete code you used?FFF wrote:Chris,
i copied Thomas' lines in the Start of a newly created VO-MDI app,
like
VAR cCommandstring := "http://123.456.789.000:xxx/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=xxx&pwd=xxxx"
ShellExecute(0,String2Psz("open"), String2Psz(cCommandString), NULL_String , ;
NULL_String , ;
1 )
first got warnings that the PSZ could provide leaks, replaced them with the suggestet String2PSZ, but then got strange error as
error XS0103: The name 'Xs$Return' does not exist in the current context 3,1 Start.prg MdiApp1
Line 3 being the Function Start() one.
??
Have the Win32Library referenced, how would i add the Win32SDK (as it is not listed in the dialog?
Karl
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Let's get this started
New Vo-Mdi Sample, then:
Code: Select all
#include "VOGUIClasses.vh"
FUNCTION Start( asCmdLine AS STRING[] ) AS INT
LOCAL nExitCode AS INT
LOCAL oMainWindow AS StandardShellWindow
LOCAL oApp AS App
RDDSetDefault( "DBFCDX" )
nExitCode := 0
oApp := App{}
oMainWindow := StandardShellWindow{oApp}
oMainWindow:Show(SHOWCENTERED)
VAR cCommandstring := "http://123.456.789.000:xxx/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=xxx&pwd=xxxx"
ShellExecute(0,String2Psz("open"), String2Psz(cCommandString), NULL_String , ;
NULL_String , ;
1 )
oApp:Exec()
RETURN nExitCode
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)