📄 netsend.cpp
字号:
// NetSend.cpp : Defines the entry point for the application.
//NJ 刘帅
#include "stdafx.h"
#include "resource.h"
HINSTANCE hInst;
HWND afxwnd;
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
return DialogBox(hInstance, (LPCTSTR)IDD_main, 0, (DLGPROC)WndProc);;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
afxwnd=hWnd;
UINT retval=0;
char sendcmd[100]="",tem[100]="";
switch (message)
{
case WM_INITDIALOG:
CheckDlgButton(afxwnd,IDC_single,BST_CHECKED);
break;
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
switch (wmId)
{
case IDC_aboutbox: //关于
DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, afxwnd, (DLGPROC)About);
break;
case IDC_single:
if(IsDlgButtonChecked(afxwnd,IDC_single)==BST_CHECKED)
EnableWindow(GetDlgItem(afxwnd,IDC_pcname),TRUE);
break;
case IDC_group:
case IDC_field:
case IDC_all:
EnableWindow(GetDlgItem(afxwnd,IDC_pcname),FALSE);
break;
case IDC_opennet:
retval=WinExec((LPCSTR)"net start messenger",SW_HIDE);
break;
case IDC_stopnet:
retval=WinExec((LPCSTR)"net stop messenger",SW_HIDE);
break;
case IDC_send:
if(IsDlgButtonChecked(afxwnd,IDC_group)==BST_CHECKED) //组内发送
strcpy(sendcmd,"net send * ");
else if(IsDlgButtonChecked(afxwnd,IDC_field)==BST_CHECKED) //域内发送
strcpy(sendcmd,"net send /domain ");
else if(IsDlgButtonChecked(afxwnd,IDC_all)==BST_CHECKED) //所有连到服务器上的PC
strcpy(sendcmd,"net send /users ");
else if(IsDlgButtonChecked(afxwnd,IDC_single)==BST_CHECKED){
GetDlgItemText(afxwnd,IDC_pcname,tem,100);
strcpy(sendcmd,"net send ");
strcat(sendcmd,tem);
strcat(sendcmd," ");
}
ZeroMemory(tem,sizeof(tem));
GetDlgItemText(afxwnd,IDC_message,tem,100);
strcat(sendcmd,"\"");
strcat(sendcmd,tem);
strcat(sendcmd,"\" ");
WinExec((LPCSTR)sendcmd,SW_HIDE);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
}
return 0;
}
// Mesage handler for about box.
LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
break;
}
return FALSE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -