Page 2 of 3

Posted: Mon Feb 16, 2009 11:38 pm
by jack
I made the mistake the other day in running this, could not get out of it, had to turn the power off on my computer. :evil:

Posted: Thu Feb 19, 2009 5:33 pm
by epidemicz
lol ran this at work without thinking and had to reboot, lost a few mins of work too damnit.

other than that nicely done :D

kiosk desktop capture

Posted: Thu Aug 06, 2009 9:46 pm
by somic
Hi everyone,,

Does anyone know a way to capture a desktop (es secondary) while another one is active/shown (es primary)?

I've tryed bitblt, printscreen and printwindow without success.

Any hint?

Regards,

Somic

Posted: Sun Aug 09, 2009 5:32 pm
by netmaestro
I've never tried it, but after ExamineDesktops you'd get:

DesktopX(1)
DesktopY(1)
DesktopWidth(1)
DesktopHeight(1)

for the second desktop, right? Couldn't you plug these numbers into a BitBlt_() ? Seems it should work. I can't test as I have just the one.

Posted: Sun Aug 09, 2009 5:41 pm
by somic
Thank you for the reply.

I'll write the code and try it (at work, where I can have a second screen) and post the result.

Somic

Posted: Mon Aug 10, 2009 8:54 am
by Poshu
Even though there is no taskbar, i can't maximize the notepad windows: there is still a little space under it (where my taskbar is normally).

A second question: is there any way to interact with systray icon (using API or so) since they are invisible?

Posted: Mon Aug 10, 2009 12:21 pm
by mk-soft
I testet on XP-Home and the Test-Window is on Default-Desktop and i can“t close desktop 2. How to close desktop 2 or change desktop?

Re: Kiosk System

Posted: Fri Jun 24, 2011 12:45 pm
by jared
hello, sorry bumping that old thread.

But does anyone know how to get SetThreadDesktop working here?
It fails, so one stuck on the new desktop, without a way to close the window and return to the normal desktop :(

Re: Kiosk System

Posted: Sat Jun 25, 2011 11:05 am
by RASHAD
Hi jared
This is an old thread perhaps the author is not aware of it anymore

You can start from here
Press Esc to switch to the default desktop
Good luck

Code: Select all

#WINSTA_ALL  = #WINSTA_ACCESSCLIPBOARD | #WINSTA_ACCESSGLOBALATOMS | #WINSTA_CREATEDESKTOP | #WINSTA_ENUMDESKTOPS | #WINSTA_ENUMERATE | #WINSTA_EXITWINDOWS | #WINSTA_READATTRIBUTES | #WINSTA_READSCREEN | #WINSTA_WRITEATTRIBUTES | #DELETE | #READ_CONTROL | #WRITE_DAC | #WRITE_OWNER
#DESKTOP_ALL = #DESKTOP_READOBJECTS | #DESKTOP_CREATEWINDOW | #DESKTOP_CREATEMENU | #DESKTOP_HOOKCONTROL | #DESKTOP_JOURNALRECORD | #DESKTOP_JOURNALPLAYBACK | #DESKTOP_ENUMERATE | #DESKTOP_WRITEOBJECTS | #DESKTOP_SWITCHDESKTOP | #STANDARD_RIGHTS_REQUIRED

#UOI_NAME = $2
Global m_sDesktop.s,hDesk,hDesk_2
m_sDesktop = Space(128)

Global cmdline$
cmdline$="C:\WINDOWS\system32\notepad.exe"

Procedure.s GetDesktopName()
  Protected hDesktop, lR, lSize, sBuff.s, iPos
  hDefaultDesk = OpenInputDesktop_(0, #False, #DESKTOP_READOBJECTS)
  If hDefaultDesk
    lSize = (Len(m_sDesktop) + 1) * 2
    sBuff=Space(lSize+1)
    lR = GetUserObjectInformation_(hDefaultDesk, #UOI_NAME, @sBuff, lSize, @lSize)
    CloseHandle_(hDesktop)
  EndIf
  ProcedureReturn sBuff
EndProcedure

;hWinSta = OpenWindowStation_("WinSta0", 0, #WINSTA_ALL)

;hDefaultDesk = OpenDesktop_("Default", #DF_ALLOWOTHERACCOUNTHOOK, 0, #DESKTOP_SWITCHDESKTOP)
;Chk(hDefaultDesk, "Failed to open default desktop")

hDesk = CreateDesktop_("My Desktop 2", 0, 0, #DF_ALLOWOTHERACCOUNTHOOK, #DESKTOP_ALL, 0)
SetThreadDesktop_(hDesk) 
SwitchDesktop_(hDesk)



OpenWindow(1, 0, 0, 0, 0, "", #PB_Window_BorderLess )

m_sDesktop = GetDesktopName()

tSi.STARTUPINFO
tSi\lpTitle = @m_sDesktop
tSi\lpDesktop = @m_sDesktop
; 
; tPi.PROCESS_INFORMATION
; 
; 
Result = CreateProcess_(#NUL,@cmdline$,#NUL,#NUL,#False,0,#NUL,#NUL,@tSi,@tPi)

Repeat
Delay(1)
Until GetAsyncKeyState_(#VK_ESCAPE) & $8000 = 32768

;TerminateThread_(GetThreadDesktop_(GetCurrentThreadId_()), 0)

hDesk_d = OpenDesktop_("Default", 0, #False, #DESKTOP_SWITCHDESKTOP)
SwitchDesktop_(hDesk_d)
SetThreadDesktop_(hDesk_d)
;CloseDesktop_(hDesk)


Re: Kiosk System

Posted: Sat Jun 25, 2011 5:25 pm
by jared
Thank you, RASHAD, that works. :D

Still one thing i wonder about. why would a messagerequester display on the old desktop after using SetThreadDesktop_(hDesk) and SwitchDesktop_(hDesk)?

Re: Kiosk System

Posted: Wed Jan 08, 2014 8:10 am
by rudz
Although old, this is still very useful :)

Re: Kiosk System

Posted: Thu May 10, 2018 1:53 pm
by Lite
Hello

The code dont work with PB5.60, its hang. SetThreadDesktop_ give a error 170.
PB4.60 work nicely.
How can it solve ?

Lite

Re: Kiosk System

Posted: Thu May 10, 2018 2:31 pm
by fryquez
Comment out the OpenWindow() line.

Re: Kiosk System

Posted: Thu May 10, 2018 5:42 pm
by Lite
Thanks it works, but i need a window.
Solution ??

Lite

Re: Kiosk System

Posted: Thu May 10, 2018 6:44 pm
by fryquez
Try a new thread that has no window.