为什么调用失败呢? [问题点数:40分,结帖人xuliangone1]

Bbs1
本版专家分:0
结帖率 99.23%
Bbs4
本版专家分:1979
Bbs9
本版专家分:64129
Blank
金牌 2014年11月 总版技术专家分月排行榜第一
Blank
银牌 2015年2月 总版技术专家分月排行榜第二
Blank
红花 2015年2月 Web 开发大版内专家分月排行榜第一
2015年1月 Web 开发大版内专家分月排行榜第一
2014年12月 Web 开发大版内专家分月排行榜第一
2014年11月 Web 开发大版内专家分月排行榜第一
2014年10月 Web 开发大版内专家分月排行榜第一
Blank
黄花 2016年1月 Web 开发大版内专家分月排行榜第二
2015年12月 Web 开发大版内专家分月排行榜第二
2015年11月 Web 开发大版内专家分月排行榜第二
2015年10月 Web 开发大版内专家分月排行榜第二
2015年8月 Web 开发大版内专家分月排行榜第二
2015年5月 Web 开发大版内专家分月排行榜第二
Bbs3
本版专家分:822
Bbs12
本版专家分:396068
版主
Blank
探花 2017年 总版技术专家分年内排行榜第三
Blank
进士 2018年总版新获得的技术专家分排名前十
2013年 总版技术专家分年内排行榜第五
Blank
金牌 2018年5月 总版技术专家分月排行榜第一
2018年4月 总版技术专家分月排行榜第一
2018年2月 总版技术专家分月排行榜第一
2017年8月 总版技术专家分月排行榜第一
Blank
银牌 2018年3月 总版技术专家分月排行榜第二
2017年11月 总版技术专家分月排行榜第二
2016年2月 总版技术专家分月排行榜第二
2014年2月 总版技术专家分月排行榜第二
2013年4月 总版技术专家分月排行榜第二
为什么跟踪失败呢?
我设单步,当step out(shift+F11)就跳出个菜单上写Can't trace into system DLLs. rn请大侠指教,谢谢! rn我在学校的机子上没有上述提示,在自己机子上就有,是不是VC设置问题呢?? rnrn
调用SetWindowLong为什么失败
我想在创建的窗口上附加一个类的指针,用如下代码:rnrnWNDCLASS wndclass;rnconst char *ProviderClass = "TestWindow";rnHWND Window;rn rnwndclass.style = CS_HREDRAW | CS_VREDRAW;rnwndclass.lpfnWndProc = (WNDPROC)WindowProc;rnwndclass.cbClsExtra = 0;rnwndclass.cbWndExtra = 4;rnwndclass.hInstance = NULL;rnwndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);rnwndclass.hCursor = LoadCursor(NULL, IDC_ARROW);rnwndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);rnwndclass.lpszMenuName = NULL;rnwndclass.lpszClassName = ProviderClass;rn rnif (RegisterClass(&wndclass) == 0) return NULL;rn rn// Create a window.rnif ((Window = CreateWindow(rn ProviderClass,rn "",rn WS_OVERLAPPEDWINDOW,rn CW_USEDEFAULT,rn CW_USEDEFAULT,rn CW_USEDEFAULT,rn CW_USEDEFAULT,rn NULL,rn NULL,rn NULL,rn NULL)) != NULL)rnrn Wnd *w = new Wnd;rn if ( long s = SetWindowLong(Window, 0, (long)w ) )rn return Window;rnrn long code = GetLastError();rn rn DestroyWindow(Window);rn Window = 0;rn rn return NULL;rnrnrn但是SetWindowLong执行错误,错误码是42(66"网络资源类型错误。")。不知道<em>为什么</em>?rn
为什么SetWallpaper调用失败
void SetDesktopWallpaper()rnrn HRESULT hr;rn IActiveDesktop *pActiveDesktop;rn CoInitialize(NULL); rn hr = CoCreateInstance(CLSID_ActiveDesktop, NULL, CLSCTX_INPROC_SERVER,IID_IActiveDesktop, (void**)&pActiveDesktop);rn if (hr!=S_OK)rn return;rn WALLPAPEROPT wpOptions;rn wpOptions.dwSize = sizeof(WALLPAPEROPT);rn wpOptions.dwStyle = WPSTYLE_STRETCH;rn hr=pActiveDesktop->SetWallpaperOptions(&wpOptions,0); rnrn COMPONENTSOPT comps;rn comps.dwSize = sizeof comps;rn comps.fEnableComponents = TRUE;rn comps.fActiveDesktop = TRUE;rn rn hr=pActiveDesktop-> SetDesktopItemOptions(&comps,0); rn //Insert code to call the IActiveDesktop methodsrn rnrn if(FAILED(pActiveDesktop->SetWallpaper(L"D;\\1.jpg",0)))rn return; rn hr=pActiveDesktop->ApplyChanges(AD_APPLY_ALL); rn rn pActiveDesktop->Release();rn CoUninitialize();rnrnrnrnhr 返回一直是S_OKrn执行完成后,桌面显示蓝色背景,且右键桌面属性->桌面图片就是设置的图片名 rn<em>为什么</em>就是不显示? 哪位高手解答一下,谢谢
为什么调用_syscall1失败
最近在做哈工大的操作系统实验,做到第二个的时候出现了一些问题,怎么也解决不了。就是<em>调用</em>_syscall1或者_syscall2的时候,GCC老是报错说里面的参数是未知类型,,我看有的人加 分号 ; 有的人不加,我两个都试了 都不能编译成功rn[img=https://img-bbs.csdn.net/upload/201810/03/1538565273_545100.png][/img]rn[img=https://img-bbs.csdn.net/upload/201810/03/1538565355_1454.png][/img][img=https://img-bbs.csdn.net/upload/201810/03/1538565361_932983.png][/img]rnrn
为什么调用对话框失败?
我<em>调用</em>对话框的部分程序如下:rn#include "stdafx.h"rn#include "nana.h"rn#include "nanaDlg.h"rn#include "Search.h"rn#include "onnect.h"rn#include "circle.h"rn.....................................rn......................................rnvoid CNanaDlg::OnOK() rnrn // TODO: Add extra validation herern rn CDialog::OnOK();rn UpdateData(true);rn if(m_choice=="1. 顶点查找和图的遍历")rn Search a;rn a.DoModal();rn rn else if(m_choice=="8. 求有向图中的强连通分量")rn Connect b;rn b.DoModal();rn rn else if(m_choice=="6. Euler回路和Hamilton回路")rn circle c;rn c.DoModal();rn rnrn<em>调用</em>Connect这个对话框成功,却<em>调用</em>circle这个对话框<em>失败</em>,好奇怪rn而且我在circle.cpp中已经加入了rn#include "nana.h"rn#include "nanaDlg.h"rn#include "circle.h"rn这些头文件rn其中nana 是主对话框rn
调用CreateFile失败为什么
我在远程登入了2003系统,并运行一个服务控制管理器的程序"Server.exe"。rn"Server.exe"中创建了一个主线程,主线程创建了一个邮槽服务:rnCreateMailslot("\\\\.\\mailslot\\my_mailslot", 0, MAILSLOT_WAIT_FOREVER, (LPSECURITY_ATTRIBUTES) NULL);rnrn然后主线程中又创建了1个应用程序进程"A.exe"rn在"A.exe"中<em>调用</em>CreateFile打开这个邮槽:rnCreateFile("\\\\*\\mailslot\\my_mailslot", GENERIC_WRITE, FILE_SHARE_READ, (LPSECURITY_ATTRIBUTES) NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, (HANDLE) NULL); rn(1)这样<em>调用</em>的时候局域网和本地貌似都没错,但是如果我是在外网远程登入的时候,请问下这个第一个参数该填什么,底下那个servername该怎么填写,怎么得到。有没有什么API函数可以得到的。rn(2)my_mailslot这个填写绝对路径不行吗?我填写"D:\\Text\\my_mailslot"这样有错?rn(3)还有就是我在主线程结束前,<em>调用</em>PostThreadMessage(pProcInfo.dwThreadId, WM_QUIT, 0, 0)关闭"A.exe"的窗口时候会出现1444的错误报告,这个该怎么解决?rn(备注:pProcInfo.dwThreadId是前面创建"A.exe"进程的时候<em>调用</em>CreateProcessAsUser的最后一个参数)rnrn参考:rn 邮槽名字类型rn--------------------------------------------------------------------------------------------------------------------------rn名字格式 说 明rn--------------------------------------------------------------------------------------------------------------------------rn\\.\mailslot\name 标定同一台机器上的一个本地邮槽rn\\servername\mailslot\name 标定名为servername的一个远程邮槽服务器rn\\domainname\mailslot\name 标定在指定的domain(域)内,使用特定name(名字)的所有邮槽rn\\*\mailslot\name 标定系统主域内,标定特定name(名字)的所有邮槽rn--------------------------------------------------------------------------------------------------------------------------
wsasocket 为什么调用失败
请教一下,<em>为什么</em> 这个<em>调用</em><em>失败</em>rn m_hListenSocket = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, NULL, WSA_FLAG_OVERLAPPED);rnwsagetlasterror 返回错误6,句柄无效rnrn已经包含rn#pragma comment(lib,"ws2_32")rn#include rnrn执行wsasocket前<em>调用</em>rn WORD wVersionRequested;rn WSADATA wsaData;rn int err;rn rn wVersionRequested = MAKEWORD( 2, 2 );rn rn err = WSAStartup( wVersionRequested, &wsaData );rn if ( err != 0 ) rn return FALSE;rn rnrn rn if ( LOBYTE( wsaData.wVersion ) != 2 ||rn HIBYTE( wsaData.wVersion ) != 2 ) rn WSACleanup( );rn return FALSE; rn rnrnrn
为什么调用SetWindowHookEx失败
我的代码如下:rnhThread = CreatThread(NULL, 0, ThreadProc, NULL, 0, &dwThreadID);rnif(hThread != NULL)rnrn //下面这个语句<em>调用</em><em>失败</em>.rn hHook = SetWindowHookEx(WH_CBT, HookProc, NULL, dwThreadID);rnrn //下面这个语句执行成功.rn hHook = SetWindowHookEx(WH_CBT, HookProc, NULL, GetCurrentThreadID());rnrnrn请问各位大虾,<em>为什么</em>第一个语句<em>失败</em>?
为什么RegQueryValue调用失败
rnBOOL COption::Register()rnrn CString str;rn HKEY hRegKey;rn BOOL bResult;rn str = _T("Software\\Microsoft\\Windows\\CurrentVersion\\Run");rn if(::RegOpenKey(HKEY_LOCAL_MACHINE, str, &hRegKey) != ERROR_SUCCESS) rn rn bResult = FALSE;rn rn elsern rn char Transfer_Get[100];rn long Len = 100;rn if (::RegQueryValue(hRegKey,"Transfer",Transfer_Get,&Len) != ERROR_SUCCESS)//查询键值 rn rn bResult = FALSE;rn rn elsern rn bResult = TRUE;rn rn rnrn RegCloseKey(hRegKey);rn return bResult;rnrnrn我的应用程序名为Transfer,注册了开机自动运行,但是<em>为什么</em>我用上面的查询函数时RegQueryValue总是<em>调用</em><em>失败</em>?
为什么守护进程调用调用getlogin会失败呢?
<em>为什么</em>守护进程<em>调用</em><em>调用</em>getlogin会<em>失败</em>呢?,谢谢了rn
网页编辑器调用失败,怎么回事呢?
我下载http://www.javaclass.cn/others/edit.rar编辑器,编辑器的<em>调用</em>文件为HtmlEdit.html。rn可我在需要<em>调用</em>的地方加如下以下代码rn rn rn提交后affichecontent没有存入内容,怎么回事呢?rn
为什么fopen打开失败呢?
bool Creat_Text(const char* str, const char* filename)nn char path[1024] = 0;n GetCurrentDirectory(1024, (LPWSTR)path);n strcat(path,"//");n strcat(path,filename);nn FILE* fp = fopen(path,"a+");n if (NULL == fp)n n return false;n nn fputs(str,fp);nn fclose(fp);n return true;n_
打开串口失败 为什么呢?
VS08下编的win32程序 打开串口 <em>失败</em><em>为什么</em>呢?rn 建的是STANDARDSDK MIPSII平台设备的 程序放入设备中,设备串口和电脑PC机相连 rn 运行后,发现程序 打开串口<em>失败</em>?rn 有哪几种原因呢?驱动方面有问题?是不是驱动方面对串口的配置不对呢?还是怎么呢? 我不懂驱动rnvoid SendData(HDC hdc,LPCSTR buffer)rnrn HANDLE hcom;rn COMMCONFIG cc;rn DCB dcb;rn DWORD pt;rn RECT rect=20,20,60,60;rn hcom=CreateFile(L"COM1:",GENERIC_WRITE|GENERIC_READ,0,NULL,OPEN_EXISTING,NULL,NULL);rn if(hcom==INVALID_HANDLE_VALUE)rn rn DrawText(hdc,L"fail",5,&rect,DT_CENTER);rn return;rn rn GetCommState(hcom,&dcb);rn dcb.BaudRate=CBR_9600;rn dcb.fBinary=TRUE;rn dcb.fParity=FALSE;rn dcb.ByteSize=8;rn dcb.Parity=NOPARITY;rn dcb.StopBits=ONESTOPBIT;rn dcb.fRtsControl=RTS_CONTROL_ENABLE;rn dcb.fDtrControl=DTR_CONTROL_ENABLE;rn SetCommState(hcom,&cc.dcb);rn WriteFile(hcom,buffer,2,&pt,&ov);rnrnrn是不是也要在驱动中,把串口配置名为 COM1呢 (设备中共有两个串口)
为什么安装VC6.0失败
我的电脑是win2000专业版本,加SP4补丁,加OFFICE2000rn<em>为什么</em>安装VC6.0与VB6.0时,总到最后文件复制完毕后,提示安装<em>失败</em>,详细查看www.microsoft.com/msdn
装载图片失败----为什么呢?
rnrnrn BITMAP bm;rn HBITMAP hBitmap;rn HDC hSrcDC; rnrnrnhSrcDC = CreateCompatibleDC(m_memodc->m_hDC );rn hBitmap=(HBITMAP)LoadImage(AfxGetInstanceHandle(),temp,IMAGE_BITMAP,0,0,LR_LOADFROMFILE |LR_SHARED);//|LR_CREATEDIBSECTION);rn rn sint=GetObject(hBitmap, sizeof BITMAP, &bm);rn SelectObject(hSrcDC, hBitmap);rn rn GetClientRect(&rect);rn ::SetStretchBltMode(m_memodc->m_hDC ,COLORONCOLOR); rn ::StretchBlt(m_memodc->m_hDC, rect.left, rect.top, rect.right, rect.bottom, hSrcDC, 0, 0, bm.bmWidth, bm.bmHeight,+SRCCOPY);rnrnrn///以上代码运行一段时间后就出现图片文件装载<em>失败</em>rn///代码本身是每隔10多秒就装载一幅图,然后再在memode上做图,再显示出来,rn///可是到后面就显示不出来做为背景的图片了?rn///求救高手,谢谢rn
loadXML总是失败为什么呢?
环境是 vs2008,一个从vc6.0升级上来的工程。rn在使用loadXML的是,总是无法成功。rn测试用的xml文档可以ie里头正确显示。rnCoUninitialize();rn是已经<em>调用</em>了的。rnrnbool HtmlItf::IsSuccess(BSTR sXML)rnrnrnIXMLDOMDocument *pXmlDoc=NULL; rnrnHRESULT hr=CoCreateInstance(CLSID_DOMDocument,NULL, CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER/*CLSCTX_ALL*/, IID_IXMLDOMDocument,(LPVOID*)&pXmlDoc); rnrnif(hr == S_OK)rnrnVARIANT_BOOL bFlag=VARIANT_FALSE;rnpXmlDoc->put_async(VARIANT_FALSE);rnpXmlDoc->put_validateOnParse(VARIANT_TRUE);rnhr = pXmlDoc->loadXML(sXML,&bFlag); ///get_documentElement(&pNodeElement);rnrnif(hr != S_OK)return false;rnrnIXMLDOMNodeList *pNodeList;rnrnhr = pNodeElement->get_childNodes(&pNodeList);rnrnif(hr == S_OK)rnrnIXMLDOMNode *pStateNode;rnBSTR s;rnBSTR sNodeName;rnlong NodeLen;rnpNodeList->get_length(&NodeLen);rnfor(int i=0;iget_item(i,&pStateNode);rnpStateNode->get_nodeName(&sNodeName);rnpStateNode->get_text(&s);rnif(sNodeName = BSTR("state"))rnrnif(s==BSTR("0"))rnreturn false;rnelse if(s==BSTR("1"))rnreturn true;rnrnrnrnrnrnreturn false;rn
为什么创建文件总是失败呢?
rn普通用户, 用open函数创建文件(不存在该文件)rnfd = open( path, O_CREAT | O_RDWR, S_IRUSE | S_IWUSR );rnrn<em>为什么</em>这样创建文件总是<em>失败</em>呢?如果时超级用户就没有这个问题。
为什么不能调用呢?
void GetData(float **p)rnrn CString s;rn s.Format("%f",p[0][0]);rn ::AfxMessageBox(s);rnrnvoid CDoblePointersDlg::OnOK() rnrn int row(5),col(4);rn float p[5][4];rn GetData((float**)p);rn CDialog::OnOK();rnrn
两次调用++,编译失败,为什么?
[code=C/C++]rnint main(void)rn int i=0;rn int j=++i++;rn return 0;rn[/code]rnrn我的用意是: i加1,赋值给j,然后i自己再加1。结果是i=2,j=1。rn可是就是这3行代码,在VC10下面编译,竟然有错:rnrnerror C2105: '++' needs l-valuernrn错在哪里呢?
为什么isleadbyte调用失败
就是想试验一下isleadbyte的有效性,使用如下代码: rn rn const char str[] = "字母a是一个字节的"; rn rn int nLen = strlen(str); rn int nLead = 0; rn rn for (int i = 0; i , nLen, nLead); rn rn 结果输出: nLen: 17 rn nLead: 0 rn rn 就是一个前导字符都没找到啊,为深么啊? rn 这个函数使用有问题?
SetFocus函数为什么调用失败
我看了MSDN中的描述:If the function succeeds, the return value is the handle to the window that previously had the keyboard focus. If the hWnd parameter is invalid or the window is not attached to the calling thread's message queue, the return value is NULL. To get extended error information, call GetLastError.rnrn说有两种情况会<em>失败</em>:rn1 hWnd parameter is invalid rn2 the window is not attached to the calling thread's message queuernrn我看了,不是第二种情况。rn我想知道,什么叫“hWnd parameter is invalid ”,而且我<em>调用</em>GetLastError返回0.rnrnrnrn
为什么调用 DialogBox 会失败
#include "stdafx.h"rn#include "resource.h"rnBOOL CALLBACK DialogProc(rn HWND hwndDlg, // handle to dialog boxrn UINT uMsg, // messagern WPARAM wParam, // first message parameterrn LPARAM lParam // second message parameterrn)rnrnswitch(uMsg)rnrncase WM_INITDIALOG:rnreturn TRUE;rncase WM_COMMAND:rnif(LOWORD(wParam)==IDOK||LOWORD(wParam)==IDCANCEL)rnEndDialog(hwndDlg,LOWORD(wParam));rnreturn TRUE;rnrnrnreturn false;rnrnint APIENTRY WinMain(HINSTANCE hInstance,rn HINSTANCE hPrevInstance,rn LPSTR lpCmdLine,rn int nCmdShow)rnrnif(DialogBox(hInstance,MAKEINTRESOURCE(IDD_CHAT_DIALOG),NULL,(DLGPROC)DialogProc)==-1)rn rnMessageBox(NULL,"Call DialogBox failed.","Error",MB_ICONEXCLAMATION);rnreturn -1;rn rnreturn 0;rnrnrnrnNew->Win32 Application->A simple Win32 application->finishrnrn然后 Insert->Recource 插入对话框,编译没有错误,可对话框就是不显示,请问这是<em>为什么</em>呢?但我改成 New->Win32 Application->A typicl "hello World" application->finish 就可以显示对话框,这是<em>为什么</em>呢?rnrn
为什么调用StgCreateDocfile会失败
IStorage *pStg=NULL;rnHRESULT hr=::StgCreateDocfile(L"D:\\MyStorageFile",rn STGM_READWRITE,rn 0,&pStg);rnif(FAILED(hr))rnrn cout<;rn exit(0);rnrn谢谢
为什么调用InterruptInitialize总是失败
我现在做can总线的驱动,在中断部分<em>调用</em>InterruptInitialize总是<em>失败</em>,下面是我的代码rnhEvent=CreateEvent(0,FALSE,FALSE,NULL);rn if(hEvent)rn rn RETAILMSG(1,(TEXT("CAN:CreateEvent_okaaaaaaaaaaaaaaaaaaaa"))); rn rn rn hCanThread=CreateThread(NULL,rn 0,rn CanIST,rn NULL,rn CREATE_SUSPENDED,rn &dwThreadID);rn if(hCanThread)rn rn RETAILMSG(1,(TEXT("CANTHREAT:CREATETHREAD_OKhhhhhhhhhhhhhhhhhhhhhhhhhh\n")));rn rn elsern rn RETAILMSG(1,(TEXT("CANTHREAT:CREATETHREAD_FALSEhhhhhhhhhhhhhhhhhhhhhhhhhh\n")));rn return 0;rn rnrn dwISTPriority=253;rnrn if(!CeSetThreadPriority(hCanThread,dwISTPriority))rn rn RETAILMSG(1,(TEXT("CeSetThreadPriority Failed!!hhhhhhhhhhhhhhhhhhhhhhhhhh\n")));rn rn if(!InterruptInitialize(SYSINTR_CAN,hEvent,NULL,0))rn rn RETAILMSG(1,(TEXT("InterruptInitialize Failed!!hhhhhhhhhhhhhhhhhhhhhhhhhh\n")));rn rn ResumeThread(hCanThread);rn前面的几步都没有问题,就是在连接系统中断号和事件的时候<em>失败</em>?rn我的其他中断的设置都做了,驱动编译没有问题rn请大家帮忙rn
为什么调用Shell_NotifyIcon函数失败
<em>调用</em>rnPublic Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias " Shell_NotifyIconA" ( _rn ByVal dwMessage As Long, _rn lpData As NOTIFYICONDATA _rn) As Longrn函数时,系统提示Can't find DLLentry point Shell_NotifyIconA in shell32.dll这样的错误。我该怎样<em>调用</em>它才能避免发生上面的错误了?rn
调用很简单的存储过程,失败为什么
存储过程:rnCREATE PROCEDURE pro_system rn@newsystemid varchar(30), rn@systemname varchar(60),rn@systemmanid varchar(200),rn@systemman varchar(200)rnASrn insert into Tsystem(systemid,systemname,systemmanid,systemman) values (@newsystemid,@systemname,@systemmanid,@systemman)rnGOrn---------------------------------------------------------------------------------------rnBeanFunction:rnrnpackage test2;rnimport java.sql.*;rnimport java.util.List;rnrnpublic class BeanFunction rnrn public Connection Pcon;rn public Statement Pstatement;rnrn //连接rn public Statement con_statement()throws Exceptionrn rn tryrn rn Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();rn Pcon = java.sql.DriverManager.getConnection("jdbc:microsoft:sqlserver://wjh:1433;DatabaseName=wjh", "sa", "");rn Pstatement = Pcon.createStatement();rn return Pstatement;rn rn catch(Exception e)rn rn e.printStackTrace();rn return null;rn rn rn rn //新增rn public void insert()throws Exceptionrn rn tryrn rn con_statement().execute("insert Tsystem (systemid,systemname,systemmanid,systemman,popedom) values('11','22','33','44','55')");rn Pstatement.close();rn Pcon.close();rn rn catch(Exception e)rn rn e.printStackTrace();rn rn rnrn //存储过程rn public void doStore()throws Exceptionrn rn String strSQL = "call pro_system";rn java.sql.CallableStatement sqlStmt = Pcon.prepareCall(strSQL);rn rn sqlStmt.setString(1,"11");rn sqlStmt.setString(2,"22");rn sqlStmt.setString(3,"33");rn sqlStmt.setString(4,"44");rnrn sqlStmt.executeUpdate();rn sqlStmt.close();rn Pcon.close();rn rnrn---------------------------------------------------------------------------------------rnjsp:rn...rnrnrnrn...rn-------------------------------------------------------------------------------------rn运行:rn其中A是正确的。rn而B出错,错误信息为:rnjava.lang.NullPointerExceptionrn at test2.BeanFunction.doStore(BeanFunction.java:114)rn at org.apache.jsp.open_0005fjsp$jsp._jspService(open_0005fjsp$jsp.java:101)rn at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)rn ...rn请问<em>为什么</em>呀?
CoCreateInstance 调用成功, CoGetClassObject 调用失败,为什么?
同题,rn我只是用ATL 的向导程序,建立EXE(进程外) 工程, 并且添加一个普通ATL COM 对象,rnrn<em>为什么</em>在客户程序中<em>调用</em>CoCreateInstance成功,但<em>调用</em>CoGetClassObject 却<em>失败</em>.rnrn在<em>调用</em>CoGetClassObject 我检查到Server EXE 曾经载入过内存,但CoGetClassObject <em>失败</em>后,就从内存中卸了.rnrn<em>为什么</em>会这样呢??rnrn(我是想实现单例,类工厂同时实现了客户要求的功能,所有客户都使用同一个工厂对象实例)
请问各位大哥为什么我会调用失败呢?
http://www.cnblogs.com/moonlightpoet/p/5617478.html 这个网址。<em>为什么</em>我最后<em>调用</em>dog.getBreed()<em>失败</em>?? 无法输出Great Dane
为什么win7下调用ReadProcessMemory()总是返回失败呢?
代码如下:rnHANDLE hProc = OpenProcess(PROCESS_VM_READ,FALSE,dwPID);rn if(hProc)rn rn DWORD dwRet = -1;rn DWORD dwAddr = *(DWORD*)((DWORD)GetCommandLine + 1);rn TCHAR tcBuf[buffLen];rn DWORD dwRead = 0; rnrn [color=#0000FF]ReadProcessMemory[/color](hProc,(LPVOID)dwAddr,&dwAddr,4,&dwRead);rn rnrn在xp、server2003上都没问题。rn
为什么不能调用GetListCtrl()呢?
我用VC 6.0新建了一个SDI的工程,名为GuestBook,在最后一步中将视图类的基类改为CListView,建完工程后,我马上往类rnCGuestBookView添加成员函数void ShowAllRecord(),在函数ShowAllRecord()中我写了如下代码:rnrn[color=#FF0000]CListCtrl &List=GetListCtrl();rnList.InsertItem(0,"");//注:我已经在程序初始化时插入列了。...[/color]rnrn结果编绎时,出现如下错误:rnerror C2352: 'CListView::GetListCtrl' : illegal call of non-static member functionrn e:\program files\microsoft visual studio\vc98\mfc\include\afxcview.h(66) : see declaration of 'GetListCtrl'rnrn//错误的提示意思是:我非法<em>调用</em>了函数GetListCtrl(),原因是函数GetListCtrl()不是一个static函数rn//难道让我将函数GetListCtrl()改为static才可以<em>调用</em>吗?无语啊!...rnrn我看了一下GetListCtrl()函数在类CListView的声明,原型如下:rnpublic:rn CListCtrl& GetListCtrl() const;rnrn按理说,子类应该可以<em>调用</em>父类的public函数啊!<em>为什么</em>会出错呢!想不通呢!求解释!...rn
为什么调用GetParent()呢!
void CSpecialFileDialog::OnDelete() rn rn m_bDeleteAll = TRUE; rn GetParent()->GetDlgItem(0x480)->GetWindowText(m_strFilename); rn GetParent()->SendMessage(WM_COMMAND, IDCANCEL); rn rn请问控件0x480和IDCANCEL都在CSpecialFileDialog对话框中,那么<em>为什么</em>在类CSpecialFileDialog中引用该控件要<em>调用</em>GetParent()呢!
为什么如下的调用不起作用呢
cuda 内核执行失败 为什么呢?
联系归约算法时,出现错误,很是不解,下面是程序代码(部分);望高手指点一二#includern#includern#includern#include rn#include rn#include rn#include rn__global__ void kernel1(float *idata,float *odata)rnrnint id=blockIdx.x*blockDim.x+threadIdx.x;rnint index=threadIdx.x;rnextern __shared__ float sp[];rnsp[index]=idata[id];rn__syncthreads();rnfor(int i=1;i>>(d_p1,d_p2);rncutilCheckMsg("Kernel execution failed\n");rnfloat sum[32];rncudaMemcpy(sum,d_p2,32*sizeof(float),cudaMemcpyDeviceToHost);rnfor(int i=0;i,sum);rnrn执行结果如下:rn cutilCheckMsg cudaThreadSynchronize error:Kernel execution failed : unspecified launch failure.rn
为什么文件打开会失败了呢
要什么情况下会造成文件打开<em>失败</em>,rn排除C++中规定打开<em>失败</em>的情况有四种:rn1)指定的路径不存在rn2)指定的盘符不存在rn3)文件名中含有无效字符rn4)以r(读)模式打开一个不存在的文件 rnrnrnrnrn[code=C/C++]#include "stdafx.h"rnusing namespace std;rnifstream &open_file(ifstream &,string &);rnifstream &open_file(ifstream &in,string &file)rnrn in.close();rn in.clear();rn in.open(file.c_str());rn return in;rnrnint main()rnrn ofstream write;rn string line;rn string name("E:\book.txt");rn write.open(name.c_str()); //打开<em>失败</em>了rn if(!write)rn throw runtime_error("打开要写入书目的文件<em>失败</em>");rn while(getline(cin,line))rn write << line;rn write.close();rn write.clear();rn ifstream input;rn if(!open_file(input,name))rn throw runtime_error("打开要读的书目文件<em>失败</em>"); rn set rbook;rn string bookname;rn while(input >> bookname)rn rn pair::iterator,bool> pa;rn set::iterator iter = rbook.find(bookname);rn if(iter == rbook.end())rn rn cout << bookname << " 这本书没有读过 现在取出来读" << endl;rn bool read;rn cout << bookname << " 这本书是不是放在一边没有读? 请输入true OR false " << endl;rn cin >> read;rn if(read)rn rn cout << "现在重新把 " << bookname << " 放到未读的书的名单中" << endl;rn pa = rbook.insert(bookname);rn continue;rn rn elsern cout << "现在把 " << bookname << " 放到已阅的书目中去" << endl;rn rn rn input.close();rn input.clear();rn return 0;rn[/code]
为什么这个程序会载入失败
这个程序总是载入<em>失败</em>各位大侠能帮我看看问题出在哪儿吗?rnimport java.awt.*;rnimport java.awt.event.*;rnimport java.applet.*;rnrnclass MenuFrame extends Framernrn String msg="";rn CheckboxMenuItem debug,test;rn MenuFrame(String title)rn rn super(title);rn MenuBar mbar=new MenuBar();rn setMenuBar(mbar);rn rn Menu file=new Menu("File");rn MenuItem item1,item2,item3,item4,item5;rn file.add(item1=new MenuItem("New..."));rn file.add(item2=new MenuItem("Open..."));rn file.add(item3=new MenuItem("Close"));rn file.add(item4=new MenuItem("-"));rn file.add(item5=new MenuItem("Quit..."));rn mbar.add(file);rn rn Menu edit=new Menu("Edit");rn MenuItem item6,item7,item8,item9;rn edit.add(item6=new MenuItem("Cut"));rn edit.add(item7=new MenuItem("Copy"));rn edit.add(item8=new MenuItem("Paste"));rn edit.add(item9=new MenuItem("-"));rn rn Menu sub=new Menu("Special");rn MenuItem item10,item11,item12;rn sub.add(item10=new MenuItem("First"));rn sub.add(item11=new MenuItem("Second"));rn sub.add(item12=new MenuItem("Thrid"));rn edit.add(sub);rn rn debug=new CheckboxMenuItem("Debug");rn test=new CheckboxMenuItem("Testing");rn edit.add(debug);rn edit.add(test);rn rn mbar.add(edit);rn MyMenuHandler handler=new MyMenuHandler(this);rn rn item1.addActionListener(handler);rn item2.addActionListener(handler);rn item3.addActionListener(handler);rn item4.addActionListener(handler);rn item5.addActionListener(handler);rn item6.addActionListener(handler);rn item7.addActionListener(handler);rn item8.addActionListener(handler);rn item9.addActionListener(handler);rn item10.addActionListener(handler);rn item11.addActionListener(handler);rn item12.addActionListener(handler);rn debug.addItemListener(handler);rn test.addItemListener(handler);rn rn MyWindowAdapter adapter=new MyWindowAdapter(this);rn addWindowListener(adapter);rn rn rn public void paint(Graphics g)rn rn g.drawString(msg,10,200);rn if(debug.getState())rn g.drawString("Debug is on.",10,220);rn elsern g.drawString("Debug is off.",10,220);rn if(test.getState())rn g.drawString("Testing is on.",10,240);rn elsern g.drawString("Testing is off.",10,240);rn rn rn rn rnrnrnclass MyWindowAdapter extends WindowAdapterrnrn MenuFrame menuFrame;rn public MyWindowAdapter(MenuFrame menuFrame)rn this.menuFrame=menuFrame;rn rn public void windowClosing(WindowEvent we)rn menuFrame.setVisible(false);rn rnrnrnclass MyMenuHandler implements ActionListener,ItemListenerrnrn MenuFrame menuFrame;rn rn public MyMenuHandler(MenuFrame menuFrame)rn this.menuFrame=menuFrame;rn rn public void actionPerformed(ActionEvent ae)rn rn String msg="You selected ";rn String arg=(String)ae.getActionCommand();rn if(arg.equals("New..."))rn msg+="New";rn else if(arg.equals("Open..."))rn msg+="Open";rn else if(arg.equals("Close"))rn msg+="Open";rn else if(arg.equals("Quit..."))rn msg+="Quit";rn else if(arg.equals("Cut"))rn msg+="Cut";rn else if(arg.equals("Copy"))rn msg+="Copy";rn else if(arg.equals("Paste"))rn msg+="Paste";rn else if(arg.equals("Frist"))rn msg+="First";rn else if(arg.equals("Second"))rn msg+="Second";rn else if(arg.equals("Thrid"))rn msg+="Thrid";rn else if(arg.equals("Debug"))rn msg+="debug";rn else if(arg.equals("Testing"))rn msg+="Testing";rn menuFrame.msg=msg;rn menuFrame.repaint();rn rn rn public void itemStateChanged(ItemEvent ie)rn menuFrame.repaint();rn rnrnrnpublic class MenuDemo extends Appletrnrn Frame f;rn rn public void init()rn rn f=new MenuFrame("Menu Demo");rn int width=Integer.parseInt(getParameter("width"));rn int height=Integer.parseInt(getParameter("height"));rn setSize(new Dimension(width,height));rn f.setSize(width,height);rn f.setVisible(true);rn rn rn public void start()rn f.setVisible(true);rn rn public void stop()rn f.setVisible(false);rn
卡巴总是更新失败呢,为什么啊?
我的卡巴更新病毒库时提示更新<em>失败</em>.换了好几个服务器都不行.望高手赐教.以前也遇到好几回这事儿了.以前换服务器有时还能顺利更新.可是今天不行了.这是<em>为什么</em>呀?我装的是卡巴的7.0,求助.
为什么这样删除文件会失败呢??
#include rn#include rn#include rn#include rnrnrnmain()rnrn FILE *fp;rn fp = fopen("dellist.dat", "r");rn while(!feof(fp))rn rn char filepath[256];rn fgets(filepath, 256, fp);rn remove(filepath);rn printf(filepath, "\n");rn rnrn fclose(fp);rnrn getch();rnrnrn我看了,printf出来的文件路径, 都没问题, 但是文件就是删不掉!rn还有个问题, 如果文件属性为只读的时候怎么删除?
DirectDraw CreateSurface老是失败,为什么呢?
[code=c]rn#include "MyDirectDraw.h"rn#include rnrn#define TIMER_ID 1rn#define TIMER_RATE 500rnrnMyDirectDraw::MyDirectDraw()rn m_pDD=NULL;rn m_pDDSFront=NULL;rn m_pDDSBack=NULL;rnrnrnvoid __stdcall MyDirectDraw::timer_proc(HWND hwnd,UINT uMsg,UINT idEvent,DWORD dwTime)rnrn //HDC hdc;rn //HRESULT ddrval=m_pDDSFront->GetDC(&hdc);rn //SetBkColor( hdc,RGB(0,0,255) );rn //SetTextColor( hdc,RGB(255,255,0) );rn //std::string str("Hello");rn //TextOut( hdc,200,200,str.c_str(),str.length() );rn //m_pDDSFront->ReleaseDC(hdc);rnrnrnrnvoid MyDirectDraw::Paint(HWND hwnd)rnrn HRESULT ddrval=DirectDrawCreate( NULL,&m_pDD,NULL );rn if( DD_OK!=ddrval )rn rn //::MessageBox(NULL,_T("DirectDrawCreate Failed."),_T("DirectDrawCreate"),MB_OK);rn return;rn rn ddrval=m_pDD->SetCooperativeLevel( hwnd,DDSCL_NORMAL );rn ddrval=m_pDD->SetDisplayMode( 1600,900,24 );rnrn DDSURFACEDESC ddsd;rn ddsd.dwSize=sizeof(ddsd);rn ddsd.dwFlags=DDSD_CAPS|DDSD_BACKBUFFERCOUNT;rn ddsd.ddsCaps.dwCaps=DDSCAPS_PRIMARYSURFACE|DDSCAPS_FLIP|DDSCAPS_COMPLEX;rn ddsd.dwBackBufferCount=1;rnrn ddrval=m_pDD->CreateSurface( &ddsd,&m_pDDSFront,NULL );rn if( DD_OK!=ddrval )rn rn ::MessageBox(NULL,"CreateSurface Failed.","CreateSurface",MB_OK);rn ::PostMessage(hwnd, WM_CLOSE, 0, 0);rn return;rn rnrn DDSCAPS ddscaps;rn ddscaps.dwCaps=DDSCAPS_BACKBUFFER;rn ddrval=m_pDDSFront->GetAttachedSurface( &ddscaps,&m_pDDSBack );rnrn SetTimer( hwnd,TIMER_ID,TIMER_RATE,timer_proc );rnrn //HDC hdc;rn //ddrval=m_pDDSFront->GetDC(&hdc);rn //SetBkColor( hdc,RGB(0,0,255) );rn //SetTextColor( hdc,RGB(255,255,0) );rn //std::string str("Hello");rn //TextOut( hdc,200,200,str.c_str(),str.length() );rn //m_pDDSFront->ReleaseDC(hdc);rnrn //RECT rcClient=100.0,100,400,300;rn //m_pDDSFront->Blt( &rcClient,m_pDDSFront,NULL,DDBLT_WAIT,NULL );rn[/code]rn上面的代码执行到rn ddrval=m_pDD->CreateSurface( &ddsd,&m_pDDSFront,NULL );rn if( DD_OK!=ddrval )rn rn ::MessageBox(NULL,"CreateSurface Failed.","CreateSurface",MB_OK);rn ::PostMessage(hwnd, WM_CLOSE, 0, 0);rn return;rn rn就出来了,<em>为什么</em>啊?
为什么有时候安装VB会失败呢?
有时候安装VB会出现错误,比如缺少一个文件之类的,应该怎么办啊?
为什么我的mysql驱动导入失败呢!
import java.sql.*;rnrnpublic class test rnrn public static void main(String[] args) rnrn String driverName = "com.mysql.jdbc.Driver";rnrn String dbURL = "jdbc:mysql://localhost/crm";rnrn String userName = "dddd";rnrn String userPwd = "fff";rnrn String str_sql="select * from tablename";rnrn rnrn try rnrn Class.forName(driverName);rnrn System.out.println("导入MYSQL驱动成功!");rnrn catch (Exception e) rnrn System.out.println("导入MYSQL驱动<em>失败</em>!");rnrn rnrn rnrn try rnrn Connection connect = DriverManager.getConnection(dbURL, userName,rnrn userPwd);rnrn System.out.println("成功得到Mysql连接!");rnrn rnrn Statement stmt = connect.createStatement();rnrn ResultSet rs = stmt.executeQuery(str_sql);rnrn while (rs.next()) rnrn System.out.print("功能名称="+rs.getString(1)+"功能变量=");rnrn System.out.println(rs.getString(2));rnrn rnrn catch (Exception e) rnrn System.out.println("取数据<em>失败</em>!");rnrn rnrn rnrn rnrnrn
ProcessShellCommand(cmdInfo)为什么老是运行失败
if (!ProcessShellCommand(cmdInfo))rn return FALSE;rn老是返回FALSE,搞得我不能初始化,请问有什么原因可能导致,我其他程序怎么不这样
用LoadLibrary加载DLL失败为什么呢?
我用的是VC2005,生成了一个DLL,然后在程序中加载这个DLL,如下:rnHINSTANCE hDll = ::LoadLibrary("D:\\hkrt.dll");rnDWORD dwErr = ::GetLastError();rn执行结果是这样的:在我的开发机器上加载是正常的,但把程序和DLL放在一台没有装VC2005的机器上执行时,加载就<em>失败</em>了,hDll的值是0,dwErr的值是14001,查了查“Error Lookup”,14001对应的描述是:“由于应用程序配置不正确,应用程序未能启动。重新安装应用程序可能会纠正这个问题”。rn我先后试了三台没有安装VC的机器,都是这个问题。rn我上网查原因,有人说需要安装“.Net Framework”,于是我下载了“.Net Framework2.0”并安装,之后动态库可以正常<em>调用</em>了。rn这个程序和这个DLL是需要打成安装包的,如果再把“.Net Framework2.0”打进安装包,安装包的体积就会变得很大,由于一些原因,生成的安装包不能很大。rn我奇怪的是,<em>为什么</em><em>调用</em>一个标准的动态库还需要在机器上安装.Net呢?不安装不行吗?rn我想问一下,有什么方法可以在不安装.Net的情况下正常<em>调用</em>?rn谢谢了!
请教,为什么老是服务器运行失败
我开始碰PHP,连配置都搞不定,诶!!!rn我按照教程,打开internet信息服务(iis)管理器,里面是没有项目的,我想是不是右键下,连接个新的,跳出来个窗口,说是"连接到计算器",要求填写计算机名,我就按照我的电脑下的名称a4911fe438d54c3,填了上去,但还是"运行服务器<em>失败</em>",特来请教,请大家不吝赐教,谢谢
dcomconnection为什么会连接服务器失败
今天按书上做了个简单的midas练习,服务器创建好了,table 的active也设置为true ,创建客户端时候,dcomconnection的servername属性也设置好了,当把dcomconnection的conneted属性设置为true时,却不行,说 服务器运行<em>失败</em>!!rn晕, 我试了好多次都不行,真是不知道出了什么问题啊,请教各位了,谢谢!
服务程序里为什么读取ACCESS数据库失败呢?
我写了一个 IIS 的过滤器模块,就是加载到 IIS 进程里运行的 DLL 模块,rn该模块被加载的时候会从 ACCESS 数据库中读取配置数据,rn<em>为什么</em>在 2003 上不能读数据库呢?会是什么情况造成的呢?rnrn谢谢大家!请高手指点!
tomcat虚拟路径的修改为什么总是失败呢?
原来的默认路径是: rn rn rn我修改为:rnrn rn rn可是重起tomcat后发现,http://localhost:8084/ 访问的默认页面仍然是ROOT里的,请问我错在哪里?
arch linux分区命令失败,为什么呢?
我用virtualbox,新的arch linux 安装光盘iso,选择64位启动,进入系统,执行fdisk,看到以下信息:rn[img=https://img-bbs.csdn.net/upload/201512/29/1451355254_559945.png][/img]rn这是<em>为什么</em>,fdisk都不能执行?
Win32 加载wininet.dll为什么总是失败呢?
在stdafx.h中rnrn#import "C:\WINDOWS\system32\wininet.dll"rnrnrn错误提示1>e:\程序\气象\09-12-23\weatherw32\weather\stdafx.h(66) : fatal error C1083: Cannot open type library file: 'c:\windows\system32\wininet.dll': 加载类型库/DLL 时出错。
StgCreateDocfile失败,返回一个负数.为什么呢?
[code=C/C++]rn#includern#includern#pragma comment(lib,"ole32")rnint main(void)rn IStorage* pStg;rn HRESULT ret=StgCreateDocfile(L"e:\\myfile",STGM_CREATE,0,&pStg);rn printf("hr=%d\n",ret);rn return 0;rnrn[/code]rnrn输出hr=-2147286785rnrn这是<em>为什么</em>呢
CreateBitmapIndirect失败为什么参数不正确呢?
[code=C/C++]rn#define SHEET_PREVIEW_WIDHT 266rn#define SHEET_PREVIEW_HEIGHT 150rnunsigned char g_sheet_bits[SHEET_PREVIEW_WIDHT * SHEET_PREVIEW_HEIGHT * 4] = ""; // 全局变量rn...rnrn CBitmap m_bitmap; // 类成员rn BITMAP m_BMP;rn...rn m_BMP.bmBits = g_sheet_bits; // g_sheet_bits是有数据的的,已经赋值过了rn m_BMP.bmType = 0;rn m_BMP.bmWidth = rc.Width();rn m_BMP.bmHeight = rc.Height();rn /*m_BMP.bmBitsPixel = 32;rn LONG bitsPerLine = m_BMP.bmWidth * m_BMP.bmBitsPixel;rn m_BMP.bmWidthBytes = ((bitsPerLine+15)/16)*2;*/rn m_bitmap.CreateBitmapIndirect(&m_BMP); // 执行<em>失败</em>,返回值为0rn TRACE("--------- %d \n", GetLastError()); // error code 87,参数不正确,把上面注释掉的设置上也还是不行。rn[/code] rn到底是什么愿意呢?
socket编程的问题,为什么运行失败呢?
server端:rn[code=C/C++]#include rn#include rn#include rn#include rn#include rn#include rn#include rn#include rn#include rn#include "error.h"rnint main()rnrn int sockfd,client_fd;/*sockfd: monitor socket; client_fd:data transmission socket*/rn struct sockaddr_in my_addr;/*local host address message*/rn struct sockaddr_in remote_addr;/*client address message*/rn int ret;rn dorn rn if((sockfd=socket(AF_INET,SOCK_STREAM,0))==-1)rn rn ret=SOCKER_GREAT_ERROR;rn break;rn rn my_addr.sin_family=AF_INET;rn my_addr.sin_port=htons(SERVERPORT);rn my_addr.sin_addr.s_addr = INADDR_ANY;rn memset(my_addr.sin_zero,0,sizeof(my_addr.sin_zero));rnrn if(bind(sockfd,(struct sockaddr*)&my_addr,sizeof(struct sockaddr))==-1)rn rn ret=BIND_ERROR;rn break;rn rnrn if(listen(sockfd,BACKLOG)==-1)rn rn ret=LISTEN_ERROR;rn break;rn rnrn while(1)rn rn socklen_t sin_size=sizeof(struct sockaddr);rn if((client_fd=accept(sockfd,(struct sockaddr*)&remote_addr,&sin_size))==-1)rn rn ret=ACCEPT_ERROR;rn break;rn rnrn printf("received a connection from %s\n", inet_ntoa(remote_addr.sin_addr));rn if (!fork()) rn rn if (send(client_fd, "Hello, you are connected!\n", 26, 0) == -1)rn rn ret=SEND_ERROR;rn rn close(client_fd);rn exit(0);rn rnrn rn rn while(0);rn if(0!=ret)rn printf("run error with %d\n",ret);rn return ret;rnrn[/code]rnclient端:rn[code=C/C++]#include rn#include rn#include rn#include rn#include rn#include rn#include rn#include rn#include rn#include "error.h"rn#include rnrnint main(int argc,char *argv[])rnrn int ret;rn dorn rn int sockfd,recvdytes;rn char buf[MAXDATASIZE];rn hostent *host;rn struct sockaddr_in serv_add;rn if (argc < 2) rn rn printf("Please enter the server's hostname!\n");rn ret=ERROR_PARA;rn break;rn rn if((host=gethostbyname(argv[1]))=NULL)rn rn ret=ERROR_GETHOSTNAME;rn break;rn rnrn if((sockfd=socket(AF_INET,SOCK_STREAM,0))==-1)rn rn ret=SOCKER_GREAT_ERROR;rn break;rn rn rnrn serv_add.sin_family=AF_INET;rn serv_add.sin_port=htons(SERVERPORT);rn serv_add.sin_addr = *((struct in_addr *)host->h_addr);rn memset(serv_add.sin_zero,0,sizeof(serv_add.sin_zero));rnrn if(connect(sockfd,(struct sockaddr*)&serv_add,sizeof(struct sockaddr))==-1)rn rn ret=CONNECT_ERROR;rn break;rn rn if(recvdytes=recv(sockfd,buf,MAXDATASIZE,0)==-1)rn rn ret=RECV_ERROR;rn break;rn rn rn rn buf[recvdytes]='\0';rn printf("recvytes=%s",buf);rn close(sockfd);rn rn while(0);rn rn printf("run error with %d\n",ret);rn return ret;rnrn[/code]rnrn<em>为什么</em>运行client端程序时会报内存错误呢?运行方式为 ./client rn有什么问题吗?
在bcb55下安装stl4.5(win2000)~为什么失败呢?
总是提示我路径没有找到rn我已经按照孟岩先生的方法作了 可是。。
为什么加载DLL函数失败呢?
<em>为什么</em>加载DLL函数<em>失败</em>呢?rnrn文件1"d_main.cpp>"rn#include rn#define MYLIBAPI extern "C" __declspec(dllexport)rn#include "d_resource.h"rnrnrnBOOL WINAPI DllMain (HINSTANCE hInstance,DWORD fdwReason,PVOID pvReserved)rnrn return TRUE ;rnrnrnBOOL CALLBACK sethook(int nCode, WPARAM wParam, LPARAM lParam)rnrn MessageBox (NULL,TEXT ("函数检测"),TEXT ("警告"),0);rn return(0);rnrnrn文件2“d_resource.h”rn#ifdef MYLIBAPIrn#elsern#define MYLIBAPI extern "C" __declspec (dllimport)rn#endifrnMYLIBAPI BOOL CALLBACK sethook(int nCode, WPARAM wParam, LPARAM lParam);rnrn文件3“main.cpp”rn#include rn#include rnrnBOOL CALLBACK IpDialogFunc(HWND hDlg, UINT message,WPARAM wParam, LPARAM lParam);rnint WINAPI WinMain (HINSTANCE hInstance,HINSTANCE hPrevInstance,PSTR szCmdLine,int iCmdShow)rnrn HMODULE dll_handle;rn char dll_name[] = "d_99.dll";rnrn dll_handle = LoadLibrary (dll_name);rn if(!dll_handle)MessageBox (NULL,TEXT ("没有发现DLL"),TEXT ("警告"),0);return(0);rnrn FARPROC lpfnRegister = GetProcAddress(dll_handle,"sethook"); rn if(!lpfnRegister)MessageBox (NULL,TEXT ("没有发现函数"),TEXT ("警告"),0);return(0);rnrn FreeLibrary(dll_handle);rn return(0);rnrn
为什么开始事务就失败呢?
我的CRstTest类是用classward继承于CRecordset,但<em>为什么</em>不能开始事务呢??rn代码如下rn CRstTest test;rn test.Open();rn if(test.m_pDatabase->CanTransact())rn rn MessageBox("CanTransact"); //这一步成功rn rn if(!test.m_pDatabase->BeginTrans())rn rn MessageBox("BeginTrans fail");//<em>为什么</em>这一步<em>失败</em>,如果不支持事务,<em>为什么</em>上一步成功呢rn rnrn不要告诉我直接用CDatabase类rnrn
为什么我的菜单建立失败呢?(Win32)
程序出来后只有一个空的页面,不见菜单(菜单在"App.rc"里绘制),高手请帮忙看一下哦rnrn#include rn#include "resource.h"rnrnLRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);rnrnTCHAR szAppName[] = TEXT("App");rnrnDWORD test = 0;rnrnint WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPreInstance,PSTR szCmdLine,int iCmdShow) rnrn HWND hwnd;rn MSG msg;rn WNDCLASS wndclass;rnrn wndclass.style = CS_HREDRAW|CS_VREDRAW; rn wndclass.lpfnWndProc = WndProc;rn wndclass.cbClsExtra = 0; rn wndclass.cbWndExtra = 0; rn wndclass.hInstance = hInstance;rn wndclass.hIcon = LoadIcon(NULL,IDI_APPLICATION);rn wndclass.hCursor = LoadCursor(NULL,IDC_ARROW);rn wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);rn wndclass.lpszMenuName = szAppName;rn wndclass.lpszClassName = szAppName;rnrn if (!RegisterClass(&wndclass)) rn rn //test = ::GetLastError();rn MessageBox(NULL,TEXT("This programe requires Windows NT!"),szAppName,MB_ICONERROR);rn return 0;rn rn rn rn hwnd = CreateWindow(szAppName,TEXT("App"),WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,hInstance,NULL);rnrn rn ShowWindow (hwnd, iCmdShow) ;rn UpdateWindow(hwnd);rnrn while (GetMessage(&msg,NULL,0,0))rn rn TranslateMessage(&msg);rn DispatchMessage(&msg);rn rn return 0;rnrnrnLRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) rnrnrn HMENU hMenu;rnrn switch(message)rn rn case WM_COMMAND:rn hMenu=GetMenu(hwnd);rnrn switch(LOWORD(wParam))rn rn case IDM_CLOSE:rn MessageBox(hwnd,TEXT("Hello"),szAppName,MB_OK|MB_ICONINFORMATION);rn return 0;rn case IDM_ABOUT:rn MessageBeep(0);rn return 0; rn rn break;rnrn case WM_DESTROY:rn PostQuitMessage(0);rn return 0;rn rn return DefWindowProc(hwnd,message,wParam,lParam);rnrn
CString Left()为什么失败呢?【求助!!!!!!!!!!!!!!!!!!】
主要是这两句:rn int n=str.Find(";");//1rn str_temp=str.Left(n);//2rn 我设置断点进行调试,在第1,2句中str的值为90:1:6;90:2:6;90:3:2;90:4:6;90:5:5;90:6:2;,在第一句中能够看到n的值为6,<em>为什么</em>str_temp的值却仍是90:1:6;90:2:6;90:3:2;90:4:6;90:5:5;90:6:2;呢?<em>为什么</em>会发生这种情况?求助!
为什么动态创建一个CTreeCtrl时失败
rnCRect rectDummy;rnrectDummy.SetRectEmpty ();rnrnconst DWORD dwViewStyle = WS_CHILD | WS_VISIBLE | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS;rnrnif (!m_legendTree.Create(dwViewStyle, rectDummy, this, ID_LEGEND_TREE))rnrn TRACE0("创建图例树控件<em>失败</em>.\n");rn return -1; // fail to creaternrnrn另:rnrnCreate()方法是重载的!rn这是重载后的方法rnBOOL CTree::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID)rnrn return CTreeCtrl::Create(dwStyle, rect, pParentWnd, nID);rn
载入图像文件为什么失败
CString strFileName="F:\\emp\\emp.jpg";rn HBITMAP hbm = (HBITMAP)::LoadImage(NULL,strFileName,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);rnrn载入同样扩展名.jpg得文件,前一个成功了,后一个去<em>失败</em>了rn<em>为什么</em>呢,rn前一个文件有2。25m,后一个只有166krn难道和大小有关系rn?rn后一个文件以同名覆盖前一个文件
【微信开发】为什么TOKEN一直验证失败呢?
我是用的SAE新浪云来搞的,也进行了实名认证,接受数据的URL也没输错,但是就是token验证不通过,眼睛都看花了,麻烦能人帮忙找找错~谢谢!nn```n ToUserName;n $FromUserName = $object -> FromUserName;n $MsgType = $object -> MsgType;n n //根据不同类型的消息做出不同的回复n switch($MsgType)n case "text":n $Content = $object -> Content;n $respXml = "n %sn $sn &sn textn %sn ";n n $result = sprintf($respXml,$FromUserName,$ToUserName,time(),$Content);n echo $result;n n break;n n case "image":n $MediaId = $object -> MediaId;n $respXml = "n %sn %sn %sn imagen n %sn n ";n n $result = sprintf($respXml,$FromUserName,$ToUserName,time(),$MediaId);n echo $result;n break;n nn```nn
请教:这个setsqlselect为什么失败
PB6.5在执行setsqlselect时<em>失败</em>,返回-1.其中:该DW 是单表没有别的表关联;rn而且DW可以更新(.updateable为真),程序中也没有改变它的.updateable属性.直到执行setsqlselect时:DW.describe("datawindow.table.updatetable")还返回有值.综上所述:它<em>为什么</em>就还是在执行setsqlselect时<em>失败</em>呢???
struts的DynaValidatorForm验证为什么总是失败呢.?
rn rn rn rn rnrn rn rn rn rn rn rn rnrnrn rnrn rn rn rnrnvalidator.xml中有这样一段:rnrn rn rn rn rn rn minlengthrn 5rn rn rn rnrnapplicaton.properties 文件:rnrnemail.is.good=this is ok emailrnerrors.required=0 is required.rnerrors.minlength=0 can not be less than 1 characters.rnrnrnrnrnrnrn情况是每次我不输入数据就提交时,错误提示为:null is is required.rn输入的数据少于5个字符时总是有:null can not be less than null characters.rn<em>为什么</em>这个不起作用呢?rn rn rn rn minlengthrn 5rnrnrn
为什么在本地注册服务器失败呢?
<em>为什么</em>准是注册<em>失败</em>?
为什么流接口驱动CreateFile失败呢?
HANDLE handle=CreateFile(_T("TTT1:"),GENERIC_READ|GENERIC_WRITE,0,rnNULL,OPEN_EXISTING,0,NULL);rnASSERT(handle);rnif (handle == INVALID_HANDLE_VALUE) // cannot open the drivernrn MessageBox(NULL,_T("CreateFile<em>失败</em>"),_T("title"),MB_OK);rnrn这<em>为什么</em>呢?
为什么我的文件总是打开失败呢?
// ex1.7_2.cpp : 定义控制台应用程序的入口点。rn//rnrn#include "stdafx.h"rn#include rn#include rn#include rnrnusing namespace std;rnrnint _tmain(int argc, _TCHAR* argv[])rnrn cout<<<<>user_name;rn while(user_more)rn rn if (!game_datain) //到这里就完了,总是打不开我的D:\\game_datain.txt啊,<em>为什么</em>啊???????rn rn cout<>gamedata_name;rn if (gamedata_name == user_name)rn rn game_datain>>str_tries>>str_right;rn cout<<>user_tryAgain;rn rn elsern rn cout<<>user_tryAgain;rn rn while(user_tryAgain !='Y'&&user_tryAgain !='N'&&user_tryAgain !='y'&&user_tryAgain !='n')rn rn cout<>user_tryAgain;rn rn if(user_tryAgain == 'y'||user_tryAgain=='Y')rn rn user_more = true;rn rn elsern rn user_more = false;rn rn rn user_grade = double(user_right)/user_tries*100;rn /*if(!game_dataout)rn rn cout<<
为什么我的聊天程序总是绑定失败呢?
程序本身没有问题
为什么会运行失败呢。。。汗~~~~~
先是主函数。。。rn[code=Java]rnpublic class App extends Activity rn private AnimationDrawable anim;rn private CustomDrawableView cusView;rn /** Called when the activity is first created. */rn @Overridern public void onCreate(Bundle savedInstanceState) rn super.onCreate(savedInstanceState);rn bitmapScale mao = new bitmapScale();rn rn setContentView(mao.getLayout());rn rn[/code]rn然后是新创建的类...其实是抄的:rn[code=Java]public class bitmapScale extends Activityrn public LinearLayout linLayout;rn public void onCrete(Bundle icicle)rn super.onCreate(icicle);rn setTitle("图片变换");rn linLayout = new LinearLayout(this);rn rn //加载需要的图片rn Bitmap originalBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.sample_4);rn //获取宽和高rn int width = originalBitmap.getWidth();rn int height = originalBitmap.getHeight();rn //想要的宽和高rn int newWidth = 200;rn int newHeight=200;rn //算算要缩放多少比例。。。rn float scaleWidth = newWidth/width;rn float scaleHeight=newHeight/height;rn //创建操作图片用的Matrix对象,好像matrix是储存一系列的操作然后应用到图片上的rn Matrix matrix = new Matrix();rn //先储存缩放图片动作到matrix里rn matrix.postScale(scaleWidth, scaleHeight);rn //然后储存旋转rn matrix.postRotate(45);rn //创建新图片rn Bitmap resizedBitmap = Bitmap.createBitmap(originalBitmap,rn 0,rn 0,rn width,rn height,rn matrix,rn true);rn //把上面的转换过的图片变成Drawable对象,让它可以放到imageview里rn BitmapDrawable bmd = new BitmapDrawable(resizedBitmap);rn rn ImageView imageView = new ImageView(this);rn imageView.setImageDrawable(bmd);rn //将图片居中显示rn //imageView.setScaleType(ScaleType.CENTER);rn rn //将ImageView添加到layout里rn linLayout.addView(imageView, rn new LinearLayout.LayoutParams(rn LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));rn setContentView(linLayout);rn rn rn LinearLayout getLayout()rn return linLayout;rn rn[/code]rnrn运行后debug里显示:rn[2011-06-07 23:37:11 - AndroidApp] Android Launch!rn[2011-06-07 23:37:11 - AndroidApp] adb is running normally.rn[2011-06-07 23:37:11 - AndroidApp] Performing com.enseignement.AndroidApp.App activity launchrn[2011-06-07 23:37:11 - AndroidApp] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'Android22'rn[color=#FF0000][2011-06-07 23:37:11 - AndroidApp] WARNING: Application does not specify an API level requirement!rn[2011-06-07 23:37:11 - AndroidApp] Device API version is 8 (Android 2.2)[/color]rn[2011-06-07 23:37:13 - AndroidApp] Application already deployed. No need to reinstall.rn[2011-06-07 23:37:13 - AndroidApp] Starting activity com.enseignement.AndroidApp.App on device emulator-5554rn[2011-06-07 23:37:15 - AndroidApp] ActivityManager: Starting: Intent act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.enseignement.AndroidApp/.App rn[color=#FF0000][2011-06-07 23:37:15 - AndroidApp] ActivityManager: Warning: Activity not started, its current task has been brought to the front[/color]rnrn然后就运行<em>失败</em>了。。怎么回事呢。。。rn
dup2重定向标准输出失败了,为什么呢?
我尝试重定向标准输出到一个文件里面,如下所示的程序:rn[code=c]rn#includern#includern#includern#includern#includern#includernint main(int argc, char *argv[])rnrn int fd=open("x.txt",O_CREAT|O_RDWR|S_IWUSR|S_IRUSR|S_IRGRP|S_IWGRP);rn dup2(1,fd);rn write(1,"hello world\n",12);rn printf("myself\n");rn close(fd);rn return 0;rnrn[/code]rn编译运行,命令行输出rn[code=c]rn~$ g++ n.cpp && ./a.outrnhello worldrnmyselfrn[/code]rn并没有如我所期望的被重定向到了一个文件里面去。rn而且这个新创建的x.txt文件的权限,看起来也没有我所设置的权限,而且很奇怪的多了一个"set-user-id"位:rn[code=c]rn-rwS-wx--- 1 a a 0 4月 29 13:03 x.txt*rn[/code]rnrn这是<em>为什么</em>呢? 我的程序错在哪里rn
请问这个FORM为什么提交失败呢?
这个form最初是这样的rn rn rn rn rnrnrn我用脚本动态的将他改成rnrn rn rn rn rnrnrn但是这样一来一直提交不成功,请问是怎么回事?有什么办法解决么?rnrninput type=file是只读的,想要动态修改他的信息,真是头疼rn
CreateFile打开物理磁盘失败,失败返回代码87,为什么呢?
[code=C/C++]rn#include "stdafx.h"rn#include rn#include rnint main() rn HANDLE hFile=CreateFile("\\\\.\\PhysicalDrive0",GENERIC_READ,rn FILE_SHARE_READ,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);rn if(INVALID_HANDLE_VALUE==hFile)rn printf("open error %d\n",GetLastError());rn rn return 0;rnrnrn[/code]rn运行输出:rnopen error 87rnPress any key to continue
为什么在SDK下调用ShowWindow(SW_HIDE);失败
我在MFC下没有问题,在SDK下rnrncase WM_PAINT:rn hdc = BeginPaint (hwnd, &ps) ;rn ShowWindow(SW_HIDE);rn EndPaint (hwnd, &ps) ;rn return 0 ;rnrn出错:error C2660: 'ShowWindow' : function does not take 1 parametersrnError executing cl.exe.
为什么调用GetNetworkParams函数每次都失败
BOOL CDLGDNS::OnInitDialog() rnrn CDialog::OnInitDialog();rn rn // TODO: Add extra initialization herern FIXED_INFO* FixedInfo;rn ULONG ulOutBufLen; rn DWORD dwRetVal; rn rn FixedInfo = (FIXED_INFO*)GlobalAlloc(GPTR,sizeof(FIXED_INFO)); rn ulOutBufLen = sizeof(FIXED_INFO); rnrn char *tmpBuffer = (char *)malloc(1024);rn memset(tmpBuffer, 0, 1024);rnrn dwRetVal = GetNetworkParams(FixedInfo, &ulOutBufLen) ;rn if ( ERROR_SUCCESS != dwRetVal)rn rn m_domain.SetWindowText(_T("没有获得!"));rn m_dnsserver.SetWindowText(_T("没有获得!"));rn m_nodetype.SetWindowText(_T("没有获得!"));rn m_route.SetWindowText(_T("没有获得!"));rn m_proxy.SetWindowText(_T("没有获得!"));rn m_dns.SetWindowText(_T("没有获得!")); rn rn elsern rn m_domain.SetWindowText(FixedInfo->DomainName);rn m_dnsserver.SetWindowText(FixedInfo->DnsServerList.IpAddress.String);rn CString str1;rn str1.Format("%d",FixedInfo->NodeType);rn m_nodetype.SetWindowText(str1);rn CString str2;rn str2.Format("%d",FixedInfo->EnableRouting);rn m_route.SetWindowText(str2);rn CString str3;rn str3.Format("%d",FixedInfo->EnableProxy);rn m_proxy.SetWindowText(str3);rn CString str4;rn str4.Format("%d",FixedInfo->EnableDns);rn m_dns.SetWindowText(str4);rn rn rn //GlobalFree( FixedInfo );rn rn return TRUE; // return TRUE unless you set the focus to a controlrn // EXCEPTION: OCX Property Pages should return FALSErnrnrnrn代码如上,每次运行最后的结果都是显示的“没有获得”,怎么回事啊?
多线程中调用mapx画图失败为什么
我想将画图功能单独用一个线程来完成,可是总是<em>失败</em>,如果只用主线程则成功,<em>为什么</em>啊?以下为程序代码。rnvoid CMdiView::OnButton1() rn rn endthread=false;rn aThread=AfxBeginThread(onthread,NULL);//创建子线程rnrnrnrnUINT CMdiView::onthread(LPVOID wParam)rnrn CMdiView *ad=(CMdiView*)wParam;rn ad->dotread();rn return 0;rnrnrnvoid CMdiView::dotread(void)//子线程实现的功能,这里用setcurrenttool代替rnrn m_ctrlMapX.SetCurrentTool(miPanTool);rn rnrn结果就出现内存不能读的错误,<em>为什么</em>啊?如果不创建线程,直接<em>调用</em>dothread则没有任何问题,如果将dothread中的内容换成其他(即不<em>调用</em>MAPX的函数),也没有问题。
调用RegisterClass(&wc)为什么返回失败(0)?
BOOL CTempDlg::RegisterWndClass(HINSTANCE hInstance)rnrn int r;rn WNDCLASS wc;rn wc.lpszClassName = _T("GRAPH_CUSTOM"); // matches class name in clientrn wc.hInstance = hInstance;rn wc.lpfnWndProc = ::DefWindowProc;rn //wc.hCursor = LoadCursor(NULL, IDC_ARROW);rn wc.hIcon = 0;rn wc.lpszMenuName = NULL;rn wc.hbrBackground = (HBRUSH) ::GetStockObject(LTGRAY_BRUSH);rn wc.style = CS_GLOBALCLASS; // To be modifiedrn wc.cbClsExtra = 0;rn wc.cbWndExtra = 0;rn r = ::RegisterClass(&wc);rn return r;rn
VB 调用 存储过程 sp_xml_preparedocument 为什么失败
Dim xdoc As MSXML2.DOMDocumentrnSet xdoc = New MSXML2.DOMDocumentrnDim xmlStr As Stringrnxdoc.validateOnParse = Truernxdoc.async = FalsernrnIf (xdoc.Load("D:\work\MeetingSignInFinge\excels\books.xml")) ThenrnrnxmlStr = xdoc.xmlrnMsgBox xmlStrrnElsernMsgBox xdoc.parseError.reasonrnEnd IfrnDim cmd As adodb.CommandrnSet cmd = New adodb.Commandrncmd.ActiveConnection = cnnrncmd.CommandText = "sp_xml_preparedocument" '存储过程的名称rncmd.CommandType = adCmdStoredProc '执行方式为存储过程rn'返回值参数rnSet param = cmd.CreateParameter("RetVal", adInteger, adParamReturnValue, 4)rncmd.Parameters.Append param rnrn '输出参数rnrnSet param = cmd.CreateParameter("fileNo", adInteger, adParamOutput)rn cmd.Parameters.Append paramrn'输入参数rn Set param = cmd.CreateParameter("xmldoc", adVarChar, adParamInput, 8000, straaa)rn cmd.Parameters.Append paramrn rnrn rncmd.ExecuternrnIf cmd.Parameters("RetVal").Value = 1 Thenrn MsgBox "成功"rnElsern MsgBox "<em>失败</em>"rnEnd IfrnrnrnrnrnrnSet xdoc = Nothing
线程中调用全局函数失败为什么
有一个全局函数是取数据的。本来是使用定时器操作的,现在改为使用线程,但是改为线程以后<em>调用</em>全局函数就<em>失败</em>了。无法取到数据。
asp 为什么调用存储过程总是失败阿???
SQL语句rnCREATE PROCEDURE test @id int,@new varchar(40) ASrnupdate stores set stor_name=@new where stor_id=@idrnGOrnrnrnASP代码rnrnrnrn总是提示 'dd'错误rn我改为 ''dd''仍然错误rnrn请教各位!!!!
为什么调用这个函数失败,怎么改正?
void __fastcall TForm1::Button1Click(TObject *Sender)rnrnrnDWORD *Free;rnDWORD *Total;rnint i;rnif(GetDiskFreeSpace(NULL,NULL,NULL,Free,Total))rnrnrnEdit1->Text=IntToStr(*Free);rnEdit2->Text=IntToStr(*Total);rnrnelsernrnShowMessage("Error");rnrnrnrn
在DLL中调用MessageBox失败为什么
头文件如下:rnrn#ifdef FUNTYPErn#elsern #define FUNTYPE extern "C" __importrn#endifrnFUNTYPE void ShowMessage(HWND hWnd);rnrn/*mydll.cpp文件*/rnFUNTYPE void ShowMessage(HWND hWnd)rnrn MessageBox(hWnd,"测试DLL的用途","测试程序",MB_OK);rnrnrnrn然后我在Form1上放了个Button,添置如下代码:rnvoid __fastcall TForm1::Button1Click(TObject *Sender)rnrnrn typedef void (*MyFun)(HWND);rn HMODULE hMod=LoadLibrary("Mydll.dll");//刚才的DLL库名rn if(!hMod)rn rn MessageBox(Application->Handle,"载入DLL<em>失败</em>","Error",MB_OK);rn return;rn rn MyFun fun=(MyFun)GetProcAddress(hMod,"ShowMessage");rn (*fun)(Application->Handle);//若把(*fun)(Application->Handle);改为rn //fun(Application->Handle);<em>为什么</em>不报错误rn FreeLibrary(hMod);rnrn rnrn程序编译与链接没问题可招待执行出问题,<em>为什么</em>?rn错误d大致说Access violation at 000013之类的。rn
为什么调用HttpSendRequest会经常失败
我用HttpSendRequest发送http get请求,有时能成功有时会<em>失败</em>。返回的错误代码是12031,即ERROR_INTERNET_CONNECTION_RESET。rn我想问下ERROR_INTERNET_CONNECTION_RESET这个错误会在什么情况下发生。
为什么DeviceIOControl()调用失败,返回值总是0?
我要直接用WIN32中的函数通过Windows2000提供的并口驱动程序操作专用并口设备.rn在用CreateFile("\\\\.\\LPT1",...)成功获得句柄m_hPPort(0x00000064)后,我用rnDeviceIoControl(m_hPPort,IOCTL_IEEE1284_GET_MODE,NULL,0,&OutBuffer,nOutBufferSize,&BytesReturned,NULL);读取并口工作模式,但总是<em>失败</em>,返回值为0.rn其中,PARCLASS_NEGOTIATION_MASK OutBuffer;rnnOutBufferSize = sizeof(PARCLASS_NEGOTIATION_MASK);rn紧跟其后的GetLastErro()返回值'1',表明是"Incorrect function"错误.我不明白这是什么意思.DeviceIOControl(...)的参数没有用错啊!rn先谢谢大家的帮助! rn
为什么OleLoadPicture函数会调用失败
使用下面一个函数打开一幅png图像:rnrn[code=C/C++]rnstatic HBITMAP LoadAnImage(const char* FileName)rnrn // Use IPicture stuff to use JPG / GIF filesrn IPicture* p = NULL;rn IStream* s = NULL;rn IPersistStream* ps = NULL;rn HGLOBAL hG;rn void* pp = NULL;rn FILE* fp;rnrnrn // Read file in memoryrn fp = fopen(FileName,"rb");rn if (!fp)rn return NULL;rnrn fseek(fp,0,SEEK_END);rn int fs = ftell(fp);rn fseek(fp,0,SEEK_SET);rn hG = GlobalAlloc(GPTR,fs);rn if (!hG)rn rn fclose(fp);rn return NULL;rn rn pp = (void*)hG;rn fread(pp,1,fs,fp);rn fclose(fp);rnrn // Create an IStream so IPicture can rn CreateStreamOnHGlobal(hG,false,&s);rn if (NULL==s)rn rn GlobalFree(hG);rn return NULL;rn rnrn HRESULT hr = OleLoadPicture(s,0,false,IID_IPicture,(void**)&p);rnrn if (S_OK!=hr)rn rn return NULL;rn rn if (NULL==p)rn rn s->Release();rn GlobalFree(hG);rn return NULL;rn rn s->Release();rn GlobalFree(hG);rnrn HBITMAP hB = NULL;rn p->get_Handle((unsigned int*)&hB);rnrn // Copy the image. Necessary, because upon p's release,rn // the handle is destroyed.rn HBITMAP hBB = (HBITMAP)CopyImage(hB,IMAGE_BITMAP,0,0,rn LR_COPYRETURNORG);rnrn p->Release();rn return hBB;rnrnrn[/code]rnrn 但是在执行OleLoadPicture函数时<em>失败</em>,返回值是rnhr = -2146827807,16进制数就是0x800A01E1rnrn 查了一些资料:rnrnOleLoadPictureFilernrnReturn codernDescriptionrnrnS_OKrnThe method completed successfully.rnrnCTL_E_INVALIDPICTURE (0x800A01E1)rnInvalid picture file.rnrnrn <em>为什么</em>会<em>调用</em><em>失败</em>呢?如何解决?我的编译环境是:rnrnVS 2005, Win XP + sp3。rnrnrnrnrnrn rn
在2K中为什么调用关机失败
在WIN2000<em>调用</em><em>为什么</em><em>失败</em>,请各位帮忙,十分感激.rnrnFUNCTION ulong ExitWindowsEx(ulong uFlags,ulong dwReserved) LIBRARY "user32.dll"rn ExitWindowsEx(1, 0)
为什么调用RemoveDirectory总是失败
在程序中<em>调用</em>RemoveDirectory来删除一个空目录,可总是返回FALSE,用GetLastError rn得到的错误号是0,与这个错误号对应的描述是: rn0 The operation completed successfully. ERROR_SUCCESS rn而且从资源管理器中可以看到文件夹确实没有被删除。 rn请问是怎么回事,谢谢~! rn rn下面是源程序,VC6(SP5)。文件夹中的文件都可以成功删除的,可是最后一步要删除 rn文件夹时出错。 rn rnbool CIODlg::RemoveDirectory(const CString &strPathName) rn rn ASSERT(!strPathName.IsEmpty()); rn ASSERT('\\' == strPathName[strPathName.GetLength()-1]); rn rn WIN32_FIND_DATA FindFileData; rn HANDLE hFind; rn rn hFind = FindFirstFile(strPathName+"*.*", &FindFileData); rn if(INVALID_HANDLE_VALUE == hFind) rn return true; rn rn try rn while(true) rn //is it a directory? rn if((FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)rn == FILE_ATTRIBUTE_DIRECTORY) //a directory rn if(strcmp(FindFileData.cFileName, ".") == 0rn || strcmp(FindFileData.cFileName , "..") == 0) rn ; rn else rn CString strSubPathName = strPathName rn + FindFileData.cFileNamern +"\\"; rn //recur rn if(!CIODlg::RemoveDirectory(strSubPathName)) rn return false; rn rn rn else rn if(FALSE == rn ::DeleteFile(strPathName+FindFileData.cFileName)) rn return false; rn rn rn if(FALSE == FindNextFile(hFind, &FindFileData)) rn break; rn rn rn if(FALSE == ::RemoveDirectory(strPathName)) rn return false; rn rn rn catch(...) rn AfxMessageBox("文件删除发生异常错误!", rn MB_OK | MB_APPLMODAL | MB_ICONSTOP); rn return false; rn rn return true; rn rnrn我刚才在另一个程序中测试了一下,删除应用程序所在目录下的名为2的文件夹,这次却是成功的,可是我还是不知道刚才错在哪。rnrnTCHAR strPathName[MAX_PATH] = '\0';rnint nSize = GetModuleFileName(NULL, strPathName, MAX_PATH);rnCString strPath(strPathName);rnstrPath = strPath.Left(strPath.ReverseFind('\\')+1);rnrnif(FALSE == RemoveDirectory(strPath + "2\\")) rn TRACE("错误号:%d\n", GetLastError());rn else rn TRACE("Success!\n");rnrnrn调试的时候,我明明看到strPathName的值为:rn"F:\STRAVES\HERONG\毕业设计\OPTLibrary\Debug\Library\线性规划\"rn当我在程序中用这个字符串(上面的'\'替换成'\\')去代替strPathName时,<em>调用</em>有时成功有时却也<em>失败</em>,真是搞不懂了。
windows服务中调用组件为什么失败
在一个服务中<em>调用</em>一下代码总不成功到现在没解决。rn CoInitializeEx(NULL,COINIT_APARTMENTTHREADED);//所有初始化都试过了没用rn rn rn CComPtr< IShellWindows > spShellWin;rn HRESULT hr = spShellWin.CoCreateInstance(CLSID_ShellWindows,NULL,CLSCTX_LOCAL_SERVER);rn if ( FAILED ( hr ) )rn rn char j[20];rn wsprintf(j,"%d %d",GetLastError(),hr);rn MessageBox(NULL,j,NULL,MB_OK);rn rn但是在普通的exe程序中是成功的.
为什么调用树型控件相应的函数会失败
我的程序的基于对话框的程序,树型控件在主对话框A。CPP中,当我在另一个子对话框B。CPP中<em>调用</em>相应的树的控制函数时就会<em>失败</em>,我在B对话框创建了A的对象通过A对象<em>调用</em>相应的A对话框中树的控制函数的,编译没有问题,我<em>调用</em>的是GetChildItem这个函数rn出错信息:rn_AFXCMN_INLINE HTREEITEM CTreeCtrl::GetChildItem(HTREEITEM hItem) constrn ASSERT(::IsWindow(m_hWnd)); return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItem);
为什么调用Debug版的DLL失败
rt ,我用Release版<em>调用</em>Release版的DLL没有问题,但是用Debug<em>调用</em>Debug版的DLL就会出现问题?用GetLastError取回的返回值为126,就是 找不到指定的模块,但是我这个路径是直接指定的啊,我确定有这个DLL文件存在。rnrnrn请问可能的原因是什么?
子类调用父类构造失败为什么
父类的构造函数如下:rnpublic:rn __fastcall TADOObject();rn __fastcall TADOObject(AnsiString & SQLQuery);rnrn子类的构造函数这么写:rn__fastcall TOrdersDM::TOrdersDM(int ID)rn : TADOObject(Format("SELECT * FROM %s WHERE ID = %d", ARRAYOFCONST((TableName(),ID))))rnrn //rnrnrn报错如下:rn [C++ Error] ProblemDomain.cpp(30): E2034 Cannot convert 'AnsiString' to 'TADOObject'rn [C++ Error] ProblemDomain.cpp(30): E2340 Type mismatch in parameter 1 (wanted 'const TADOObject &', got 'AnsiString')rn--rn
我在 ATL 中调用 LoadLibrary 失败为什么
使用GetLastError得:rnERROR_BAD_EXE_FORMAT 193,rnis not a valid Win32 application.rnrn如何才能解决这个问题呀?rnrn另外,能不能从DLL中导出Lib文件?这样就不用LoadLibrary 了?
为什么调用bm.Save(strFileName,ImageFormat.Jpeg);失败
我的代码如下:rn Graphics g=Graphics.FromImage(bm);rn g.Clear(Color.Yellow);rn StringFormat sf=new StringFormat();rn sf.Alignment=StringAlignment.Center;rn sf.LineAlignment=StringAlignment.Center;rn Random ran=new Random();rn int i=ran.Next(1,10000);rn strChkCode = i.ToString();rn g.DrawString(i.ToString(),new Font("黑体",12),new SolidBrush(Color.Black),new Rectangle(0,0,142,26),sf);rn String strFileName;rn strFileName = Server.MapPath("ChkImg.jpg");rn rn bm.Save(strFileName,ImageFormat.Jpeg);rnrn但是我使用下面的保存方式就没有问题:rnbm.Save(Response.OutputStream,ImageFormat.Jpeg);rnrn但是如何将Response.OutputStream中的东西在网页上显示出来啊?rnrn请各位高手告知!rn
perl: 为什么open() 在cgi中调用失败?
#!/usr/bin/perlrnuse warnings;rnuse strict;rn rnuse CGI;rnmy $cgi = new CGI;rnprint $cgi->header,rn $cgi->start_html("The fist page for testing perl script");rnopen(LOG,") rn print "OK";rnrn rnprint $cgi->end_html;rn--------------rn上面的是我写的perl脚本, 我在命令行上测试了没有问题, 但当通过http访问时说打开文件<em>失败</em>,<em>为什么</em>?rnrn谢谢给点提示
为什么ContentResolver调用bulkInsert批量插入数据失败
做Android开发的朋友肯定对使用ContentProvider插入数据并不陌生,通常我们使用ContentProvider基本都是经历如下两个步骤: 声明定义ContentProvider及其相关的URI,编写Provider中对应的增删改查方法; 使用ContentResolver及其对应的URI来对ContentProvider进行增删改查操作; 对于使用ContentProvider进行插
为什么调用包有时成功,有时失败
包能编译通过,执行时有时成功有时<em>失败</em>,是通过一个存储过程由外部程序<em>调用</em>的。出错代码如下:rnORA-04061: 已验证 package "classpackage" 的现有状态 ORA-04065: 没有执行,已改变或删除 package "classpackage" ORA-06508: PL/SQL: 无法在<em>调用</em>之前找到程序单元 rn包中定义了全局变量,由包内各过程<em>调用</em>rn不知是什么原因?还望各位高人指点一二
精通 Spring_2.x_6-9 精通 Spring_2.x_6-9下载
精通Spring_2.x_6-9 精通Spring_2.x_6-9 精通Spring_2.x_6-9 精通Spring_2.x_6-9 相关下载链接:[url=//download.csdn.net/download/haha0832/2864760?utm_source=bbsseo]//download.csdn.net/download/haha0832/2864760?utm_source=bbsseo[/url]
考试类小软件下载
考试类小软件,在线考试,语言是C#.net 相关下载链接:[url=//download.csdn.net/download/haibianhaiming/3605479?utm_source=bbsseo]//download.csdn.net/download/haibianhaiming/3605479?utm_source=bbsseo[/url]
MemoryAnalyzer-1.1.1.20110824-win32.win32.x86_64下载
MemoryAnalyzer-1.1.1.20110824-win32.win32.x86_64,专业的dump文件分析工具,共享一下 相关下载链接:[url=//download.csdn.net/download/jxzsdlh/4040699?utm_source=bbsseo]//download.csdn.net/download/jxzsdlh/4040699?utm_source=bbsseo[/url]
相关热词 c# 线程顺序 c#昨天当前时间 c# 多进程 锁 c#mysql图片存取 c# ocx 委托事件 c# 读取类的属性和值 c# out 使用限制 c#获取url的id c#怎么进行分页查询 c# update 集合
我们是很有底线的