//miniQQ程序
//minigui版本号1.6.10
//qvfb版本1.1
//作者:qqq
#include<stdio.h>
#include<minigui/common.h>
#include<minigui/minigui.h>
#include<minigui/gdi.h>
#include<minigui/window.h>
#include<minigui/control.h>
#define IDC_BUTTON_0 100
#define IDC_BUTTON_1 101
#define IDC_BUTTON_2 102
#define IDC_BUTTON_3 103
#define IDC_CHECKBOX_0 200
#define IDC_CHECKBOX_1 201
#define IDC_CHECKBOX_2 202
#define IDC_TEXT_0 300
#define IDC_TEXT_1 301
#define IDC_TEXT_2 302
#define IDC_TEXT_3 303
#define IDC_TEXT_4 304
#define IDC_EDIT_0 400
#define IDC_EDIT_1 401
#define IDC_EDIT_2 402
#define IDC_EDIT_3 403
#define IDC_EDIT_4 404
#define IDC_LISTBOX_0 500
//-------------------对话框代码
static DLGTEMPLATE DlgInitProgress = {
WS_BORDER | WS_CAPTION,
WS_EX_NONE,
0,0,320,240,
"个人信息",
0,0,
3,NULL,
0
};
static CTRLDATA CtrlInitProgress[] =
{
{
CTRL_STATIC,
WS_VISIBLE | SS_SIMPLE,
50,50,250,30,
IDC_TEXT_4,
"欢迎到我的BLOG做客:",
0
},
{
CTRL_STATIC,
WS_VISIBLE | SS_SIMPLE,
50,80,250,30,
IDC_TEXT_4,
"http://blog.sina.com.cn/u/1180215917",
0
},
{
CTRL_BUTTON,
WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON,
120,150,80,30,
IDOK,
"关闭",
0
}
};
static int InitDialogBoxProc(HWND hDlg, int message, WPARAM wParam,
LPARAM lParam)
{
switch(message){
case MSG_INITDIALOG:
return 1;
case MSG_COMMAND:
switch(wParam){
case IDOK:
EndDialog(hDlg, wParam);
break;
}
return 0;
case MSG_CLOSE:
EndDialog(hDlg, wParam);
return 0;
}
return DefaultDialogProc(hDlg, message, wParam, lParam);
}
static int OpenDialogBox(HWND hWnd)
{
DlgInitProgress.controls = CtrlInitProgress;
DialogBoxIndirectParam(&DlgInitProgress, hWnd,
InitDialogBoxProc, 0L);
}
//-------------------------交谈信息对话框
static int MessageSendProc(HWND hWnd, int id, int nc, DWORD
add_data)
{
switch(nc){
case BN_CLICKED:{
char buffer[256];
char *p;
p = (char *)malloc(1024);
GetWindowText(GetDlgItem(GetParent(hWnd), IDC_EDIT_2), p,
1024);
GetWindowText(GetDlgItem(GetParent(hWnd), IDC_EDIT_3), buffer,
255);
strcat(p, buffer);
SetWindowText(GetDlgItem(GetParent(hWnd), IDC_EDIT_2), p);
free(p);
return 0;
}
return 0;
}
}
static int MessageWinProc(HWND hWnd, int message, WPARAM wParam,
LPARAM lParam)
{
static int MessageSendProc();
switch(message){
case MSG_CREATE:
CreateWindow(CTRL_MLEDIT,
"",
WS_CHILD | WS_BORDER | WS_VISIBLE | ES_AUTOWRAP | WS_VSCROLL,
IDC_EDIT_2,
10,10,350,200,hWnd,0);
SendMessage(GetDlgItem(hWnd, IDC_EDIT_2), EM_SETREADONLY, TRUE,
0);
CreateWindow(CTRL_EDIT,
"",
WS_CHILD | WS_BORDER | WS_VISIBLE | WS_TABSTOP | ES_AUTOWRAP,
IDC_EDIT_3,
10,220,350,100,hWnd,0);
CreateWindow(CTRL_BUTTON,
"发送",
WS_CHILD | WS_VISIBLE,
IDC_BUTTON_1,
370,220,70,45,hWnd,0);
CreateWindow(CTRL_BUTTON,
"关闭",
WS_CHILD | WS_VISIBLE,
IDC_BUTTON_2,
370,275,70,45,hWnd,0);
SetNotificationCallback(GetDlgItem(hWnd, IDC_BUTTON_1),
MessageSendProc);
printf("The MessageWin has been opened!\n");
return 0;
case MSG_COMMAND:{
int id = LOWORD(wParam);
int code = HIWORD(wParam);
switch(id){
case IDC_BUTTON_2:
if(code == BN_CLICKED)
SendMessage(hWnd, MSG_CLOSE, 0, 0);
}
return 0;
}
case MSG_DESTROY:
DestroyAllControls(hWnd);
printf("The MessageWin has been destroyed!\n");
return 0;
case MSG_CLOSE:
DestroyMainWindow(hWnd);
MainWindowCleanup(hWnd);
printf("The MessageWin has been closed!\n");
return 0;
}
return DefaultMainWinProc(hWnd, message, wParam, lParam);
}
int CreateMessageWin(HWND hWnd, char* friendName){
WS_CAPTION;
CreateMainWindow(&CreateInfo);
-1;
}
//------------------qq面板代码
static int QQWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM
lParam)
{
static int MessageWin();
static HWND hListBox;
switch(message){
case MSG_CREATE:{
HWND hListBox;
hListBox = CreateWindow(CTRL_LISTBOX,
"FriendsList",
WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | LBS_SORT |
LBS_NOTIFY | LBS_USEICON,
IDC_LISTBOX_0,
10,10,160,350,hWnd,0);
LISTBOXITEMINFO lbii;
lbii.hIcon = GetSmallSystemIcon(4);
lbii.cmFlag = CMFLAG_BLANK;
lbii.string = "qqq";
SendMessage(hListBox, LB_ADDSTRING, 0,
(LPARAM)&lbii);
hlistbox\n");
CreateWindow(CTRL_BUTTON,
"个人设置",
WS_CHILD | WS_VISIBLE,
IDC_BUTTON_3,
10,370,160,30,hWnd,0);
printf("The QQWin has been opened!\n");
return 0;
}
case MSG_COMMAND:{
int id = LOWORD(wParam);
int code = HIWORD(wParam);
switch(id){
case IDC_LISTBOX_0:
if(code == LBN_DBLCLK){
hListBox = GetDlgItem(hWnd, IDC_LISTBOX_0);
int index;
char buffer[20];
index = SendMessage(hListBox, LB_GETCURSEL, 0, 0);
SendMessage(hListBox, LB_GETTEXT, index, (LPARAM)buffer);
message\n");
CreateMessageWin(hWnd, (char *)buffer);
}
case IDC_BUTTON_3:
if(code == BN_CLICKED)
OpenDialogBox(hWnd);
}
return 0;
}
case MSG_DESTROY:
DestroyAllControls(hWnd);
return 0;
case MSG_CLOSE:
DestroyMainWindow(hWnd);
PostQuitMessage(hWnd);
return 0;
}
return DefaultMainWinProc(hWnd, message, wParam, lParam);
}
int CreateQQWin(){
WS_CAPTION;
CreateMainWindow(&CreateInfo);
hQQWnd));
hQQWnd)){
message\n");
}
//-------------------登陆对话框代码
int LoginWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM
lParam){
*)GetWindowAdditionalData(hWnd);
switch(message){
case MSG_CREATE:
CreateWindow(CTRL_STATIC,
str1,
WS_CHILD | WS_VISIBLE,
IDC_TEXT_0,
10,10,220,20,hWnd,0);
CreateWindow(CTRL_STATIC,
"QQ账号:",
WS_CHILD | WS_VISIBLE,
IDC_TEXT_1,
50,50,80,20,hWnd,0);
CreateWindow(CTRL_EDIT,
"",
WS_CHILD | WS_BORDER | WS_VISIBLE,
IDC_EDIT_0,
130,50,100,20,hWnd,0);
CreateWindow(CTRL_STATIC,
"QQ密码:",
WS_CHILD | WS_VISIBLE,
IDC_TEXT_2,
50,80,80,20,hWnd,0);
CreateWindow(CTRL_EDIT,
"",
WS_CHILD | WS_BORDER | WS_VISIBLE | ES_PASSWORD,
IDC_EDIT_1,
130,80,100,20,hWnd,0);
CreateWindow(CTRL_BUTTON,
"登陆",
WS_CHILD | BS_DEFPUSHBUTTON | WS_VISIBLE,
IDC_BUTTON_0,
100,160,80,30,hWnd,0);
CreateWindow(CTRL_BUTTON,
"自动登录",
WS_CHILD | BS_AUTOCHECKBOX | WS_VISIBLE,
IDC_CHECKBOX_0,
50,120,100,30,hWnd,0);
CreateWindow(CTRL_BUTTON,
"隐身",
WS_CHILD | BS_AUTOCHECKBOX | WS_VISIBLE,
IDC_CHECKBOX_1,
180,120,100,30,hWnd,0);
printf("The MainWin has been opened!\n");
return 0;
case MSG_COMMAND:{
int id = LOWORD(wParam);
int code = HIWORD(wParam);
switch(id){
case IDC_BUTTON_0:
if(code == BN_CLICKED){
SendMessage(hWnd, MSG_CLOSE, 0, 0);
CreateQQWin();
}
}
return 0;
}
case MSG_DESTROY:
DestroyAllControls(hWnd);
return 0;
case MSG_CLOSE:
DestroyMainWindow(hWnd);
PostQuitMessage(hWnd);
return 0;
}
return DefaultMainWinProc(hWnd, message, wParam, lParam);
}
int CreateLogin(){
WS_CAPTION;
}
//---------------主函数
int MiniGUIMain(int argc,const char *argv[]){
#ifdef _MGRM_PROCESSES
JoinLayer(NAME_DEF_LAYER , "QQWindow" , 0 , 0);
#endif
}
没有评论:
发表评论