Author Topic: SetWindowPos not working  (Read 2266 times)

greco558

  • Regular Member
  • *
  • Posts: 17
SetWindowPos not working
« on: August 01, 2016, 12:19:52 PM »
 I recently updated one of my programs that uses SetWindowPos , but it no longer positions the window . I am using easycode 1.07.0.0008. The pervious version of easycode would assembly the program OK.

Thanks for any help with problem.

jj2007

  • Member
  • *****
  • Posts: 7666
  • Assembler is fun ;-)
    • MasmBasic
Re: SetWindowPos not working
« Reply #1 on: August 01, 2016, 04:11:29 PM »
If it assembles, then it's not the fault of EasyCode. But without seeing your complete code, it's impossible to give a diagnosis.

Post your code. If it contains stuff you don't want to show, make a "reduced" version that still has the SetWindowPos problem.

Welcome to the forum :icon14:

greco558

  • Regular Member
  • *
  • Posts: 17
Re: SetWindowPos not working
« Reply #2 on: August 01, 2016, 09:12:11 PM »
 Here is the complete easycode/masm32 program.
I made no changes to the program just re-compiled in easycode.
Previously the executable ran fine by placing the window in the upper right conner of screen but now it places window in middle of screen.
 Some of the programs listed in the menu bar of this program are other masm32 programs that i wrote to run from this one so clicking on them will do nothing and they will be grayed out.

Thanks for your help
John

jj2007

  • Member
  • *****
  • Posts: 7666
  • Assembler is fun ;-)
    • MasmBasic
Re: SetWindowPos not working
« Reply #3 on: August 01, 2016, 10:10:12 PM »
John,

I can't get it to run as Masm32 (I don't use EasyCode, sorry). And the exe seen from OllyDbg doesn't correspond to the Dialog1.asm file...

But the SetWindowPos should be working, it looks correct. My advice: insert an int 3 shortly before, and watch what's happening in the debugger.

greco558

  • Regular Member
  • *
  • Posts: 17
Re: SetWindowPos not working
« Reply #4 on: August 02, 2016, 01:38:41 AM »
Thanks, jj2007

It is something in easycode because I compiled using previous version 1.07.0.007 of easycode and it works.
Used new version 1.07.0.0008 to compile and SetWindowPos does not work.
It has to be something in EasyCode IDE when it compiles my code.

John


jj2007

  • Member
  • *****
  • Posts: 7666
  • Assembler is fun ;-)
    • MasmBasic
Re: SetWindowPos not working
« Reply #5 on: August 02, 2016, 02:23:47 AM »
Insert an int 3 before the SetWindowPos, then assemble it and post the exe here.

greco558

  • Regular Member
  • *
  • Posts: 17
Re: SetWindowPos not working
« Reply #6 on: August 02, 2016, 03:19:00 AM »
Here is exe with int 3 before SetWindowPos

jj2007

  • Member
  • *****
  • Posts: 7666
  • Assembler is fun ;-)
    • MasmBasic
Re: SetWindowPos not working
« Reply #7 on: August 02, 2016, 04:07:39 AM »
There is the culprit:
hWnd = 00A8036C, class = EC2RUNDIALOGBOXControl32, text = Control

SetWindowPos reports invalid window handle.

greco558

  • Regular Member
  • *
  • Posts: 17
Re: SetWindowPos not working
« Reply #8 on: August 02, 2016, 09:16:40 AM »
Thanks jj2007
I will have to see way the new versions of easycode is doing this the previous version works fine.

Best Regards
John

rsala

  • Moderator
  • Member
  • *****
  • Posts: 243
    • Easy Code
Re: SetWindowPos not working
« Reply #9 on: August 05, 2016, 05:50:01 PM »
Hi John,

You are right, there is something wrong with the last version of EC 1. I am trying to find the bug and fix it.

Sorry for the inconveniences!

Regards,

Ramon
EC coder

rsala

  • Moderator
  • Member
  • *****
  • Posts: 243
    • Easy Code
Re: SetWindowPos not working
« Reply #10 on: August 05, 2016, 06:08:12 PM »
Hi,

The bug has been found. I am going to fit it and release a new version. Meanwhile, remove the following code from the WM_CREATE message and put it in the ECM_AFTERCREATE:

    .ElseIf uMsg == ECM_AFTERCREATE
      ;get screen width and place program in upper right corner
      Invoke GetSystemMetrics, SM_CXSCREEN
      Sub Eax, 225
      Invoke SetWindowPos, hDlg, HWND_NOTOPMOST, Eax, 0, 0, 0, SWP_NOSIZE

Regards,

Ramon
EC coder

rsala

  • Moderator
  • Member
  • *****
  • Posts: 243
    • Easy Code
Re: SetWindowPos not working
« Reply #11 on: August 05, 2016, 07:40:36 PM »
Hi all,

A new version of Easy Code 1, fixing the move/size bug in the WM_CREATE message, has just been released. Please doenload it at:

http://www.easycode.cat/English/Download.htm

Regards,

Ramon
EC coder