InputBox really modal on all process [Resolved]

Just starting out? Need help? Post your questions and find answers here.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: InputBox really modal on all process [Resolved]

Post by srod »

lol. :lol:

Now that is a quality cheat! :D
I may look like a mule, but I'm not a complete ass.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: InputBox really modal on all process [Resolved]

Post by Kwai chang caine »

Hello RASHAD :D

I have do like you say to me, compile the code and run by shortcut
There are a splendid stringgadget in the middle of the screen with the exit button.
Bu when i move a window over the stringgadget, he disappear behind the window moved :(

He is strange this CROSOFT, asking to not loose focus on an application, is when even not, a so miraculous demand :?
ImageThe happiness is a road...
Not a destination
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4946
Joined: Sun Apr 12, 2009 6:27 am

Re: InputBox really modal on all process [Resolved]

Post by RASHAD »

Hi srod

KCC
Sorry KCC I just tested it with XP
It does not work
Be tuned
Egypt my love
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: InputBox really modal on all process [Resolved]

Post by Kwai chang caine »

No problem.....it's already good to have tried :wink:

I come back when i have finish my EEEPC waltz :lol:
ImageThe happiness is a road...
Not a destination
Flower
User
User
Posts: 22
Joined: Fri Jan 08, 2010 8:05 am
Location: United States

Re: InputBox really modal on all process [Resolved]

Post by Flower »

Code: Select all

      Define hCurrentDesktop.l, sNewDesktopName.s, hNewDesktop.l
      hCurrentDesktop = GetThreadDesktop_(GetCurrentThreadId_())
      sNewDesktopName = Hex(Random(10000000))
      hNewDesktop = CreateDesktop_(sNewDesktopName, #Null, #Null, 0, #GENERIC_ALL, #Null)
      
      If (hNewDesktop <> #INVALID_HANDLE_VALUE)
            
            ;********************
            ;New desktop successfully created
            ;********************
            SetThreadDesktop_(hNewDesktop)
            
            Define Info.STARTUPINFO
            ClearStructure(@Info, STARTUPINFO)
            Info\cb = SizeOf(STARTUPINFO)
            Info\dwFlags = #STARTF_USESHOWWINDOW
            Info\lpDesktop = @sNewDesktopName
            Info\wShowWindow = #SW_SHOW
            
            Define ProcessInfo.PROCESS_INFORMATION
            ClearStructure(@ProcessInfo, PROCESS_INFORMATION)
            
            If (CreateProcess_(@FileName, 0, 0, 0, 0, #NORMAL_PRIORITY_CLASS, 0, 0, @Info, @ProcessInfo))
                  
                  ;********************
                  ;Process created, switch current desktop
                  ;********************
                  If (ProcessInfo\hThread)
                        CloseHandle_(ProcessInfo\hThread)
                  EndIf
                  SwitchDesktop_(hNewDesktop)
                  ;********************
                  ;Wait for process to exit
                  ;********************
                  WaitForSingleObject_(ProcessInfo\hProcess, #INFINITE)
                  CloseHandle_(ProcessInfo\hProcess)
            EndIf
            
            ;********************
            ;Switch to original desktop
            ;********************
            SwitchDesktop_(hCurrentDesktop)
            CloseDesktop_(hNewDesktop)
      EndIf
      
This is a code snippet from my project.
You don't have to create another process though... you could just switch the current process to the new desktop.
Registered PureBasic user since 4.50
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: InputBox really modal on all process [Resolved]

Post by Kwai chang caine »

Hello FLOWER

Thanks for your code but, you surely don't know KCC, .....the programmer who coding slower that his shadow :oops:

How i can use your skyrocket :P
I have try to launch it with match...but he don't do anything :oops:
ImageThe happiness is a road...
Not a destination
Flower
User
User
Posts: 22
Joined: Fri Jan 08, 2010 8:05 am
Location: United States

Re: InputBox really modal on all process [Resolved]

Post by Flower »

Kwaï chang caïne wrote:Hello FLOWER

Thanks for your code but, you surely don't know KCC, .....the programmer who coding slower that his shadow :oops:

How i can use your skyrocket :P
I have try to launch it with match...but he don't do anything :oops:
That's right, it doesn't do anything until you tell it to... :wink:
For example, you could add

Code: Select all

Define FileName.s
FileName = "C:\Windows\System32\Notepad.exe"
just before the first "If" (Assume your system is installed on drive C), and you'll see the magic...
Registered PureBasic user since 4.50
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4946
Joined: Sun Apr 12, 2009 6:27 am

Re: InputBox really modal on all process [Resolved]

Post by RASHAD »

Hi again

Code: Select all

Global x,y,W,H

ExamineDesktops()

Procedure Fake(Image,x,y,WW,WH) 
   hImage = CreateImage(Image,WW,WH) 
   hDC = StartDrawing(ImageOutput(Image)) 
            BitBlt_(hDC,0,0,WW,WH,GetDC_(GetDesktopWindow_()),x,y,#SRCCOPY) 
         StopDrawing() 
   ProcedureReturn hImage 
 EndProcedure
 
WW = DesktopWidth(0)
WH = DesktopHeight(0)
OpenWindow(0,0,0,W,H,"",#PB_Window_Invisible|#PB_Window_BorderLess) 
   
ImageGadget(0,0,0,W,H,Fake(1,0,0,WW,WH))
  StringGadget(1,WW/2-100,WH/2-12, 200,24,"",#ES_CENTER)
  ButtonGadget(2,WW/2-40,WH/2+30,80,22,"Exit")
DisableGadget(0,1)
  
SetWindowState(0,#PB_Window_Maximize)

Repeat
  Select WaitWindowEvent()
       
      Case #PB_Event_Gadget
          Select EventGadget()
            Case 1
              
            Case 2
              Q =1
              CloseWindow(0)
              
          EndSelect
  EndSelect 
Until Q =1

Egypt my love
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: InputBox really modal on all process [Resolved]

Post by Kwai chang caine »

Thanks a lot at you two !!! 8)

You are two angels !!!!
I try to put this jewel in my code now :wink:

@FLOWER
I have try your code and you have right....my desktop disappears and i have the mouse pointer into the notepad :shock:
I have search all my icons behind my screen ..turn it and no icons too :shock: :shock:
So i have close the notepad and all the littles icons come back in my screen 8)

You are a magician but without rabbit and hat :mrgreen:

@RASHAD
Youuu !!! you are malicious :lol: :lol:
You have take a photo of my screen and put on, a stringgadget :lol:

So i believe clic on my desktop...and i clic in the air 8)

Kcc have add important line at your "malicious" code :mrgreen: :oops: :oops:

Code: Select all

SetActiveGadget(1)
Very "intelligent" KCC :oops: :oops:

Again thank at you two, and for your hard work,....
I give you this,...... directly of my french heart :mrgreen:

Image

I wish you a very good day 8)
ImageThe happiness is a road...
Not a destination
Flower
User
User
Posts: 22
Joined: Fri Jan 08, 2010 8:05 am
Location: United States

Re: InputBox really modal on all process [Resolved]

Post by Flower »

Kwaï chang caïne wrote:
@FLOWER
I have try your code and you have right....my desktop disappears and i have the mouse pointer into the notepad :shock:
I have search all my icons behind my screen ..turn it and no icons too :shock: :shock:
So i have close the notepad and all the littles icons come back in my screen 8)

You are a magician but without rabbit and hat :mrgreen:

Actually you could first take a screenshot, then creating a layered window showing that screenshot on the new desktop, and set it as the bottom-most window.
That's pretty much how User Account Control in Vista and 7 did it. :wink:
A new desktop ensure no task manager or other top-most window will disrupt your program :mrgreen:

For just to switch the current desktop and show a window, you could comment out some of the code and add your window procedure.
Registered PureBasic user since 4.50
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: InputBox really modal on all process [Resolved]

Post by Kwai chang caine »

Again thanks FLOWER...i "torture" your code like you have say, for making my try :lol:
ImageThe happiness is a road...
Not a destination
Post Reply