vc问题,请求ps高手帮忙忙

求救:请高手帮我看下VC
bmp图像数据读取和输出代码,编译通过可就是一运行就出错!!_百度知道
求救:请高手帮我看下VC
bmp图像数据读取和输出代码,编译通过可就是一运行就出错!!
rb& DWORD LineB BITMAPINFOHEADER bi,sizeof(BITMAPINFOHEADER);#pragma warning(disable.bmp&quot,j; fp=fopen(&quot!= 0 )
NumColors=(DWORD)bi:NumColors=2; free(Imgdata).h&#include &
} ipRGB=(RGBQUAD *)malloc(NumColors*sizeof(RGBQUAD)).biBitCount)
{case 1;ctype.biHeight)-1;
fp=fopen(fileN; fwrite(&
case 4.h&32*4)/最好能告诉我正确的代码.biWp#define WIDTHBYTES(i) ((i+31)&#47,1.h&).biClrUsed ,1;=0; for ( i=(j&i&i--)
for (j=0 ; return 0; fread(& LineByte=(DWORD)WIDTHBYTES(bi.biWidth,1,sizeof(BITMAPFILEHEADER);wb&quot,1.h&gt,fp); FILE* fp.biWidth*j++)
fread(&Imgdata[i][j];/ RGBQUAD *ipRGB;i--) Imgdata[i]=new unsigned char[bi,fp);
for (i=(mybmp.biWidth]; fwrite(&
case 24: 4996)int main(){BITMAPFILEHEADER
unsigned char * * I/ for ( i=(
ImgSize=(DWORD)LineByte*bi,fp);
case 8,sizeof(RGBQUAD); DWORD NumColors:&quot,NumC%s&quot,NumC);#include &}&#47:NumColors=16;i&gt,fp);=0.h&gt,&j++)
fwrite(&Imgdata[i][j],1.biHeight)-1,sizeof(RGBQUAD); scanf(&quot,1; if ( fread(& printf(&quot,sizeof(BITMAPFILEHEADER).biBitCount),fp).biClrU); fclose(fp),fp),sizeof(BITMAPINFOHEADER):NumColors=256; fread(ipRGB:NumColors=0,1,&quot,ImgS
Imgdata=new unsigned char*[bi.biHeight.h&=0;i--)
for(j=0;i&j&lt.biHeight],fp);,fp);break.biHeight)-1 ;#include & fwrite(ipRGB; char * fileN else
switch (bi,1;#include &bi,&fileName);#include &lt#include &lt
提问者采纳
fileName); 又是不分配内存;pprintf(&quot:char fileName[256];;scanf(&scanf(&quot,&fileName);)char * fileN%s&quot,还往里面装东西的错误。改完之后;%s&quot.应该改为,他只能标记一段内存地址; 指针不能存储变量的;);;please enter filename:&printf(&quot:&quot,完全能运行成功
提问者评价
其他类似问题
图像数据的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁跪求高手帮忙解决VC++6.0出错问题_vc吧_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:8,508贴子:
跪求高手帮忙解决VC++6.0出错问题收藏
--------------------Configuration: modeset - Win32 Debug--------------------Linking...LINK : fatal error LNK1104: cannot open file "kernel32.lib"执行 link.exe 时出错.
modeset.exe - 1 error(s), 0 warning(s)
--------------------Configuration: XSCJ - Win32 Debug--------------------Linking...LINK : fatal error LNK1104: cannot open file "msvcrtd.lib"执行 link.exe 时出错.
XSCJ.exe - 1 error(s), 0 warning(s)
代码是什么
--------------------Configuration: modeset - Win32 Debug--------------------Linking...LINK : fatal error LNK1104: cannot open file "kernel32.lib"执行 link.exe 时出错. modeset.exe - 1 error(s), 0 warning(s) --------------------Configuration: XSCJ - Win32 Debug--------------------Linking...LINK : fatal error LNK1104: cannot open file "msvcrtd.lib"执行 link.exe 时出错. XSCJ.exe - 1 error(s), 0 warning(s)给我们错误报告有什么用 就是这个问题了
// XSCJSet.h : interface of the CXSCJSet class///////////////////////////////////////////////////////////////////////////////#if !defined(AFX_XSCJSET_H__5DDFF7B8_7D19_48DE_8BE5_A715EC1D0FC9__INCLUDED_)#define AFX_XSCJSET_H__5DDFF7B8_7D19_48DE_8BE5_A715EC1D0FC9__INCLUDED_#if _MSC_VER & 1000#pragma once#endif // _MSC_VER & 1000class CXSB{public:CXSB(){memset( (void*)this, 0, sizeof(*this) );};char m_XH[7];char m_XM[9];BOOL m_XB;DBTIMESTAMP m_CSSJ;char m_ZY[13];int m_ZXF;char m_BZ[501];wchar_t m_LXFS[513];//TODO: Change this large string to an ISequentialStream if your provider supports it.ISequentialStream* m_ZP;BEGIN_COLUMN_MAP(CXSB)COLUMN_ENTRY_TYPE(1, DBTYPE_STR, m_XH)COLUMN_ENTRY_TYPE(2, DBTYPE_STR, m_XM)COLUMN_ENTRY_TYPE(3, DBTYPE_BOOL, m_XB)COLUMN_ENTRY_TYPE(4, DBTYPE_DBTIMESTAMP, m_CSSJ)COLUMN_ENTRY_TYPE(5, DBTYPE_STR, m_ZY)COLUMN_ENTRY_TYPE(6, DBTYPE_I4, m_ZXF)COLUMN_ENTRY_TYPE(7, DBTYPE_STR, m_BZ)COLUMN_ENTRY_TYPE(8, DBTYPE_WSTR, m_LXFS)BLOB_ENTRY(9, IID_ISequentialStream, STGM_READ, m_ZP)END_COLUMN_MAP()};class CXSCJSet : public CCommand&CAccessor&CXSB& &{public:HRESULT Open(){CDataSCSHRESULTCDBPropSetdbinit(DBPROPSET_DBINIT);dbinit.AddProperty(DBPROP_AUTH_PASSWORD, "123456");dbinit.AddProperty(DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO, true);dbinit.AddProperty(DBPROP_AUTH_USERID, "PUSER");dbinit.AddProperty(DBPROP_INIT_CATALOG,
"PXSCJ");dbinit.AddProperty(DBPROP_INIT_DATASOURCE, "PC-ZYHW");dbinit.AddProperty(DBPROP_INIT_LCID, (long)2052);dbinit.AddProperty(DBPROP_INIT_PROMPT, (short)4);hr = db.OpenWithServiceComponents("SQLOLEDB.1", &dbinit);if (FAILED(hr))hr = session.Open(db);if (FAILED(hr))CDBPropSetpropset(DBPROPSET_ROWSET);propset.AddProperty(DBPROP_CANFETCHBACKWARDS, true);propset.AddProperty(DBPROP_IRowsetScroll, true);propset.AddProperty(DBPROP_IRowsetChange, true);propset.AddProperty(DBPROP_UPDATABILITY, DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_INSERT | DBPROPVAL_UP_DELETE );hr = CCommand&CAccessor&CXSB& &::Open(session, "SELECT * FROM dbo.XSB", &propset);if (FAILED(hr))return MoveNext();}};//{{AFX_INSERT_LOCATION}}// Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_XSCJSET_H__5DDFF7B8_7D19_48DE_8BE5_A715EC1D0FC9__INCLUDED_)
// XSCJ.h : main header file for the XSCJ application//#if !defined(AFX_XSCJ_H__A79_4866_B8DF_7ECAB0FD4C4A__INCLUDED_)#define AFX_XSCJ_H__A79_4866_B8DF_7ECAB0FD4C4A__INCLUDED_#if _MSC_VER & 1000#pragma once#endif // _MSC_VER & 1000#ifndef __AFXWIN_H__#error include 'stdafx.h' before including this file for PCH#endif#include "resource.h"
// main symbols/////////////////////////////////////////////////////////////////////////////// CXSCJApp:// See XSCJ.cpp for the implementation of this class//class CXSCJApp : public CWinApp{public:CXSCJApp();// Overrides// ClassWizard generated virtual function overrides//{{AFX_VIRTUAL(CXSCJApp)public:virtual BOOL InitInstance();//}}AFX_VIRTUAL// Implementation//{{AFX_MSG(CXSCJApp)afx_msg void OnAppAbout();// NOTE - the ClassWizard will add and remove member functions here.//
DO NOT EDIT what you see in these blocks of generated code !//}}AFX_MSGDECLARE_MESSAGE_MAP()};///////////////////////////////////////////////////////////////////////////////{{AFX_INSERT_LOCATION}}// Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_XSCJ_H__A79_4866_B8DF_7ECAB0FD4C4A__INCLUDED_)
// socket.cpp : Defines the class behaviors for the application.//#include "stdafx.h"#include "socket.h"#include "socketDlg.h"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif/////////////////////////////////////////////////////////////////////////////// CSocketAppBEGIN_MESSAGE_MAP(CSocketApp, CWinApp)//{{AFX_MSG_MAP(CSocketApp)// NOTE - the ClassWizard will add and remove mapping macros here.//
DO NOT EDIT what you see in these blocks of generated code!//}}AFX_MSGON_COMMAND(ID_HELP, CWinApp::OnHelp)END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////// CSocketApp constructionCSocketApp::CSocketApp(){// TODO: add construction code here,// Place all significant initialization in InitInstance}/////////////////////////////////////////////////////////////////////////////// The one and only CSocketApp objectCSocketApp theA/////////////////////////////////////////////////////////////////////////////// CSocketApp initializationBOOL CSocketApp::InitInstance(){if (!AfxSocketInit()){AfxMessageBox(IDP_SOCKETS_INIT_FAILED);return FALSE;}AfxEnableControlContainer();// Standard initialization// If you are not using these features and wish to reduce the size//
of your final executable, you should remove from the following//
the specific initialization routines you do not need.#ifdef _AFXDLLEnable3dControls();// Call this when using MFC in a shared DLL#elseEnable3dControlsStatic();// Call this when linking to MFC statically#endifCSocketDm_pMainWnd = &int nResponse = dlg.DoModal();if (nResponse == IDOK){// TODO: Place code here to handle when the dialog is//
dismissed with OK}else if (nResponse == IDCANCEL){// TODO: Place code here to handle when the dialog is//
dismissed with Cancel}// Since the dialog has been closed, return FALSE so that we exit the//
application, rather than start the application's message pump.return FALSE;}
// socketDlg.cpp : implementation file//#include "stdafx.h"#include "socket.h"#include "socketDlg.h"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif/////////////////////////////////////////////////////////////////////////////// CAboutDlg dialog used for App Aboutclass CAboutDlg : public CDialog{public:CAboutDlg();// Dialog Data//{{AFX_DATA(CAboutDlg)enum { IDD = IDD_ABOUTBOX };//}}AFX_DATA// ClassWizard generated virtual function overrides//{{AFX_VIRTUAL(CAboutDlg)protected:virtual void DoDataExchange(CDataExchange* pDX);
// DDX/DDV support//}}AFX_VIRTUAL// Implementationprotected://{{AFX_MSG(CAboutDlg)//}}AFX_MSGDECLARE_MESSAGE_MAP()};CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD){//{{AFX_DATA_INIT(CAboutDlg)//}}AFX_DATA_INIT}void CAboutDlg::DoDataExchange(CDataExchange* pDX){CDialog::DoDataExchange(pDX);//{{AFX_DATA_MAP(CAboutDlg)//}}AFX_DATA_MAP}BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)//{{AFX_MSG_MAP(CAboutDlg)// No message handlers//}}AFX_MSG_MAPEND_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////// CSocketDlg dialogCSocketDlg::CSocketDlg(CWnd* pParent /*=NULL*/): CDialog(CSocketDlg::IDD, pParent){//{{AFX_DATA_INIT(CSocketDlg)m_1u = 0;m_1i = 0;m_1p = 0;m_1worktime = 0;m_1dianneng = 0;m_2u = 0;m_2i = 0;m_2p = 0;m_2worktime = 0;m_2dianneng = 0;m_3u = 0;m_3i = 0;m_3p = 0;m_3worktime = 0;m_3dianneng = 0;m_4u = 0;m_4i = 0;m_4p = 0;m_4worktime = 0;m_4dianneng = 0;//}}AFX_DATA_INIT// Note that LoadIcon does not require a subsequent DestroyIcon in Win32m_hIcon = AfxGetApp()-&LoadIcon(IDR_MAINFRAME);}void CSocketDlg::DoDataExchange(CDataExchange* pDX){CDialog::DoDataExchange(pDX);//{{AFX_DATA_MAP(CSocketDlg)DDX_Control(pDX, IDC_BUTTON7, m_autoreflsh);DDX_Control(pDX, IDC_IPADDRESS4, m_mubiaoip);DDX_Control(pDX, IDC_IPADDRESS3, m_gateway);DDX_Control(pDX, IDC_IPADDRESS2, m_netmask);DDX_Control(pDX, IDC_IPADDRESS1, m_ip);DDX_Control(pDX, IDC_DATETIMEPICKER3, m_time);DDX_Control(pDX, IDC_DATETIMEPICKER2, m_date);DDX_Control(pDX, IDC_CHECK4, m_state4);DDX_Control(pDX, IDC_CHECK3, m_state3);DDX_Control(pDX, IDC_CHECK2, m_state2);DDX_Control(pDX, IDC_CHECK1, m_state1);DDX_Text(pDX, IDC_EDIT1, m_1u);DDX_Text(pDX, IDC_EDIT5, m_1i);DDX_Text(pDX, IDC_EDIT3, m_1p);DDX_Text(pDX, IDC_EDIT6, m_1worktime);DDX_Text(pDX, IDC_EDIT7, m_1dianneng);DDX_Text(pDX, IDC_EDIT8, m_2u);DDX_Text(pDX, IDC_EDIT9, m_2i);DDX_Text(pDX, IDC_EDIT10, m_2p);DDX_Text(pDX, IDC_EDIT11, m_2worktime);DDX_Text(pDX, IDC_EDIT12, m_2dianneng);DDX_Text(pDX, IDC_EDIT13, m_3u);DDX_Text(pDX, IDC_EDIT14, m_3i);DDX_Text(pDX, IDC_EDIT15, m_3p);DDX_Text(pDX, IDC_EDIT16, m_3worktime);DDX_Text(pDX, IDC_EDIT17, m_3dianneng);DDX_Text(pDX, IDC_EDIT18, m_4u);DDX_Text(pDX, IDC_EDIT19, m_4i);DDX_Text(pDX, IDC_EDIT20, m_4p);DDX_Text(pDX, IDC_EDIT21, m_4worktime);DDX_Text(pDX, IDC_EDIT22, m_4dianneng);//}}AFX_DATA_MAP}BEGIN_MESSAGE_MAP(CSocketDlg, CDialog)//{{AFX_MSG_MAP(CSocketDlg)ON_WM_SYSCOMMAND()ON_WM_PAINT()ON_WM_QUERYDRAGICON()ON_BN_CLICKED(IDC_CHECK1, OnCheck1)ON_BN_CLICKED(IDC_BUTTON2, OnButton2)ON_BN_CLICKED(IDC_BUTTON3, OnButton3)ON_BN_CLICKED(IDC_BUTTON4, OnButton4)ON_BN_CLICKED(IDC_BUTTON5, OnButton5)ON_BN_CLICKED(IDC_CHECK2, OnCheck2)ON_BN_CLICKED(IDC_CHECK3, OnCheck3)ON_NOTIFY(IPN_FIELDCHANGED, IDC_IPADDRESS4, OnFieldchangedIpaddress4)ON_BN_CLICKED(IDC_BUTTON1, OnButton1)ON_BN_CLICKED(IDC_BUTTON7, OnButton7)ON_WM_TIMER()ON_BN_CLICKED(IDC_BUTTON8, OnButton8)//}}AFX_MSG_MAPEND_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////// CSocketDlg message handlersBOOL CSocketDlg::OnInitDialog(){CDialog::OnInitDialog();// Add "About..." menu item to system menu.// IDM_ABOUTBOX must be in the system command range.ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);ASSERT(IDM_ABOUTBOX & 0xF000);CMenu* pSysMenu = GetSystemMenu(FALSE);if (pSysMenu != NULL){CString strAboutMstrAboutMenu.LoadString(IDS_ABOUTBOX);if (!strAboutMenu.IsEmpty()){pSysMenu-&AppendMenu(MF_SEPARATOR);pSysMenu-&AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);}}// Set the icon for this dialog.
The framework does this automatically//
when the application's main window is not a dialogSetIcon(m_hIcon, TRUE);// Set big iconSetIcon(m_hIcon, FALSE);// Set small icon
ipaddr="192.168.0.123";
m_mubiaoip.SetAddress(192,168,0,123); if(!hlib){AfxMessageBox("cannot load dll");return FALSE;}// TODO: Add extra initialization herem_netmask.SetAddress(255,255,255,0);m_gateway.SetAddress(192,168,0,1);m_ip.SetAddress(192,168,0,123);this-&SetTimer(1,1000,NULL); hlib=LoadLibrary("MYDLL.dll"); geti=(GETI)GetProcAddress(hlib,"get_I"); getu=(GETU)GetProcAddress(hlib,"get_U"); getp=(GETP)GetProcAddress(hlib,"get_P"); getwkt=(GETWKT)GetProcAddress(hlib,"get_worktime"); getw=(GETW)GetProcAddress(hlib,"get_W");
typedef int
(*GETSTATUS)(char *ipaddr,int num,int *status);
GETSTATUSgetstatus=(GETSTATUS)GetProcAddress(hlib,"get_status");
getstatus(ipaddr.GetBuffer(ipaddr.GetLength()),0,&tmp); if(tmp){m_state1.SetCheck(BST_CHECKED);m_state1.SetWindowText("开");} else {m_state1.SetCheck(BST_UNCHECKED);m_state1.SetWindowText("关");} getstatus(ipaddr.GetBuffer(ipaddr.GetLength()),1,&tmp);if(tmp){m_state2.SetCheck(BST_CHECKED);m_state2.SetWindowText("开");} else {m_state2.SetCheck(BST_UNCHECKED);m_state2.SetWindowText("关");}
getstatus(ipaddr.GetBuffer(ipaddr.GetLength()),2,&tmp);
if(tmp){m_state3.SetCheck(BST_CHECKED);m_state3.SetWindowText("开");} else {m_state3.SetCheck(BST_UNCHECKED);m_state3.SetWindowText("关");}
getstatus(ipaddr.GetBuffer(ipaddr.GetLength()),3,&tmp);if(tmp){m_state4.SetCheck(BST_CHECKED);m_state4.SetWindowText("开");} else {m_state4.SetCheck(BST_UNCHECKED);m_state4.SetWindowText("关");}
auto_reflsh= m_autoreflsh.SetWindowText("手动刷新");UpdateData(false);return TRUE;
// return TRUE
unless you set the focus to a control}void CSocketDlg::OnSysCommand(UINT nID, LPARAM lParam){if ((nID & 0xFFF0) == IDM_ABOUTBOX){CAboutDlg dlgAdlgAbout.DoModal();}else{CDialog::OnSysCommand(nID, lParam);}}// If you add a minimize button to your dialog, you will need the code below//
to draw the icon.
For MFC applications using the document/view model,//
this is automatically done for you by the framework.void CSocketDlg::OnPaint() {if (IsIconic()){CPaintDC dc(this); // device context for paintingSendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);// Center icon in client rectangleint cxIcon = GetSystemMetrics(SM_CXICON);int cyIcon = GetSystemMetrics(SM_CYICON);CRGetClientRect(&rect);int x = (rect.Width() - cxIcon + 1) / 2;int y = (rect.Height() - cyIcon + 1) / 2;// Draw the icondc.DrawIcon(x, y, m_hIcon);}else{CDialog::OnPaint();}}// The system calls this to obtain the cursor to display while the user drags//
the minimized window.HCURSOR CSocketDlg::OnQueryDragIcon(){return (HCURSOR) m_hI}
void CSocketDlg::OnCheck1() {UpdateData();if ( IsDlgButtonChecked( IDC_CHECK1 ) ){m_state1.SetWindowText("开");data=1;}else{m_state1.SetWindowText("关");data=0;}UpdateData(false);
typedef int
(*setstatus)(char *ipaddr,int num,int *status);lsq=(setstatus)GetProcAddress(hlib,"set_status");int ret=lsq(ipaddr.GetBuffer(ipaddr.GetLength()),0,&data);if(ret==-2){MessageBox("Cannot Connect");}else if(ret==-1){MessageBox("Connect Error");}}#include "modeset.h"void CSocketDlg::OnButton2() {// TODO: Add your control notification handler code heremodeset *dlg=new modeset(this,1);dlg-&DoModal();//CS//s.Format("插口%d",dlg-&getnum());////dlg-&SetWindowText(s); //dlg-&DoModal();}void CSocketDlg::OnButton3() {// TODO: Add your control notification handler code heremodeset *dlg=new modeset(this,2);dlg-&DoModal();}void CSocketDlg::OnButton4() {// TODO: Add your control notification handler code heremodeset *dlg=new modeset(this,3);dlg-&DoModal();}void CSocketDlg::OnButton5() {// TODO: Add your control notification handler code heremodeset *dlg=new modeset(this,4);dlg-&DoModal();}void CSocketDlg::OnCheck2() {// TODO: Add your control notification handlerUpdateData();if ( IsDlgButtonChecked( IDC_CHECK2 ) ){m_state2.SetWindowText("开");data=1;}else{m_state2.SetWindowText("关");data=0;}UpdateData(false);
typedef int
(*setstatus)(char *ipaddr,int num,int *status);lsq=(setstatus)GetProcAddress(hlib,"set_status");int ret=lsq(ipaddr.GetBuffer(ipaddr.GetLength()),1,&data);if(ret==-2){MessageBox("Cannot Connect");}else if(ret==-1){MessageBox("Connect Error");}}void CSocketDlg::reflsh(){int ret,i;int DATA[4];for(i=0;i&3;i++){ret=geti(ipaddr.GetBuffer(ipaddr.GetLength()),i,&DATA[i]);if(ret&0)MessageBox("cannot get I");}m_1i=DATA[0];m_2i=DATA[1];m_3i=DATA[2];m_4i=DATA[3];for(i=0;i&3;i++){ret=getu(ipaddr.GetBuffer(ipaddr.GetLength()),i,&DATA[i]);if(ret&0)MessageBox("cannot get U");}m_1u=DATA[0];m_2u=DATA[1];m_3u=DATA[2];m_4u=DATA[3];for(i=0;i&3;i++){ret=getp(ipaddr.GetBuffer(ipaddr.GetLength()),i,&DATA[i]);if(ret&0)MessageBox("cannot get P");}m_1p=DATA[0];m_2p=DATA[1];m_3p=DATA[2];m_4p=DATA[3];for(i=0;i&3;i++){ret=getwkt(ipaddr.GetBuffer(ipaddr.GetLength()),i,&DATA[i]);if(ret&0)MessageBox("cannot get worktime");}m_1worktime=DATA[0];m_2worktime=DATA[1];m_3worktime=DATA[2];m_4worktime=DATA[3];for(i=0;i&3;i++){ret=getw(ipaddr.GetBuffer(ipaddr.GetLength()),i,&DATA[i]);if(ret&0)MessageBox("不能获得电能");}m_1dianneng=DATA[0];m_2dianneng=DATA[1];m_3dianneng=DATA[2];m_4dianneng=DATA[3];UpdateData(false);}void CSocketDlg::OnCheck3() {UpdateData();if ( IsDlgButtonChecked( IDC_CHECK3 ) ){m_state3.SetWindowText("开");data=1;}else{m_state3.SetWindowText("关");data=0;}UpdateData(false);
typedef int
(*setstatus)(char *ipaddr,int num,int *status);lsq=(setstatus)GetProcAddress(hlib,"set_status");int ret=lsq(ipaddr.GetBuffer(ipaddr.GetLength()),2,&data);if(ret==-2){MessageBox("Cannot Connect");}else if(ret==-1){MessageBox("Connect Error");}}void CSocketDlg::OnFieldchangedIpaddress4(NMHDR* pNMHDR, LRESULT* pResult) {// TODO: Add your control notification handler code here*pResult = 0;unsigned char a,b,c,d;m_mubiaoip.GetAddress(a,b,c,d);ipaddr.Format("%d,%d,%d,%d",a,b,c,d);}typedef struct {}MYDATE;typedef struct {}MYTIME;void CSocketDlg::OnButton1() //设置网络和时间{// TODO: Add your control notification handler code here unsigned char a[4];MYTIMEMYDATEUpdateData();m_ip.GetAddress(a[0],a[1],a[2],a[3]);//设置ip地址typedef int
(*SETIP)(char *ipaddr,unsigned char *a); SETIPsetip=(SETIP)GetProcAddress(hlib,"set_ipaddr");
ret=setip(ipaddr.GetBuffer(ipaddr.GetLength()),a);if(ret&0)MessageBox("Cannot set ipaddress");
m_netmask.GetAddress(a[0],a[1],a[2],a[3]);//设置子网掩码typedef int
(*SETMASK)(char *ipaddr,unsigned char *a);SETMASKsetmask=(SETMASK)GetProcAddress(hlib,"set_mask");ret=setmask(ipaddr.GetBuffer(ipaddr.GetLength()),a);if(ret&0)MessageBox("Cannot set netmask"); m_gateway.GetAddress(a[0],a[1],a[2],a[3]);//设置网关typedef int
(*SETGATEWAY)(char *ipaddr,unsigned char *a);SETGATEWAYsetgateway=(SETGATEWAY)GetProcAddress(hlib,"set_gateway");ret=setgateway(ipaddr.GetBuffer(ipaddr.GetLength()),a);if(ret&0)MessageBox("Cannot set gateway"); CT//设置时间m_time.GetTime(time);mytime.shi=time.GetHour();mytime.fen=time.GetMinute();mytime.miao=time.GetSecond();
m_date.GetTime(time);mydate.year=time.GetYear();mydate.month=time.GetMonth();mydate.day=time.GetDay();
typedef int (*SETTIME)(char *ipaddr,MYTIME *time);SETTIMEsettime=(SETTIME)GetProcAddress(hlib,"set_time");ret=settime(ipaddr.GetBuffer(ipaddr.GetLength()),&mytime);if(ret&0)MessageBox("Cannot set time");
typedef int (*SETDATE)(char *ipaddr,MYDATE *date);SETDATEsetdate=(SETDATE)GetProcAddress(hlib,"set_date");ret=setdate(ipaddr.GetBuffer(ipaddr.GetLength()),&mydate);if(ret&0)MessageBox("Cannot set date"); }void CSocketDlg::OnButton7() {
if(auto_reflsh)
{auto_reflsh=m_autoreflsh.SetWindowText("自动刷新");
{auto_reflsh=m_autoreflsh.SetWindowText("手动刷新");
}}void CSocketDlg::OnTimer(UINT nIDEvent) {// TODO: Add your message handler code here and/or call defaultCDialog::OnTimer(nIDEvent);if(auto_reflsh)this-&reflsh();}void CSocketDlg::OnButton8() {this-&reflsh();// TODO: Add your control notification handler code here}
/ / STDAFX.CPP:只包括标准包含的源文件/ / socket.pch的将是预编译头/ / 将包含StdAfx.obj的预编译类型信息#包括“stdafx.h中”
链接错误啊,你没放kernel32.lib这个文件
登录百度帐号推荐应用
为兴趣而生,贴吧更懂你。或}

我要回帖

更多关于 求ps高手帮忙 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信