Chaos Project

Game Development => Sea of Code => Topic started by: newold on September 05, 2014, 02:48:05 pm

Title: Need help with win32API edit window + rgss player
Post by: newold on September 05, 2014, 02:48:05 pm
I am trying do a textbox with win32API with this code in rpg maker

#___________________________________________________________________________
ini = Win32API.new('kernel32', 'GetPrivateProfileString','PPPPLP', 'L')
@title = "\0" * 256
ini.call('Game', 'Title', '', @title, 256, '.\\Game.ini')
@title.delete!("\0")
# Getel hwnd from rgss player
@hwnd = Win32API.new('user32', 'FindWindowA', 'PP', 'L').call('RGSS Player', @title)

@create_window = Win32API.new('user32','CreateWindowEx','lpplllllllll','l')
# Build textbox
#style = WS_CHILD|WS_CLIPCHILDREN|WS_VSCROLL|ES_MULTILINE
style = 0x40000000|0x02000000|0x00200000|0x0004
x, y, w, h = 100, 100, 160, 120
@script_window = @create_window.call(0, 'Edit', '', style, x, y, w,h, @hwnd, 0, 0, 0)
#___________________________________________________________________________

i want create the window edit as child of parent window (rgss player). With that code i get create de window as chlid but it appear behind of the parent window. If you put de mouse over edit window it blink, shown by an instant and sets again behind the parent window (the edit window work but it is behind the parent window).

How i get that my child window set over the parent window and dont blink or get behind again?
Title: Re: Need help with win32API edit window + rgss player
Post by: Blizzard on September 05, 2014, 03:01:04 pm
I think you might have to use RegisterClass (http://msdn.microsoft.com/en-us/library/windows/desktop/ms633586(v=vs.85).aspx) or RegisterClassEx (http://msdn.microsoft.com/en-us/library/windows/desktop/ms633587(v=vs.85).aspx) first to make this work properly.
Title: Re: Need help with win32API edit window + rgss player
Post by: ForeverZer0 on September 05, 2014, 04:04:03 pm
You can take a look at what I did here.

http://forum.chaos-project.com/index.php/topic,7829.0.html

Might help you figure out your problem.
Title: Re: Need help with win32API edit window + rgss player
Post by: newold on September 05, 2014, 04:13:22 pm
Quote from: Blizzard on September 05, 2014, 03:01:04 pm
I think you might have to use RegisterClass (http://msdn.microsoft.com/en-us/library/windows/desktop/ms633586(v=vs.85).aspx) or RegisterClassEx (http://msdn.microsoft.com/en-us/library/windows/desktop/ms633587(v=vs.85).aspx) first to make this work properly.


i dont know what is the code to create a class window with rgss, i did this:

newClass = Struct.new(:cbSize,:style,:lpfnWndProc,:cbClsExtra,:cbWndExtra,
   :hInstance,:hIcon,:hCursor,:hbrBackground,:lpszMenuName,:lpszClassName,
   :hIconSm)
   
 wndclass = newClass.new

 wndclass.cbSize = wndclass.size
 wndclass.style = 0
 wndclass.lpfnWndProc = 0
 wndclass.cbClsExtra = 0
 wndclass.cbWndExtra = 0
 wndclass.hInstance = nil
 wndclass.hIcon = nil
 wndclass.hCursor = nil
 wndclass.hbrBackground = 5 # COLOR_WINDOW
 wndclass.lpszMenuName = nil
 wndclass.lpszClassName = "testclass"
 wndclass.hIconSm = nil

registerClass = Win32API.new('user32','RegisterClass','i','i')
aTom = registerClass.call(??????????)


i dont know how send wndclass to registerClass.call()




Quote from: ForeverZer0You can take a look at what I did here.

http://forum.chaos-project.com/index.php/topic,7829.0.html

Might help you figure out your problem.


Your window dont is child from parent window, it work but i want my window be a child from parent (if you move parent window, child window move too)