Author Topic: Need help with win32API edit window + rgss player  (Read 6075 times)

Offline newold

  • Trained Member
  • *
  • Posts: 30
  • LV: 12
    • View Profile
Need help with win32API edit window + rgss player
« on: September 05, 2014, 08: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?

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19961
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Need help with win32API edit window + rgss player
« Reply #1 on: September 05, 2014, 09:01:04 PM »
I think you might have to use RegisterClass or RegisterClassEx first to make this work properly.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline ForeverZer0

  • CP's Pedophile
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3246
  • LV: 294
  • Gender: Male
  • Remember you are unique, just like everyone else.
    • View Profile
Re: Need help with win32API edit window + rgss player
« Reply #2 on: September 05, 2014, 10: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.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Offline newold

  • Trained Member
  • *
  • Posts: 30
  • LV: 12
    • View Profile
Re: Need help with win32API edit window + rgss player
« Reply #3 on: September 05, 2014, 10:13:22 PM »
I think you might have to use RegisterClass or RegisterClassEx first to make this work properly.

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

Code: [Select]
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: ForeverZer0
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.

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)