Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Window -> SetWindowPos(...) -> No Effect.  (Read 2967 times)

0 Members and 1 Guest are viewing this topic.

Orezar

  • Newbie
  • *
  • Posts: 38
    • View Profile
Window -> SetWindowPos(...) -> No Effect.
« on: May 06, 2012, 11:47:39 am »
Hey,

I have a problem that makes me crazy, I'm testing a little bit arround with SFML and the Win API,
all works perfect, only one thing not. Setting the position of the Window after Creating him, don't
works, and I don't understand why...

Here my code:

Code: [Select]
//...

// Here positioning works.
HWND hwnd_Window = CreateWindow(L"SFML App", L"Alarm", WS_POPUP | WS_VISIBLE,
300, 400,
300, 200, NULL, NULL, Instance, NULL);
// Main View
HWND hwnd_View = CreateWindow(L"STATIC", NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS, 0, 0, 300, 200, hwnd_Window, NULL, Instance, NULL);

//
sf::RenderWindow App(hwnd_View);

// Set Framelimit on 3 fps
App.setFramerateLimit(3);

// ...

// The Window only Resize, but the Position don't change!
::MoveWindow(hwnd_Window, 200, 200, 100, 100, true);

// Change size
App.setSize(sf::Vector2u(100, 100));

// Change View settings!
App.setView(sf::View(sf::FloatRect(0, 0, 100, 100)));

// Again, only Resizing work, not positioning
::SetWindowPos(hwnd_Window, HWND_TOPMOST, 0, 600, 100, 100, SWP_FRAMECHANGED);


I hope someone can help me, because I'm getting crazy...

Thanks in Advance!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Window -> SetWindowPos(...) -> No Effect.
« Reply #1 on: May 06, 2012, 03:40:26 pm »
Does it work without the SFML specific code? Because it seems that it has nothing to do with SFML: you try to move the top-level window while the SFML window is just a child of it.
Laurent Gomila - SFML developer

Orezar

  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: Window -> SetWindowPos(...) -> No Effect.
« Reply #2 on: May 06, 2012, 06:50:17 pm »
This is too strange for my brain... now it works, and the only thing that I changed was that I
make the Window before Positioning invisible.. And this solved the problem...
I don't understand it...!?

But you are right, its maybe not a SFML problem...

Edit:
Lol, I delete for testing the code snippet that makes the Window Invisible, and it
was not the reason why it now works... this means that it works now without changing
code... mad world!

But anyway Thanks for answering!
« Last Edit: May 06, 2012, 06:54:04 pm by Orezar »

 

anything