Calling Windows API functions involving windows? 
Author Message
 Calling Windows API functions involving windows?

   I've just finished browsing the Web, featuring visits to Icetips and
TopSpeed and could not find how to incorporate Windows API calls that
involve window functions that require the HWND parameter.  I know, for
example, that the SetFocus function is prototyped as:

   SetFocus(HWND),HWND,Pascal

   But, how can I know what value to use as HWND for a window that has
been opened with Clarion's OPEN command?
   I might as well explain what I'm trying to do.  I want to make a
Clarion program become the active window, as a reminder program might do.
No matter where the user might be, I want my window to become active,
unser certain conditions, and interrupt the user.  Of course, I'm in
Windows 95.  I don't think a Windows 3.* DOS shell could be interrupted,
could it?  Anyway, I found a window proprty that makes the window become
fullsize, but it doesn't become active.  I believe that a simple call to
the Windows API function, SetActiveWindow, would solve my problem.  Could
anyone offer me a snippet of code to point me in the right direction?

                                                        -Ray.

==============================================================================
Ray Goudie                      Montreal, Quebec, Canada.




Sat, 07 Aug 1999 03:00:00 GMT  
 Calling Windows API functions involving windows?

Quote:

>   SetFocus(HWND),HWND,PASCAL

>   But, how can I know what value to use as HWND for a window that has
>been opened with Clarion's OPEN command?

        Add in Global Embeds, Data section:
        MyHandle        HANDLE

        Now, let's suppose your Window label is 'MyWindow'

        Add an embed (After opening the window):

        MyHandle = MyWindow{prop:handle} ! get the handle

        Now you can use the function the way you want:

        dummy# = SetFocus(MyHandle)

        The above should work if compiled to 16 bits.

Markku



Sat, 07 Aug 1999 03:00:00 GMT  
 Calling Windows API functions involving windows?

Hello!


Date: 18 Feb 1997 01:00:42 GMT

Quote:
>    I've just finished browsing the Web, featuring visits to Icetips and
> TopSpeed and could not find how to incorporate Windows API calls that
> involve window functions that require the HWND parameter.  I know, for
> example, that the SetFocus function is prototyped as:

>    SetFocus(HWND),HWND,PASCAL

>    But, how can I know what value to use as HWND for a window that has
> been opened with Clarion's OPEN command?

See the "Undeclared Properties" section of the LRM and online help.
PROP:Handle is that you need in.

Alexey Solovjev




Sun, 08 Aug 1999 03:00:00 GMT  
 Calling Windows API functions involving windows?

Hi Ray,


Quote:
>involve window functions that require the HWND parameter.  I know, for
>example, that the SetFocus function is prototyped as:
>   SetFocus(HWND),HWND,PASCAL
>   But, how can I know what value to use as HWND for a window that has
>been opened with Clarion's OPEN command?
>could it?  Anyway, I found a window proprty that makes the window become
>fullsize, but it doesn't become active.  I believe that a simple call to
>the Windows API function, SetActiveWindow, would solve my problem.  Could
>anyone offer me a snippet of code to point me in the right direction?

!Global map
MODULE('WIN16.LIB')
  SetActiveWindow(USHORT),USHORT,PASCAL
END

!Variables
PrevActiveWindow  USHORT
ActiveWindow      USHORT

MyWindow   WINDOW,...
           ...
           END

CODE
  ActiveWindow = MyWindow{PROP:Handle}
  PrevActiveWindow = SetActiveWindow(ActiveWindow)

This should activate your window.  I'm not sure if you need to call
SetFocus too when you have activated it...  Both functions return the
last window to have input focus, so you might have a "Return to your
work" button where you simply reverse this:

ActiveWindow = SetActiveWindow(PrevActiveWindow)

and the user has got his window activated again.

Best regards,

+------------------------------------------------------------------+
|                     Arnor Baldvinsson                            |
| Mail address:  Naestrupvej 44, Sjorring, 7700 Thisted, Denmark   |
|------------------------------------------------------------------|
| e-mail:                     Web sites:                           |


+------------------------------------------------------------------+



Sun, 08 Aug 1999 03:00:00 GMT  
 Calling Windows API functions involving windows?

Quote:

> Anyway, I found a window proprty that makes the window become
> fullsize, but it doesn't become active.  I believe that a simple call to
> the Windows API function, SetActiveWindow, would solve my problem.  Could
> anyone offer me a snippet of code to point me in the right direction?

You can use a property to make your window active.  It's:

Window{PROP:Active}=1

Giv'r a go,
Harg



Sun, 08 Aug 1999 03:00:00 GMT  
 Calling Windows API functions involving windows?

Actually it is really very easy to do withouth the hwnd so long as
your app is iconised, when you want to gain focus you simply Set
0{prop:Iconize} = False and up it pops - right on top of whatever you
are doing.  Works beautifully in Win 3.11.


Quote:

>   I've just finished browsing the Web, featuring visits to Icetips and
>TopSpeed and could not find how to incorporate Windows API calls that
>involve window functions that require the HWND parameter.  I know, for
>example, that the SetFocus function is prototyped as:

>   SetFocus(HWND),HWND,PASCAL

>   But, how can I know what value to use as HWND for a window that has
>been opened with Clarion's OPEN command?
>   I might as well explain what I'm trying to do.  I want to make a
>Clarion program become the active window, as a reminder program might do.
>No matter where the user might be, I want my window to become active,
>unser certain conditions, and interrupt the user.  Of course, I'm in
>Windows 95.  I don't think a Windows 3.* DOS shell could be interrupted,
>could it?  Anyway, I found a window proprty that makes the window become
>fullsize, but it doesn't become active.  I believe that a simple call to
>the Windows API function, SetActiveWindow, would solve my problem.  Could
>anyone offer me a snippet of code to point me in the right direction?

>                                                    -Ray.

>==============================================================================
>Ray Goudie                  Montreal, Quebec, Canada.



    Geoff Bomford
     ComForMark
  Sydney, Australia


Mon, 09 Aug 1999 03:00:00 GMT  
 Calling Windows API functions involving windows?

Quote:

>Actually it is really very easy to do withouth the hwnd so long as
>your app is iconised, when you want to gain focus you simply Set
>0{prop:Iconize} = False and up it pops - right on top of whatever you
>are doing.  Works beautifully in Win 3.11.

Actully, I was only trying properties alone.  If I would have tried both:

        Window{PROP:Active} = 1
        Window{PROP:Iconize} = 0

then, I would have found that this works for what I wanted to do, which
is interrupt the user and display my window on top of the screen.

                                                        -Ray.

--
==============================================================================
Ray Goudie                      Montreal, Quebec, Canada.




Sat, 14 Aug 1999 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. some clear examples for FFI call to a Windows api function in Franz Allegro for Windows

2. Calling Win32 API functions with GNAT 3.09 on Windows 95

3. How to call a Windows API function from a TCL script

4. Calling Windows API functions

5. Windows API Function

6. Windows API Registry functions

7. Windows API - EnumPrinters Function

8. Help : Windows API wrapper functions for Clipper/FiveWin

9. Using windows API functions

10. Windows API calls and pbcc

11. Windows API calls

12. API-call for scheduling jobs after restart of windows

 

 
Powered by phpBB® Forum Software