Click here to Skip to main content
16,012,153 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Class inheritance problems Pin
suiram4023-Jun-04 8:32
suiram4023-Jun-04 8:32 
Generalerror C2593: 'operator +=' is ambiguous (watch my code) Pin
anderslundsgard23-Jun-04 2:24
anderslundsgard23-Jun-04 2:24 
GeneralRe: error C2593: 'operator +=' is ambiguous (watch my code) Pin
David Crow23-Jun-04 3:21
David Crow23-Jun-04 3:21 
GeneralRe: error C2593: 'operator +=' is ambiguous (watch my code) Pin
anderslundsgard29-Jun-04 22:44
anderslundsgard29-Jun-04 22:44 
GeneralRe: error C2593: 'operator +=' is ambiguous (watch my code) Pin
V.23-Jun-04 3:23
professionalV.23-Jun-04 3:23 
GeneralRe: error C2593: 'operator +=' is ambiguous (watch my code) Pin
jmkhael23-Jun-04 7:25
jmkhael23-Jun-04 7:25 
QuestionHow to hide col. in listview Pin
Sumit Kapoor23-Jun-04 1:53
Sumit Kapoor23-Jun-04 1:53 
Generalcomputer names in local network Pin
windsock23-Jun-04 1:30
windsock23-Jun-04 1:30 
Hi
I am calling a dialog box including a list control window.

This dialog box has computer names in local network.

I'ts using 'WNetOpenEnum' and 'WNetEnumResource' APIs.

Now I have used this code successfully in Windows 2000/XP.

But these codes got empty in Windows 98.

Nothing in list control.

Is a problem of network setting or not enough APIs to get names?

How can I do that?

anyone any ideas ?

Help me plz.




---- source list ---

void CNetworkDlg::SearchLocalPc(void)
{
// WNetOpenEnum parameter
DWORD dwScope = RESOURCE_CONTEXT;
NETRESOURCE *NetResource = NULL;
HANDLE hEnum;

// WNetOpenEnum for Windows 98. but Nothing in return value
unsigned long strWNetMSG = WNetOpenEnum(dwScope, RESOURCETYPE_ANY, NULL, NULL, &hEnum);

// for error
switch(strWNetMSG)
{
case NO_ERROR:
break;
case ERROR_NOT_CONTAINER:
AfxMessageBox("ERROR");
break;
case ERROR_INVALID_PARAMETER:
AfxMessageBox("ERROR");
break;
case ERROR_NO_NETWORK:
AfxMessageBox("ERROR");
break;
case ERROR_EXTENDED_ERROR:
AfxMessageBox("ERROR");
break;
default :
AfxMessageBox("ERROR");
return ;
}

// SOCKET creation
WSADATA wsaData;
WSAStartup(MAKEWORD(1, 1),&wsaData);

// if WNetOpenEnum success
if (hEnum)
{
// for WNetEnumResource
DWORD dwCount = 0xFFFFFFFF;
DWORD dwBufferSize = 16384;
LPVOID lpBuffer = new char[16384];

// continues a network-resource enumeration but Nothing in return value
unsigned long strWNetResourceMSG = WNetEnumResource(hEnum, &dwCount, lpBuffer, &dwBufferSize);

NetResource = (NETRESOURCE*)lpBuffer;

// for error
switch(strWNetResourceMSG)
{
case ERROR_MORE_DATA:
AfxMessageBox("ERROR");
break;
case ERROR_INVALID_HANDLE:
AfxMessageBox("ERROR");
break;
case ERROR_NO_NETWORK:
AfxMessageBox("ERROR");
break;
case ERROR_EXTENDED_ERROR:
AfxMessageBox("ERROR");
break;
default:
break;
}

if(m_ListSearchPc.GetItemCount() != 0)
m_ListSearchPc.DeleteAllItems();


m_dwCountTotalPc = 0;
for(unsigned int i = 0; i < dwCount; i++, NetResource++)
{
if (NetResource->dwUsage == RESOURCEUSAGE_CONTAINER && NetResource->dwType == RESOURCETYPE_ANY)
{
if (NetResource->lpRemoteName)
{
CString strFullName = NetResource->lpRemoteName;

if (strFullName.Left(2).Compare("\\\\") == 0)
strFullName = strFullName.Right(strFullName.GetLength() - 2);

if(strFullName.IsEmpty())
continue;

// 1. add number to list contorl
CString pcNo;
pcNo.Format("%d", m_dwCountTotalPc + 1);
m_ListSearchPc.InsertItem(m_dwCountTotalPc, pcNo);

// 2. add pc aname to list control
strFullName.MakeLower();
m_ListSearchPc.SetItemText(m_dwCountTotalPc, 1, (LPCTSTR)strFullName);
m_dwCountTotalPc++;
}
}
}
delete lpBuffer;
WNetCloseEnum(hEnum);
}
WSACleanup();

CString total;
total.Format("%d", m_dwCountTotalPc);
CString PopupMessage;
PopupMessage = "Number of Total Pc :";
PopupMessage += total;
SetDlgItemText(IDC_TEXT_LOCALPC_EA, LPCTSTR (PopupMessage));

UpdateData(FALSE);

}
GeneralRe: computer names in local network Pin
David Crow23-Jun-04 3:36
David Crow23-Jun-04 3:36 
GeneralRe: computer names in local network Pin
windsock23-Jun-04 18:31
windsock23-Jun-04 18:31 
GeneralRe: computer names in local network Pin
David Crow24-Jun-04 3:52
David Crow24-Jun-04 3:52 
GeneralModeless Dialogs Pin
si_6923-Jun-04 1:30
si_6923-Jun-04 1:30 
GeneralRe: Modeless Dialogs Pin
David Crow23-Jun-04 3:46
David Crow23-Jun-04 3:46 
Generaldetecting CDatabase disconnections Pin
craigiek23-Jun-04 1:18
craigiek23-Jun-04 1:18 
GeneralConvert from VS 6.0 project to VS .NET project Pin
anderslundsgard23-Jun-04 0:21
anderslundsgard23-Jun-04 0:21 
GeneralRe: Convert from VS 6.0 project to VS .NET project Pin
Anthony_Yio23-Jun-04 0:36
Anthony_Yio23-Jun-04 0:36 
GeneralRe: Convert from VS 6.0 project to VS .NET project Pin
anderslundsgard23-Jun-04 1:23
anderslundsgard23-Jun-04 1:23 
GeneralRe: Convert from VS 6.0 project to VS .NET project Pin
Anthony_Yio23-Jun-04 16:09
Anthony_Yio23-Jun-04 16:09 
GeneralRe: Convert from VS 6.0 project to VS .NET project Pin
anderslundsgard29-Jun-04 23:50
anderslundsgard29-Jun-04 23:50 
GeneralODBC and C++ Pin
SuzannaS23-Jun-04 0:09
SuzannaS23-Jun-04 0:09 
GeneralRe: ODBC and C++ Pin
Sumit Kapoor23-Jun-04 1:50
Sumit Kapoor23-Jun-04 1:50 
GeneralRe: ODBC and C++ Pin
basementman23-Jun-04 5:34
basementman23-Jun-04 5:34 
GeneralStrange problem with CString Pin
rrrado22-Jun-04 23:43
rrrado22-Jun-04 23:43 
GeneralRe: Strange problem with CString Pin
David Crow23-Jun-04 4:07
David Crow23-Jun-04 4:07 
GeneralRe: Strange problem with CString Pin
rrrado23-Jun-04 4:31
rrrado23-Jun-04 4:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.