fbpx
Welcome, Guest
Username: Password: Remember me
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!
  • Page:
  • 1
  • 2

TOPIC:

Let's get this started 15 Nov 2018 13:53 #6834

  • ThomasVenus's Avatar

  • ThomasVenus

  • Topic Author


  • Posts: 9
  • 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.

    Let's get this started 15 Nov 2018 15:34 #6835

  • FFF's Avatar

  • FFF


  • Posts: 976
  • Thomas,
    System.Diagnostics.Process.Start( "C:\Program Files\Mozilla Firefox\firefox.exe", "google.com") opens Google.
    etc.

    Karl
    Regards
    Karl (X# 2.5b; Xide 1.25; W8.1/64 German)

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

    Let's get this started 15 Nov 2018 17:28 #6837

  • Chris's Avatar

  • Chris


  • Posts: 2039
  • 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.

    Let's get this started 15 Nov 2018 17:30 #6838

  • Chris's Avatar

  • Chris


  • Posts: 2039
  • 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.

    Let's get this started 15 Nov 2018 19:31 #6840

  • FFF's Avatar

  • FFF


  • Posts: 976
  • 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
    Regards
    Karl (X# 2.5b; Xide 1.25; W8.1/64 German)

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

    Let's get this started 15 Nov 2018 19:54 #6841

  • SHirsch's Avatar

  • SHirsch


  • Posts: 168
  • 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.

    Let's get this started 15 Nov 2018 22:24 #6843

  • lumberjack's Avatar

  • lumberjack


  • Posts: 687
  • 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.

    Let's get this started 15 Nov 2018 22:31 #6844

  • lumberjack's Avatar

  • lumberjack


  • Posts: 687
  • 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.

    Let's get this started 15 Nov 2018 23:03 #6847

  • Chris's Avatar

  • Chris


  • Posts: 2039
  • 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.

    Let's get this started 15 Nov 2018 23:13 #6848

  • FFF's Avatar

  • FFF


  • Posts: 976
  • 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
    Regards
    Karl (X# 2.5b; Xide 1.25; W8.1/64 German)

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

    Last edit: by FFF. Reason: formatting

    Let's get this started 15 Nov 2018 23:55 #6849

  • Chris's Avatar

  • Chris


  • Posts: 2039
  • 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.

    Let's get this started 16 Nov 2018 00:25 #6850

  • TimothyS's Avatar

  • TimothyS


  • Posts: 41
  • 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.

    Let's get this started 16 Nov 2018 09:22 #6851

  • FFF's Avatar

  • FFF


  • Posts: 976
  • Followed the compiler's advice ;)
    Indeed, moving out of Start all ok
    Glat to be of some help.

    Karl
    Regards
    Karl (X# 2.5b; Xide 1.25; W8.1/64 German)

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

    Let's get this started 16 Nov 2018 09:45 #6852

  • ThomasVenus's Avatar

  • ThomasVenus

  • Topic Author


  • Posts: 9
  • 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.

    Let's get this started 16 Nov 2018 13:05 #6853

  • robert's Avatar

  • robert


  • Posts: 1793
  • 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

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

    Let's get this started 16 Nov 2018 13:14 #6854

  • ThomasVenus's Avatar

  • ThomasVenus

  • Topic Author


  • Posts: 9
  • 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.

    Let's get this started 16 Nov 2018 13:42 #6855

  • robert's Avatar

  • robert


  • Posts: 1793
  • 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

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

    Let's get this started 16 Nov 2018 14:34 #6856

  • Karl-Heinz's Avatar

  • Karl-Heinz


  • Posts: 585
  • Hi Robert,

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

    regards
    Karl-Heinz

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

    Let's get this started 16 Nov 2018 16:39 #6858

  • Chris's Avatar

  • Chris


  • Posts: 2039
  • 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.

    Let's get this started 16 Nov 2018 16:51 #6859

  • wriedmann's Avatar

  • wriedmann


  • Posts: 2300
  • 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
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

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

    • Page:
    • 1
    • 2