PureBasic Forum
http://forums.purebasic.com/english/

OpenFileRequester() at any Size & Position [Windows]
http://forums.purebasic.com/english/viewtopic.php?f=12&t=75311
Page 1 of 1

Author:  RASHAD [ Tue May 12, 2020 2:53 pm ]
Post subject:  OpenFileRequester() at any Size & Position [Windows]

Hi
Tested with PB 5.72 x86 - Windows 10 2004 x64
Code:
Global Hook,hWnd,oldProc,x,y,w,h

Procedure ReqProc(hWnd, uMsg, wParam, lParam)
  Select uMsg     
    Case #WM_SIZE,#WM_MOVE,#WM_PAINT
      MoveWindow_(hWnd,x,y,w,h,1)     
     
    Case #WM_NCLBUTTONDOWN
      SetWindowLongPtr_(hWnd, #GWL_WNDPROC,0)   
     
  EndSelect
  ProcedureReturn CallWindowProc_(oldProc, hWnd, uMsg, wParam, lParam)
EndProcedure

Procedure HookCB ( uMsg , wParam , lParam)   
  Select uMsg
    Case #HCBT_ACTIVATE
      hWnd = wParam
      oldProc = SetWindowLongPtr_(hWnd, #GWL_WNDPROC, @ReqProc())
      UnhookWindowsHookEx_ (Hook)   
       
   EndSelect
   
   ProcedureReturn Result
EndProcedure

x = 100
y = 100
w = 800
h = 600
Hook = SetWindowsHookEx_ ( #WH_CBT, @ HookCB () , 0, GetCurrentThreadId_ ())

Pattern$ = "Text (*.txt)|*.txt;*.bat|PureBasic (*.pb)|*.pb|All files (*.*)|*.*"
Pattern = 0
File$ = OpenFileRequester("Please choose file to load", StandardFile$, Pattern$, Pattern)


Author:  Kwai chang caine [ Tue Jun 02, 2020 5:25 pm ]
Post subject:  Re: OpenFileRequester() at any Size & Position [Windows]

Again a great powerfull code of the great powerfull RASHAD :D
Thanks for sharing 8)

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/