- #include <windows.h>
- #include "resource.h"
-
- HINSTANCE hinst;
- char sztxt[400];
- HWND hstbmp, hsttxt;
-
- BOOL CALLBACK AppDlgProc(HWND hdlg, UINT mssg, WPARAM wParam, LPARAM lParam)
- {
- switch(mssg) {
- case WM_INITDIALOG:
- RECT rc;
- int cx, cy;
- SetClassLong(hdlg, GCL_HICON, (long)LoadIcon(0, IDI_APPLICATION));
- hstbmp = GetDlgItem(hdlg, IDST_BMP);
- GetWindowRect(hstbmp, &rc);
- cx = rc.right - rc.left;
- cy = rc.bottom - rc.top;
- ScreenToClient(hdlg, (POINT*) &rc);
- hsttxt = GetDlgItem(hdlg, IDST_TXT);
- SetWindowPos(hsttxt, HWND_TOP, rc.left, rc.top, cx, cy, SWP_SHOWWINDOW);
- SendDlgItemMessage(hdlg, IDED_TXT, EM_SETLIMITTEXT, 399, 0);
- return TRUE;
- case WM_CTLCOLORSTATIC:
- if(GetWindowLong((HWND)lParam, GWL_ID) == IDST_TXT) {
- SetBkMode((HDC) wParam, TRANSPARENT);
- SetTextColor((HDC) wParam, 0xFF); // tu peux enlever ou changer couleur
- return (BOOL) GetStockObject(NULL_BRUSH);
- }
- return 0;
- case WM_COMMAND:
- switch(wParam) {
- case IDBT_TXT:
- InvalidateRect(hstbmp, 0, 1);
- SetWindowText(hsttxt, 0);
- InvalidateRect(hsttxt, 0, 1);
- GetDlgItemText(hdlg, IDED_TXT, sztxt, 400);
- SetWindowText(hsttxt, sztxt);
- return 0;
- case IDCANCEL:
- EndDialog(hdlg, 0);
- }
- }
- return 0;
- }
-
- int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, PSTR, int)
- {
- hinst = hInstance;
- DialogBox(hinst, MAKEINTRESOURCE(IDD_APP), NULL, AppDlgProc);
- return 0;
- }
#include <windows.h>
#include "resource.h"
HINSTANCE hinst;
char sztxt[400];
HWND hstbmp, hsttxt;
BOOL CALLBACK AppDlgProc(HWND hdlg, UINT mssg, WPARAM wParam, LPARAM lParam)
{
switch(mssg) {
case WM_INITDIALOG:
RECT rc;
int cx, cy;
SetClassLong(hdlg, GCL_HICON, (long)LoadIcon(0, IDI_APPLICATION));
hstbmp = GetDlgItem(hdlg, IDST_BMP);
GetWindowRect(hstbmp, &rc);
cx = rc.right - rc.left;
cy = rc.bottom - rc.top;
ScreenToClient(hdlg, (POINT*) &rc);
hsttxt = GetDlgItem(hdlg, IDST_TXT);
SetWindowPos(hsttxt, HWND_TOP, rc.left, rc.top, cx, cy, SWP_SHOWWINDOW);
SendDlgItemMessage(hdlg, IDED_TXT, EM_SETLIMITTEXT, 399, 0);
return TRUE;
case WM_CTLCOLORSTATIC:
if(GetWindowLong((HWND)lParam, GWL_ID) == IDST_TXT) {
SetBkMode((HDC) wParam, TRANSPARENT);
SetTextColor((HDC) wParam, 0xFF); // tu peux enlever ou changer couleur
return (BOOL) GetStockObject(NULL_BRUSH);
}
return 0;
case WM_COMMAND:
switch(wParam) {
case IDBT_TXT:
InvalidateRect(hstbmp, 0, 1);
SetWindowText(hsttxt, 0);
InvalidateRect(hsttxt, 0, 1);
GetDlgItemText(hdlg, IDED_TXT, sztxt, 400);
SetWindowText(hsttxt, sztxt);
return 0;
case IDCANCEL:
EndDialog(hdlg, 0);
}
}
return 0;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, PSTR, int)
{
hinst = hInstance;
DialogBox(hinst, MAKEINTRESOURCE(IDD_APP), NULL, AppDlgProc);
return 0;
}