Kiosk System

Share your advanced PureBasic knowledge/code with the community.
jack
Addict
Addict
Posts: 1336
Joined: Fri Apr 25, 2003 11:10 pm

Post 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:
epidemicz
User
User
Posts: 86
Joined: Thu Jan 22, 2009 8:05 am
Location: USA
Contact:

Post 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
somic
User
User
Posts: 66
Joined: Sun Jun 29, 2008 9:11 am
Location: Italy
Contact:

kiosk desktop capture

Post 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
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8425
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post 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.
BERESHEIT
somic
User
User
Posts: 66
Joined: Sun Jun 29, 2008 9:11 am
Location: Italy
Contact:

Post 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
Poshu
Enthusiast
Enthusiast
Posts: 459
Joined: Tue Jan 25, 2005 7:01 pm
Location: Canada

Post 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?
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Post 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?
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
jared
New User
New User
Posts: 2
Joined: Fri Jun 24, 2011 12:38 pm

Re: Kiosk System

Post 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 :(
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4636
Joined: Sun Apr 12, 2009 6:27 am

Re: Kiosk System

Post 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)

Egypt my love
jared
New User
New User
Posts: 2
Joined: Fri Jun 24, 2011 12:38 pm

Re: Kiosk System

Post 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)?
rudz
User
User
Posts: 35
Joined: Sun Mar 21, 2010 6:59 am
Location: Denmark
Contact:

Re: Kiosk System

Post by rudz »

Although old, this is still very useful :)
AMD FX-8350 @ ~4.8GHz | 8GB Corsair DDR3-SDRAM @ 1800Mhz | 7even Ult & Manjaro 0.8.7.1 | PB 5.3
Web: rudz.dk
Lite
User
User
Posts: 17
Joined: Fri Dec 21, 2012 7:50 am

Re: Kiosk System

Post 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
fryquez
Enthusiast
Enthusiast
Posts: 362
Joined: Mon Dec 21, 2015 8:12 pm

Re: Kiosk System

Post by fryquez »

Comment out the OpenWindow() line.
Lite
User
User
Posts: 17
Joined: Fri Dec 21, 2012 7:50 am

Re: Kiosk System

Post by Lite »

Thanks it works, but i need a window.
Solution ??

Lite
fryquez
Enthusiast
Enthusiast
Posts: 362
Joined: Mon Dec 21, 2015 8:12 pm

Re: Kiosk System

Post by fryquez »

Try a new thread that has no window.
Post Reply