#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <minigui/common.h>
#include <minigui/minigui.h>
#include <minigui/gdi.h>
#include <minigui/window.h>
#include <minigui/control.h>
#define IDC_MYBUTTON 100
#define CTRL_MYBUTTON "my_button"
#define MYBUTTON_PUSH 1
#define IDM_EXIT 110
#define IDM_SAVE 111
#define IDM_SAVEAS 112
#define IDM_HELP 113
#define IDM_ABOUT 114
#define IDM_FILE 120
#define IDM_OPEN 121
#define IDC_CLOSE 130
#define IDC_BUTTONC 200
#define IDC_SELECTED 210
#define IDC_FANHUI 106
#define IDC_MAINMENU 107
#define IDC_DISP1 108
//==========================================================================
//==========================================================================
static HWND hMainWnd = HWND_INVALID;
static DLGTEMPLATE DlgQiuHeng=
{
WS_CAPTION, WS_EX_NONE, 160,120, 320, 240, "西南大学!", 0, 0, 3, NULL, 0
};
static CTRLDATA CtrlQiuHeng[] =
{
{ "static", WS_VISIBLE|SS_SIMPLE, 0,0, 100,20, IDC_DISP1, "", 0, WS_EX_NONE },
{ "button", WS_VISIBLE | WS_TABSTOP | WS_GROUP, 200, 180, 50, 30, IDC_FANHUI,"返回", 0 },
{ "button", WS_VISIBLE | WS_TABSTOP | WS_GROUP, 55, 180, 50, 30, IDC_MAINMENU, "确定", 0 },
};
static int DialogBoxProc (HWND hDlg, int message, WPARAM wParam, LPARAM lParam)
{
int id ;
switch (message)
{
case MSG_INITDIALOG:
return 1;
case MSG_COMMAND:
{
switch (wParam)
{
case IDC_MAINMENU:
if (id==IDC_MAINMENU)
{ MessageBox(hDlg, "浏览结束,谢谢!","FILE", MB_OK); }
break;
case IDC_FANHUI:
EndDialog (hDlg, wParam);
break;
}
break;
}
case MSG_CLOSE:
EndDialog (hDlg, wParam);
break;
}
return DefaultDialogProc (hDlg, message, wParam, lParam);
}
static void testDialogBox (HWND hWnd)
{
DlgQiuHeng.controls = CtrlQiuHeng;
DialogBoxIndirectParam (&DlgQiuHeng, hWnd, DialogBoxProc, 0L);
}
//=================================================================
//==================================================================
static HWND hMainWnd2 = HWND_INVALID;
static int SecWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
RECT rc;
switch (message)
{
case MSG_CREATE:
CreateWindow (CTRL_BUTTON,
"确定",
SS_SIMPLE| WS_CHILD | BS_CHECKED | WS_VISIBLE,
IDC_BUTTONC,
580, 420, 60, 20, hWnd, 0);
break;
case MSG_COMMAND:
{
int id = LOWORD(wParam);//低
int code = HIWORD(wParam);//高
char buffer [256];
sprintf (buffer, "ID: %d, Code: %x", id, code);
if (wParam == IDCANCEL) {
PostMessage (hWnd, MSG_CLOSE, 0, 0);
break;
}
switch (id)
{
case (IDC_BUTTONC):
if(code == BN_CLICKED)
{
testDialogBox (hWnd);
}
break;
default:
break;
}
}
break;
case MSG_PAINT:
hdc = BeginPaint (hWnd);
GetClientRect (hWnd, &rc);
EndPaint (hWnd, hdc);
break;
case MSG_DESTROY:
DestroyAllControls (hWnd);
hMainWnd2 = HWND_INVALID;
return 0;
case MSG_CLOSE:
DestroyMainWindow (hWnd);
MainWindowCleanup (hWnd);
return 0;
}
return DefaultMainWinProc (hWnd, message, wParam, lParam);
}
static void InitCreateInfoTWO (PMAINWINCREATE pCreateInfo2)
{
pCreateInfo2->dwStyle = WS_CHILD | WS_BORDER | WS_VISIBLE|WS_CAPTION;
pCreateInfo2->dwExStyle = WS_EX_NONE;
pCreateInfo2->spCaption = "工程技术学院";
pCreateInfo2->hMenu = 0;
pCreateInfo2->hCursor = GetSystemCursor(0);
pCreateInfo2->hIcon = 0;
pCreateInfo2->MainWindowProc = SecWinProc;
pCreateInfo2->lx = 0;
pCreateInfo2->ty = 0;
pCreateInfo2->rx = 640;
pCreateInfo2->by = 480;
pCreateInfo2->iBkColor = COLOR_lightwhite;
pCreateInfo2->dwAddData = 0;
pCreateInfo2->hHosting = hMainWnd;
}
void orderdesk2 (HWND hwnd)
{
MAINWINCREATE CreateInfo2;
InitCreateInfoTWO (&CreateInfo2);
hMainWnd2 = CreateMainWindow (&CreateInfo2);
if (hMainWnd2 != HWND_INVALID)
{
ShowWindow (hMainWnd2, SW_SHOWNORMAL);
return;
}
}
//==================================================================================
//==================================================================================
static HWND hMainWnd3 =HWND_INVALID;
static int ThiWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
static BITMAP s_bmp[6];
int id = LOWORD(wParam);
int i;
HDC hdc;
RECT rcClient;
switch(message)
{
case MSG_CREATE:
LoadBitmapFromFile( HDC_SCREEN, &s_bmp[0], "/usr/local/lib/minigui/res/bmp/no01.bmp");
LoadBitmapFromFile( HDC_SCREEN, &s_bmp[1], "/usr/local/lib/minigui/res/bmp/no02.bmp");
LoadBitmapFromFile( HDC_SCREEN, &s_bmp[2], "/usr/local/lib/minigui/res/bmp/no03.bmp");
LoadBitmapFromFile( HDC_SCREEN, &s_bmp[3], "/usr/local/lib/minigui/res/bmp/no04.bmp");
LoadBitmapFromFile( HDC_SCREEN, &s_bmp[4], "/usr/local/lib/minigui/res/bmp/no05.bmp");
LoadBitmapFromFile( HDC_SCREEN, &s_bmp[5], "/usr/local/lib/minigui/res/bmp/no06.bmp");
// LoadBitmapFromFile( HDC_SCREEN, &s_bmp[6], "/usr/local/lib/minigui/res/bmp/no07.bmp");
CreateWindow(CTRL_BUTTON, "", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | BS_CHECKED, IDC_CLOSE,
0, 0, 640, 480, hWnd, 0);
break;
case MSG_COMMAND:
if (id==IDC_CLOSE )
{
for(i=0;i<6;i++)
UnloadBitmap(&s_bmp[i]);
// DestroyMainWindow (hWnd);
// DestroyAllControls (hWnd);
// MainWindowCleanup (hWnd);
// hMainWnd3 = HWND_INVALID;
// PostQuitMessage(hWnd);
}
break;
case MSG_PAINT:
hdc=BeginPaint(hWnd);
GetClientRect (hWnd, &rcClient);
FillBoxWithBitmap(hdc,0,0,640,480,&s_bmp[i]);
// DrawText(hdc,Welcom_str,0,&rcClient,DT_LEFT);
EndPaint(hWnd,hdc);
break;
case MSG_DESTROY:
DestroyAllControls (hWnd);
hMainWnd3 = HWND_INVALID;
return 0;
case MSG_CLOSE:
DestroyMainWindow (hWnd);