Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
For example: http://joescomputer:17072
-Kirby
; SnapShotServer.wbt ; ; This serves up (via HTTP) a gif image of whats on the screen ; portnumber = 17072 ;;;based on the LISTENER script from the hlp file AddExtender("wwwsk34i.dll") ObjectClrOption('useany', 'System') ObjectClrOption('useany', 'System.Drawing') IntControl(12,1+4,0,0,0) ; exit without complaint ; temp files used for snapshot tf1 = StrCat(Environment("TEMP"), "\SnapShotServer.bmp") tf2 = StrCat(Environment("TEMP"), "\SnapShotServer.gif") title = "SnapShotServer" BoxesUp("650 800 999 950",@normal) BoxTitle(title) BoxButtonDraw(1,1,"Exit","000 500 999 999") BoxDataTag(1,"AAA") listensocket=sOpen() sListen(listensocket,portnumber) Served=0 While 1 datasocket=sAccept(listensocket,@false) ; NO Block for a connection If datasocket GoSub ProcessRequest Else err = wxGetLastErr() If err != @SERRNOCONN sClose(listenSocket) Message("Socket Error %err%",wxGetErrDesc(err)) Exit EndIf EndIf TimeDelay(1.0) If BoxButtonStat(1,1) Then Goto cancel EndWhile Exit :cancel sClose(listenSocket) BoxText("Normal exit.") TimeDelay(0.5) Exit :ProcessRequest rqst1=sRecvLine(datasocket,250) If StrLen(rqst1) == 0 || StrIndexNC(rqst1,"favicon",1,0) sClose(datasocket) Return EndIf BoxText("working...":rqst1) TimeDelay(0.4) Served=Served+1 GoSub dosnap tf2s = FileSize(tf2) bb = BinaryAlloc(tf2s) BinaryRead(bb,tf2) bbh = IntControl(42,bb,0,0,0) guy = wxGetInfo(2,datasocket) now = TimeFormat(TimeYmdHms(),"ddd, dd MMM yyyy HH:mm:ss"):" GMT" sSendLine(datasocket,"HTTP/1.1 200 OK") sSendLine(datasocket,StrCat("Date: ",now)) sSendLine(datasocket,StrCat("Expires: ",now)) sSendLine(datasocket,StrCat("Content-Type: ","image/gif")) sSendLine(datasocket,StrCat("Content-Length: ",tf2s)) sSendLine(datasocket,"") sSendBinary(datasocket, bbh, tf2s) sClose(datasocket) BoxDataClear(1,"AAA") BoxText(StrCat("served: ", served, " last: ", guy," at: ",now)) BoxTitle(StrCat(title," ", served)) FileDelete(tf2) Return :dosnap If FileExist(tf1) FileDelete(tf1) EndIf ;Takes a bitmap snapshot of the screen and pastes it to the clipboard. Snapshot(0) ;returns the size of buffer needed for a subsequent BinaryAlloc, ;but doesn't attempt to place the contents of clipboard into a buffer size=BinaryClipGet(0,8) ;allocates a data buffer bb=BinaryAlloc(size) ;read file format type CF_DIB BinaryClipGet(bb,8) ; need to add first 14 bytes to make it ; a BMP file format bmpdatasize=14 bb2=BinaryAlloc(size + bmpdatasize) ;The characters identifying the bitmap.'BM' BinaryPokeStr(bb2, 0, "BM") ;Complete file size in bytes. BinaryPoke4(bb2,2,size + bmpdatasize) ;Reserved BinaryPoke4(bb2,6,0) ;Data offset headersize=BinaryPeek4(bb,0) dataoffset = headersize + bmpdatasize BinaryPoke4(bb2,10,dataoffset) BinaryCopy(bb2,bmpdatasize,bb,0,size) BinaryWrite(bb2,tf1) BinaryFree(bb) BinaryFree(bb2) ;;Replace this old code ;;ImgConvert(tf1,tf2) ; convert bmp to gif ;; with this: oBitmap = ObjectClrNew('System.Drawing.Bitmap',tf1) GifGuid = 'B96B3CB0-0728-11D3-9D7B-0000F81EF32E' ; Magic Number for GIF oGifGuid = ObjectClrNew('System.Guid', GifGuid) ; turn into guid object oGifFormat = ObjectClrNew('System.Drawing.Imaging.ImageFormat',oGifGuid) oBitmap.Save(tf2, oGifFormat.Gif) oBitmap.Dispose() Return
Article ID: W17238
File Created: 2020:09:17:13:17:02
Last Updated: 2020:09:17:13:17:02