Toon posts:

[Windows] Hoe applicatie 'always-on-top' starten?

Pagina: 1
Acties:

Verwijderd

Topicstarter
Ik wil vanuit een api-commando een Tiff document openen.
Nu heb ik weinig controle over die API-functies, dit is een standaardpakket en ik roep deze alleen aan met de actie ('open') en de naam van het bestand.
Nu wil ik de standaardviewer zo openen dat hij 'always-on-top' is, net zoals bv mogelijk met de Taskmanager.

Is er een ongedocumenteerd commando of parameter waarmee ik een applicatie 'always on top' kan openen? Of moet ik zelf een viewer in Visual Basic of zo gaan bouwen?

  • drZymo
  • Registratie: Augustus 2000
  • Laatst online: 09-08 22:22
Als je het met windows api calls wilt doen kan je het volgende doen :
code:
1
2
/* hWnd is de handle van de window die always on top moet */
SetWindowPos(hWnd, HWND_TOPMOST, NULL, NULL, NULL, NULL, SWP_NOMOVE | SWP_NOSIZE);

:P

ooh ja dit is wel in C maar in Basic is dit vrijwel hetzelfde.

"There are three stages in scientific discovery: first, people deny that it is true; then they deny that it is important; finally they credit the wrong person."


Verwijderd

Topicstarter
Op woensdag 13 februari 2002 16:16 schreef drZymo het volgende:
Als je het met windows api calls wilt doen kan je het volgende doen :
code:
1
2
/* hWnd is de handle van de window die always on top moet */
SetWindowPos(hWnd, HWND_TOPMOST, NULL, NULL, NULL, NULL, SWP_NOMOVE | SWP_NOSIZE);

:P

ooh ja dit is wel in C maar in Basic is dit vrijwel hetzelfde.
Slik. Dit ziet er toch een beetje uit alsof ik die API zelf moet gaan aanspreken (terwijl ik er zo'n mooie interface voor had liggen *D ).
Ik had meer gehoopt op een parameter /alwaysontop ofzo in de instellingen voor filetypes- en associaties :)
Ga wel even proberen of ik bovenstaande in kan bouwen.
Standaardoplossing is in PL/SQL :(

  • Crazy D
  • Registratie: Augustus 2000
  • Laatst online: 17:24

Crazy D

I think we should take a look.

Hoe laat je het document openen?
Uit m'n hoofd gezegt (ff geen zin om op te zoeken :P) heeft de ShellExecuteEx API een parameter om te bepalen hoe het programma getoont moet worden (SW_ constanten).

Exact expert nodig?


  • baskabas
  • Registratie: December 2000
  • Laatst online: 05-04 12:26
Ff uit de MSDN getrokken:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Attribute VB_Name = "modAlwaysOnTop"
Option Explicit
    
    Public Const SWP_NOMOVE = 2
    Public Const SWP_NOSIZE = 1
    Public Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
    Public Const HWND_TOPMOST = -1
    Public Const HWND_NOTOPMOST = -2
    
Declare Function SetWindowPos Lib "user32" _
            (ByVal hWnd As Long, _
             ByVal hWndInsertAfter As Long, _
             ByVal x As Long, _
             ByVal y As Long, _
             ByVal cx As Long, _
             ByVal cy As Long, _
             ByVal wFlags As Long) As Long

Private Function SetTopMostWindow(hWnd As Long, Topmost As Boolean) As Long

    If Topmost = True Then 'Make the window topmost
      SetTopMostWindow = SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)
    Else
      SetTopMostWindow = SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS)
      SetTopMostWindow = False
    End If
    
End Function

Zo gebruik ik 'm ook... werkt perfect! :)

Suc6! ;)

Edit: stond functie in voor forms... ff weggehaald om verwarring te voorkomen...