Why windows can't be refreshed correctly?

Just starting out? Need help? Post your questions and find answers here.
goomoo
User
User
Posts: 42
Joined: Sun Dec 05, 2004 9:25 am
Location: China
Contact:

Post by goomoo »

Sparkie,Thanks for your code.
I've modified a little to get more better, Now the Notepad's menu available and can focus to it normally .

But there is still a problem: when main window minimize then restore , sometimes the notepad's window can't be displayed correctly yet.

Code: Select all

RunProgram("notepad.exe") 
hWndNotepad=FindWindow_("Notepad",#Null) 
While hWndNotepad=0 
  Delay(100) 
  hWndNotepad=FindWindow_("Notepad",#Null) 
Wend 

hwndMain=OpenWindow(1,0,0,640,480,#PB_Window_ScreenCentered|#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget,"Containt Notepad") 
If hwndMain=0 
  End 
EndIf 
CreateGadgetList(hwndMain) 
hContainer=ContainerGadget(1,3,3,636,470,#PB_Container_Single) 
; --> Add #WS_CLIPCHILDREN to the ContainerGadget 
SetWindowLong_(hContainer, #GWL_STYLE, GetWindowLong_(hContainer, #GWL_STYLE) | #WS_CLIPCHILDREN) 
; --> Add #WS_CHILD to Notepad 
SetWindowLong_(hWndNotepad, #GWL_STYLE, GetWindowLong_(hWndNotepad, #GWL_STYLE) | #WS_CHILD ! #WS_POPUP) 
; --> Set the ContainerGadget as the parent 
; --> Remove WS_POPUP style, Now Notepad's menu available,and works better!
SetParent_(hWndNotepad,hContainer) 
; --> Position Notepad 
;SetWindowPos_(hWndNotepad, 0, 20, 20, 500, 400, 0) 

Repeat 
  event=WaitWindowEvent() 
Until event=#PB_Event_CloseWindow
Hello, Everyone.
Thanks for your help.
mr..vw
New User
New User
Posts: 3
Joined: Thu Nov 03, 2005 5:59 am

there are some thing wrong...

Post by mr..vw »

RunProgram("notepad.exe")
hWndNotepad=FindWindow_("Notepad",#Null)
While hWndNotepad=0
Delay(100)
hWndNotepad=FindWindow_("Notepad",#Null)
Wend

have you thinked when notepad.exe cann't be run normoly what thing wold happen ? dead! yes,your program would not be running .

Oh,my poor English ... 3Q !
---------------follow are chinese --- 以下为汉语 -----
注意到notopad.exe不能正常运行会发生什么事情吗?挂起,对是挂起.你的程序不会再往下走了。

英语不是母语太累了,谢谢...
Post Reply