fbpx
× Welcome to the XSharp forum!

Tell us and our members who you are, what you like and why you became a member of this site.
We welcome all new members and hope to see you around a lot!

Let's get this started

More
2 months 3 days ago #1 by Thomas Venus
Let's get this started was created by Thomas Venus
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

Please Log in or Create an account to join the conversation.

More
2 months 3 days ago #2 by Karl Faller
Replied by Karl Faller on topic Let's get this started
Thomas,
System.Diagnostics.Process.Start( "C:\Program Files\Mozilla Firefox\firefox.exe", "google.com") opens Google.
etc.

Karl

Please Log in or Create an account to join the conversation.

More
2 months 3 days ago #3 by Chris Pyrgas
Replied by Chris Pyrgas on topic 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

XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

More
2 months 3 days ago #4 by Chris Pyrgas
Replied by Chris Pyrgas on topic 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

XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

More
2 months 3 days ago #5 by Karl Faller
Replied by Karl Faller on topic 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

Please Log in or Create an account to join the conversation.

More
2 months 3 days ago #6 by Stefan Hirsch
Replied by Stefan Hirsch on topic Let's get this started
Hi Thomas,

For VO this may help (not tested in X# yet):
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()

In your case 'sUser' and 'sPsw' could be empty. Some error handling should be implemented ( I removed this for better readability).


Stefan

Please Log in or Create an account to join the conversation.

More
2 months 3 days ago #7 by Johan Nel
Replied by Johan Nel on topic Let's get this started
Hi Thomas,

ThomasVenus 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.

Please have a look at System.Net.WebClient class of .net
Think you will find everything there that you need.
Regards,

______________________
Johan Nel
George, South Africa

Please Log in or Create an account to join the conversation.

More
2 months 3 days ago #8 by Johan Nel
Replied by Johan Nel on topic 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:
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)
HTH,

______________________
Johan Nel
George, South Africa

Please Log in or Create an account to join the conversation.

More
2 months 3 days ago #9 by Chris Pyrgas
Replied by Chris Pyrgas on topic Let's get this started
Hi Karl,

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


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?

XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

More
2 months 3 days ago - 2 months 3 days ago #10 by Karl Faller
Replied by Karl Faller on topic Let's get this started
New Vo-Mdi Sample, then:
#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
Last edit: 2 months 3 days ago by Karl Faller. Reason: formatting

Please Log in or Create an account to join the conversation.

More
2 months 3 days ago #11 by Chris Pyrgas
Replied by Chris Pyrgas on topic Let's get this started
Thanks Karl, it was the String2Psz() that caused the problem, I had not used that in my test. Problem happens only in Start() function, so you can put the code in a separate function and it will work ok, but of course it is still a bug, thanks for the sample!

XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

More
2 months 3 days ago #12 by Timothy Shea
Replied by Timothy Shea on topic Let's get this started
Hi Thomas,

Try Googling:
c# get image ip camera

Loads of code for what you want. It is C#. However much if not all can be easily converted to XSharp. Also, you might want to create a C# assembly and reference it in your XSharp app.

I started off trying to convert VO code line by line only to realise it is much better to see how it is done in DotNet. As there are over 5,000 classes in DotNet, chances are pretty good that it will have what you want. Also, it is managed code and will have minimal bugs.

Regards,
Tim

Please Log in or Create an account to join the conversation.

More
2 months 2 days ago #13 by Karl Faller
Replied by Karl Faller on topic Let's get this started
Followed the compiler's advice ;)
Indeed, moving out of Start all ok
Glat to be of some help.

Karl

Please Log in or Create an account to join the conversation.

More
2 months 2 days ago #14 by Thomas Venus
Replied by Thomas Venus on topic Let's get this started
Thank you very much to all of you.
I am really impressed by the overwhelming support in this community.
Really looking forward to be part of this community.
Hopefully some day also I will be able to help someone with my advice.
Thomas

Please Log in or Create an account to join the conversation.

More
2 months 2 days ago #15 by Robert van der Hulst
Replied by Robert van der Hulst on topic Let's get this started
Thomas,
If you want to keep this community alive, then there is one thing that you should do: make sure the product stays alive by signing up for the FOX program. And we have just announced a special Black Friday offer, so you know what to do <g>.

Robert

XSharp Development Team
The Netherlands
This email address is being protected from spambots. You need JavaScript enabled to view it.

Please Log in or Create an account to join the conversation.

More
2 months 2 days ago #16 by Thomas Venus
Replied by Thomas Venus on topic Let's get this started
Hi Robert,
I really appreciate all the work you and all of the dev-team are doing.
That's why I am already a Fox-subscriber. Since the devcon this year in Cologne. <g>
Keep up the excellent work you are doing
Thomas

Please Log in or Create an account to join the conversation.

More
2 months 2 days ago #17 by Robert van der Hulst
Replied by Robert van der Hulst on topic Let's get this started
Stupid me, I should have checked.
We have reached the stage where I can't remember all of the subscribers' names anymore. Maybe if you had uploaded a picture to your profile I would have recognized you ;).
Anyway there are others that have no subscription.
Those of you who are lurking: now is the time !

Robert

XSharp Development Team
The Netherlands
This email address is being protected from spambots. You need JavaScript enabled to view it.

Please Log in or Create an account to join the conversation.

More
2 months 2 days ago #18 by Karl-Heinz Rauscher
Replied by Karl-Heinz Rauscher on topic Let's get this started
Hi Robert,

ok, i´m surrounded - i give up :-)

regards
Karl-Heinz

Please Log in or Create an account to join the conversation.

More
2 months 2 days ago #19 by Chris Pyrgas
Replied by Chris Pyrgas on topic Let's get this started

Karl-Heinz wrote: Hi Robert,

ok, i´m surrounded - i give up :-)

regards
Karl-Heinz


Many thanks! :)
To you and to everybody else who helps financially and otherwise this project! We are very enthusiastic about it (like most of you guys apparently are, too!) and we put a lot of effort on it to make it a success, but being able to pay the bills helps, too :)

Chris

XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

More
2 months 2 days ago #20 by Wolfgang Riedmann
Replied by Wolfgang Riedmann on topic Let's get this started
Hi Chris,

let me add my 2 Cents too: the investment of money and time into X# was one of my best investments.
We have a perspective for your VO programs in a foreseable future, and now I'm working a lot in X#, mostly building new programs or enhancing my VO applications with X# modules. Before of the years end all my VO programs that are generating invoices will be using a X# module to send them electronically as requested by the Italian laws starting with 2019. With X# it was relatively easy to build this module - with VO it was nearly impossible.

For me and a lot of other people it is very important that the X# project can go forward and survive in the long rung, but we should not forget that also the X# people needs to eat, and with our money for the FoX program we can make sure that the project survives.

Wolfgang

Please Log in or Create an account to join the conversation.