Always on top sur le bureau...

cs_dominion Messages postés 230 Date d'inscription mardi 21 janvier 2003 Statut Membre Dernière intervention 15 mai 2008 - 15 mars 2005 à 00:56
cs_dominion Messages postés 230 Date d'inscription mardi 21 janvier 2003 Statut Membre Dernière intervention 15 mai 2008 - 22 mars 2005 à 21:34
Bonjour à tous !

Voilà je suis en train de créer une appli de post-its et j'aimerais qu'ils soient toujours visibles quand tout est minimisé, c'est à dire sur le bureau, comme la barre des tâches windows quand on désactive le mode toujours au dessus.
Mais le problème, c'est que je n'ai vraiment pas d'idée pour obtenir cet effet... J'en appelle donc à votre bonne volonté ;-). Pour info je suis sur WinXP SP2.

Merci d'avance.

.:8 Xurei - Gnauti seautov 8:.

11 réponses

ymca2003 Messages postés 2070 Date d'inscription mardi 22 avril 2003 Statut Membre Dernière intervention 3 juillet 2006 7
15 mars 2005 à 08:51
0
yserver Messages postés 203 Date d'inscription lundi 2 août 2004 Statut Membre Dernière intervention 8 septembre 2006
15 mars 2005 à 19:06
Bonjour
Cette fonction te permettra de la mettre au dessus de toute les autres. Par contre l'utilisateur peut toujours s'en débarasser en la minimisant. Mais pas partir de la y a plus grand chose à faire

BOOL SetWindowPos(

HWND hWnd,
HWND hWndInsertAfter,
int X,
int Y,
int cx,
int cy,
UINT uFlags
);

avec :


<DT>hWndInsertAfter
<DD>[in] Handle to the window to precede the positioned window in the Z order. This parameter must be a window handle or one of the following values.
* :

<DL>
* : HWND_BOTTOM
Places the window at the bottom of the Z order. If the hWnd parameter identifies a topmost window, the window loses its topmost status and is placed at the bottom of all other windows.
* : HWND_NOTOPMOST
Places the window above all non-topmost windows (that is, behind all topmost windows). This flag has no effect if the window is already a non-topmost window.
* : HWND_TOP
Places the window at the top of the Z order.
* : HWND_TOPMOST
<DD>Places the window above all non-topmost windows. The window maintains its topmost position even when it is deactivated.

<DT>
<DD>For more information about how this parameter is used, see the following Remarks section.

Bon courage.</DD></DL></DD>
0
cs_dominion Messages postés 230 Date d'inscription mardi 21 janvier 2003 Statut Membre Dernière intervention 15 mai 2008
15 mars 2005 à 21:44
ymca2003 : est-ce un composant visuel à part entière ou un attribut que l'on peut donner à une window ? C'est que mes post itts sont déjà dessinés...

.:8 Xurei - Gnauti seautov 8:.
0
cs_dominion Messages postés 230 Date d'inscription mardi 21 janvier 2003 Statut Membre Dernière intervention 15 mai 2008
15 mars 2005 à 21:45
ymca2003 : est-ce un composant visuel à part entière ou un attribut que l'on peut donner à une window ? C'est que mes post its sont déjà dessinés...

.:8 Xurei - Gnauti seautov 8:.
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
cs_dominion Messages postés 230 Date d'inscription mardi 21 janvier 2003 Statut Membre Dernière intervention 15 mai 2008
15 mars 2005 à 21:45
ymca2003 : est-ce un composant visuel à part entière ou un attribut que l'on peut donner à une window ? C'est que mes post its sont déjà dessinés...

.:8 Xurei - Gnauti seautov 8:.
0
cs_dominion Messages postés 230 Date d'inscription mardi 21 janvier 2003 Statut Membre Dernière intervention 15 mai 2008
15 mars 2005 à 22:10
désolé pour le triple, je bats des reccords là...
Au fait je suis sur BCB, donc moi les handles je sais jamais lequel prendre...

yserver :
SetWindowPos(handle, HWND_TOPMOST, -1, -1, -1, -1, SWP_NOMOVE | SWP_NOSIZE);

C'est bien comme ça que je dois faire ?
Merci d'avance !

.:8 Xurei - Gnauti seautov 8:.
0
ymca2003 Messages postés 2070 Date d'inscription mardi 22 avril 2003 Statut Membre Dernière intervention 3 juillet 2006 7
16 mars 2005 à 09:10
Je pense que mettre le style WS_EX_TOPMOST en utilisant CreateWindowEx pour la création ou par la méthode de yserver sera plus facile à mettre en oeuvre. Reste le problème évoqué qui peut sans doute être réalisé en détectant la minimisation (message WM_SHOWWINDOW avec masquage de la fenêtre).
0
cs_dominion Messages postés 230 Date d'inscription mardi 21 janvier 2003 Statut Membre Dernière intervention 15 mai 2008
16 mars 2005 à 19:02
J'y ai pensé... Le problème c'est que celà ne marche pas avec le bouton bureau (ou touche windows+d)... Donc je cherche une solution si je trouve je préviens.

.:8 Xurei - Gnauti seautov 8:.
0
yserver Messages postés 203 Date d'inscription lundi 2 août 2004 Statut Membre Dernière intervention 8 septembre 2006
18 mars 2005 à 08:10
Bonjours.
Voila comment j'ai resolu ce pb de fenetre toujours visible (Tout ca en VS):

Fichier PDM.cpp :
<HR>
//Les Include
#include <windows.h>
#include <stdio.h>
#include "resource.h"
//


BOOL CALLBACK AppDlgProc(HWND hdlg, UINT mssg, WPARAM wParam, LPARAM lParam)
{
//Declaration des variables
char AFR[15] , MsgBuffer [256];
switch(mssg)
{
case WM_INITDIALOG:
return 0;
case WM_COMMAND:
if(wParam == IDCANCEL)
{
EndDialog (hdlg, NULL);
return 0;
}


// Traitement de l'EditBox
GetDlgItemText(hdlg, IDC_AFR, AFR, 16);

//PDM AVEC
if(LOWORD(wParam) == IDOK)
{
sprintf(MsgBuffer ,"http://%s" ,AFR);
ShellExecute(hdlg ,"open" ,"iexplore" ,MsgBuffer ,NULL ,SW_SHOWDEFAULT);
return 0;
}

//PING
if(LOWORD(wParam) == IDC_PING)
{
sprintf(MsgBuffer ,"/k ping %s" ,AFR);
ShellExecute(hdlg ,"open" ,"cmd" ,MsgBuffer ,NULL ,SW_SHOWDEFAULT);
return 0;
}



return 0;
}
return 0;
}


int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE x, PSTR y, int z)
{
DialogBoxParam(hInstance, (LPCTSTR)IDD_PDM, 0, AppDlgProc, 0);
return 0;
}
<HR>




Fichier resource.h :
<HR>
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by PDM.rc
//
#define IDD_PDM 101
#define IDC_EDIT1 1001
#define IDC_AFR 1001
#define IDC_PING 1003
#define IDC_BUTTON1 1004
#define IDC_SANS 1004


// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1005
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

<HR>



Fichier PDM.rc :



<HR>


// Microsoft Visual C++ generated resource script.
//
#include "resource.h"


#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"


/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS


/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources


#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32


#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//


1 TEXTINCLUDE
BEGIN
"resource.h\0"
END


2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END


3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END


#endif // APSTUDIO_INVOKED


#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////



/////////////////////////////////////////////////////////////////////////////
// French (France) resources


#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
#ifdef _WIN32
LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
#pragma code_page(1252)
#endif //_WIN32


/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//


IDD_PDM DIALOGEX 0, 0, 72, 36
STYLE DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP |
WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_TOPMOST
CAPTION "PDMAD"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
EDITTEXT IDC_AFR,4,2,65,14,ES_UPPERCASE | ES_AUTOHSCROLL
DEFPUSHBUTTON "AVEC",IDOK,4,19,24,14
PUSHBUTTON "PING",IDC_PING,45,19,24,14
END



/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//


#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_PDM, DIALOG
BEGIN
LEFTMARGIN, 4
RIGHTMARGIN, 69
TOPMARGIN, 2
BOTTOMMARGIN, 33
END
END
#endif // APSTUDIO_INVOKED


#endif // French (France) resources
/////////////////////////////////////////////////////////////////////////////





#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//



/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
<HR>

Bon courrage.
0
cs_dominion Messages postés 230 Date d'inscription mardi 21 janvier 2003 Statut Membre Dernière intervention 15 mai 2008
22 mars 2005 à 00:45
Voilà, j'ai utilisé SetWindowPos, mais malheureusement la fenêtre ne reste que si la bordure est redimentionnable... Je bosse avec bcb, donc je ne sais pas vraiment quelle est la syntaxe pour changer cela en win32, mais mon problème réisde dans le fait que je ne veux pas de bordure !
Qqun a une idée ?

.:8 Xurei - Gnauti seautov 8:.
0
cs_dominion Messages postés 230 Date d'inscription mardi 21 janvier 2003 Statut Membre Dernière intervention 15 mai 2008
22 mars 2005 à 21:34
Voilà j'ai des précisions :
Pour qu'une fenêtre soit en topmost il faut : que la fenêtre principale soit topmost, même si cachée elle doit avoir été définie comme telle et affichée au lancement. Après si vous la fermer ya aucun prob...
Si j'ai dit une connerie qu'on me flagelle !

.:8 Xurei - Gnauti seautov 8:.
0
Rejoignez-nous