007
01.01.2003, 22:48 Uhr
Uwe
C/C++ Master (Administrator)
|
Hallo Mike, passe mal folgenden Quellcode an Dein System an und berichte was für ein Fehler kommt:
C++: |
void CconnectDlg::OnBnClickedConnect() { nr.dwScope=RESOURCE_GLOBALNET; nr.dwUsage=RESOURCEUSAGE_CONNECTABLE; nr.dwType=RESOURCETYPE_ANY; nr.lpLocalName="Z:"; nr.lpRemoteName="\\\\Master\\E$"; nr.lpProvider=NULL; ret=WNetAddConnection2(&nr,NULL,NULL,CONNECT_UPDATE_PROFILE);
if(ret==NO_ERROR){ unsigned long secPerCluster; unsigned long bytesPerSector; unsigned long freeClusters; unsigned long totalClusters; int space_remaining; GetDiskFreeSpace("Z:\\", &secPerCluster, &bytesPerSector,&freeClusters, &totalClusters );
space_remaining = secPerCluster * bytesPerSector * (freeClusters/1000) ;
CString str; str.Format("%i",space_remaining); AfxMessageBox(str); } else{ //Trap the error switch(ret){ case ERROR_ACCESS_DENIED: MessageBox("Access to the network resource was denied","Network Login Failure",MB_OK+MB_ICONERROR); break; case ERROR_ALREADY_ASSIGNED: MessageBox("The local device specified by lpLocalName is already connected to a network resource","Network Login Failure",MB_OK+MB_ICONERROR); break; case ERROR_BAD_DEV_TYPE: MessageBox("The type of local device and the type of network resource do not match","Network Login Failure",MB_OK+MB_ICONERROR); break; case ERROR_BAD_DEVICE: MessageBox("The value specified by lpLocalName is invalid","Network Login Failure",MB_OK+MB_ICONERROR); break; case ERROR_BAD_NET_NAME: MessageBox("The value specified by 'lpRemoteName' is not\nacceptable to any network resource provider. The resource name is invalid, or the named resource cannot be located","Network Login Failure",MB_OK+MB_ICONERROR); break; case ERROR_BAD_PROFILE: MessageBox("The user profile is in an incorrect format","Network Login Failure",MB_OK+MB_ICONERROR); break; case ERROR_BAD_PROVIDER: MessageBox("The value specified by 'lpProvider'\ndoes not match any provider","Network Login Failure",MB_OK+MB_ICONERROR); break; case ERROR_BUSY: MessageBox("The router or provider is busy, possibly initializing.","Network Login Failure",MB_OK+MB_ICONERROR); break; case ERROR_CANCELLED: MessageBox("The attempt to make the connection was cancelled by the user\nthrough a dialog box from one of the network\nresource providers, or by a called resource","Network Login Failure",MB_OK+MB_ICONERROR); break; case ERROR_CANNOT_OPEN_PROFILE: MessageBox("The system is unable to open the user profile to process persistent connections","Network Login Failure",MB_OK+MB_ICONERROR); break; case ERROR_DEVICE_ALREADY_REMEMBERED: MessageBox("An entry for the device specified in 'lpLocalName'\nis already in the user profile","Network Login Failure",MB_OK+MB_ICONERROR); break; case ERROR_EXTENDED_ERROR: MessageBox("A network-specific error occured.\nPlease Re-execute the program ","Network Login Failure",MB_OK+MB_ICONERROR); break; case ERROR_INVALID_PASSWORD: MessageBox("The password you specified is invalid","Network Login Failure",MB_OK+MB_ICONERROR); break; case ERROR_NO_NET_OR_BAD_PATH: MessageBox("A network component has not started, or the\nspecified name could not be handled","Network Login Failure",MB_OK+MB_ICONERROR); break; case ERROR_NO_NETWORK: MessageBox("There is no network present.","Network Login Failure",MB_OK+MB_ICONERROR); break; case 53: MessageBox("The network path you specified is not found.","Network Login Failure",MB_OK+MB_ICONERROR); break; case 1219: MessageBox("The Account name & Password you typed does\nnot match with the existing account in 'Comp1'","Network Login Failure",MB_OK+MB_ICONERROR); break; case 487: MessageBox("The remote machine is not existing on the network.","Network Login Failure",MB_OK+MB_ICONERROR); break; default:Error.Format("Connection to the remote PC .\nThread Exited with an Error Code '%d'.",ret); MessageBox(Error,"Copy Error",MB_OK+MB_ICONERROR); break; } } }
|
-- "Es ist schwierig, ein Programm wirklich idiotensicher zu machen, weil Idioten so genial sind."
Bis dann... Uwe Dieser Post wurde am 01.01.2003 um 22:52 Uhr von Uwe editiert. |