1. Tom Peters
  2. PowerBuilder
  3. Thursday, 20 September 2018

Hello All!

I implemented GetForegroundWindow in my PB 2017 R3 application as follows:

Function ulong GetForegroundWindow( ) Library "USER32.DLL"

I call it, capturing the return into an unsignedlong.

This all works fine in the IDE (32 bit), but when I run the 64 bit EXE, GetForegroundWindow always returns 0.

Should I do something different?

Thanks,

Tom

Accepted Answer
René Ullrich Accepted Answer Pending Moderation
0
Votes
Undo

GetForegroundWindow returns HWND handle. I think this is a 64 bit value for 64 bit applications . Try using LongLong as return type.

Comment
Thanks!
  1. Tom Peters
  2. Monday, 24 September 2018
There are no comments made yet.
  1. Friday, 21 September 2018
  2. PowerBuilder
  3. # Permalink
Chris Pollach Accepted Answer Pending Moderation
0
Votes
Undo

Hi Tom;

   If a LongLong does not work, try using a return data type of  Longptr

HTH

Regards ... Chris

Comment
Hi Chris - LongLong did work, but I will make note of this for future API calls. Thanks!
  1. Tom Peters
  2. Wednesday, 26 September 2018
Thanks for the feedback Tom .. glad it now works! :-)



Tip: Use the Environment object class and check the "processbitness" property in your App's to know which flavour of GetForegroundWindow to use at run-time. ;-)
  1. Chris Pollach
  2. Wednesday, 26 September 2018
There are no comments made yet.
  1. Monday, 24 September 2018
  2. PowerBuilder
  3. # 1
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.