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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
| // Test.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "resource.h"
// Declaration des differentes dialogs
LRESULT CALLBACK MainProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
// Declaration pour la fonction Search
HWND hWnd;
void Search(HWND hDlg);
// Entrée du programme
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
DialogBox(hInstance, MAKEINTRESOURCE(IDD_MAIN), GetDesktopWindow(), (DLGPROC) MainProc);
return 0;
}
// Dialog principale
LRESULT CALLBACK MainProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
int Select;
switch(uMsg)
{
case WM_COMMAND:
Select=LOWORD(wParam);
switch(Select)
{
case IDCANCEL:
EndDialog(hDlg,Select);
PostQuitMessage(0);
return TRUE;
case IDC_SEARCH:
Search(hDlg);
return TRUE;
}
case WM_TIMER:
hWnd = FindWindow(NULL,"Poste de travail");
if (hWnd)
{
SetDlgItemText(hDlg, IDC_WHAT, "Trouvé");
}
else
{
SetDlgItemText(hDlg, IDC_WHAT, "Recherche");
}
return TRUE;
default:
return FALSE;
}
}
// Fonction Search (Test de findwindow)
void Search(HWND hDlg)
{
SetTimer(hDlg, NULL, 1000, NULL);
} |
Partager