|
which files specifically did you delete?
obviously i need to keep the .vcproj file...what else?
regards
Bryce
---
Publitor, making Pubmed easy.
http://www.sohocode.com/publitor
|
|
|
|
|
turns out some plonker had been opening the files ona unix box
guess what that did to the linefeeds etc
Bryce
---
Publitor, making Pubmed easy.
http://www.sohocode.com/publitor
|
|
|
|
|
i am trying to enumerate the whole network using RESOURCE_GLOBALNET arguement in the WNetOpenEnum(.,.,.,.,.) function. Program is not running properly it just gives me name of the first domain it finds and then the it terminates. When i use the RESOURCE_CONTEXT arguement in the WNetOpenEnum(.,.,.,.,.) i am able to get all the machines of the particluar sub domain, in which the application is running. For test purposes i am using the following code can any one point out the problem in this code
#include <iostream.h>
#include<windows.h>
#pragma message("network library is linking with \"mpr.lib\"")
#pragma comment(lib, "mpr.lib")
BOOL GetResources(NETRESOURCE *);
int main()
{
cout<<"hello"<<endl;
="" getresources(null);
="" return="" 0;
}
bool="" getresources(netresource="" *pnetresource)
{
="" dword="" dwscope="RESOURCE_GLOBALNET;
" netresource="" *netresource="NULL;
" handle="" henum;
="" wnetopenenum(dwscope,="" null,="" null="" ,="" pnetresource,="" &henum);
="" if="" (henum)
="" {
="" count="0xFFFFFFFF;
" buffersize="2048;
" lpvoid="" buffer="new" char[2048];
="" wnetenumresource(henum,="" &count,="" buffer,="" &buffersize);
="" netresource,="" for="" (uint="" i="0;" <="" sizeof(netresource);="" i++,="" netresource++)
="" (netresource-="">dwUsage == RESOURCEUSAGE_CONTAINER && NetResource->dwType == RESOURCETYPE_ANY)
{
if (NetResource->lpRemoteName)
{
if(NetResource->dwDisplayType == RESOURCEDISPLAYTYPE_DOMAIN)
{
cout<<endl<<"domain "<<="" netresource-="">lpRemoteName;
GetResources(NetResource);
continue;
}
cout<<endl<<"machine "<<netresource-="">lpRemoteName;
GetResources(NetResource);
continue;
}
}
GetResources(NetResource);
}
}
return true;
}
|
|
|
|
|
I massaged your code a little:
bool GetResources( NETRESOURCE *pNetResource )
{
DWORD dwResult;
NETRESOURCE *NetResource = NULL;
HANDLE hEnum;
dwResult = WNetOpenEnum(RESOURCE_GLOBALNET, RESOURCETYPE_ANY, 0, pNetResource, &hEnum);
if (NO_ERROR == dwResult)
{
NETRESOURCE Buffer[750];
DWORD Count = 0xFFFFFFFF,
BufferSize;
BufferSize = sizeof(Buffer);
do
{
dwResult = WNetEnumResource(hEnum, &Count, &Buffer, &BufferSize);
if (NO_ERROR == dwResult || ERROR_MORE_DATA == dwResult)
{
for (UINT i = 0; i < Count; i++)
{
if ((Buffer[i].dwUsage & RESOURCEDISPLAYTYPE_DOMAIN) == RESOURCEDISPLAYTYPE_DOMAIN)
cout << "Domain " << Buffer[i].lpRemoteName << endl;
else if ((Buffer[i].dwUsage & RESOURCEDISPLAYTYPE_SERVER) == RESOURCEDISPLAYTYPE_SERVER)
cout << "Server " << Buffer[i].lpRemoteName << endl;
else
cout << "Machine " << Buffer[i].lpRemoteName << endl;
if ((Buffer[i].dwUsage & RESOURCEUSAGE_CONTAINER) == RESOURCEUSAGE_CONTAINER)
GetResources(&Buffer[i]);
}
}
} while (NO_ERROR == dwResult || ERROR_MORE_DATA == dwResult);
dwResult = WNetCloseEnum(hEnum);
}
return true;
}
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
thanks David i am able to traverse the whole network quite successfully, but there is slight problem its showing no machines rather its showing machines as servers. So where would i have to make changes to make this code perfect..
|
|
|
|
|
The dwUsage member is going to have one of the following values:
RESOURCEDISPLAYTYPE_GENERIC
RESOURCEDISPLAYTYPE_DOMAIN
RESOURCEDISPLAYTYPE_SERVER
RESOURCEDISPLAYTYPE_SHARE
RESOURCEDISPLAYTYPE_FILE
RESOURCEDISPLAYTYPE_GROUP
RESOURCEDISPLAYTYPE_NETWORK
RESOURCEDISPLAYTYPE_ROOT
RESOURCEDISPLAYTYPE_SHAREADMIN
RESOURCEDISPLAYTYPE_DIRECTORY
RESOURCEDISPLAYTYPE_TREE
RESOURCEDISPLAYTYPE_NDSCONTAINER It's up to you to decide what a "machine" is.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thanx David for your help
|
|
|
|
|
Hi,
I have a toolbar which has a variable amount of buttons. (the amount of buttons is determined at run time)
To send a message and to perform a function, OK, but then I have 1 function for more then 1 button, how can I let this function know which button is pressed?
tnx a lot for your help!
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimmy Hendrix
|
|
|
|
|
You might want to check ON_COMMAND_RANGE for this.
|
|
|
|
|
Hi folks,
I have the problem, that I want sent a bill as Email from a C++ Application over Outlook. So I want set the Email to plain text or alternative to set the font to Courier etc.
This is my Eample:
void CMyClass::SendEmail()
{
CString sStr, sMsg, sSubject;
_Application olApp;
COleException e;
double price1 = 100000;
double price2 = 20000;
if(!olApp.CreateDispatch("Outlook.Application", &e)) {
CString str;
str.Format("CreateDispatch() failed w/error 0x%08lx", e.m_sc);
AfxMessageBox(str, MB_SETFOREGROUND);
return;
}
_NameSpace olNs(olApp.GetNamespace("MAPI"));
COleVariant covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
olNs.Logon(covOptional, covOptional, covOptional, covOptional);
_MailItem olMail(olApp.CreateItem(0));
olMail.SetTo("test@domain.com");
olMail.SetSubject("My bill");
sStr.Format("Item1:%#30.02", price1);
sMsg += sStr;
sStr.Format("Item2:%#31.02", price2);
sMsg += sStr;
olMail.SetBody(sMsg);
olMail.Display(covOptional);
olNs.Logoff();
}
Who can help ?
|
|
|
|
|
Hi there,
When the user clicks on the Close or X button of a FormView, I would like a dialog box to appear asking if the user would like to save the changes. What function does the X button call when you close it so that I can write a function to override it? I realized that if I have a close button in my form, I can simply call PostMessage(WM_COMMAND, ID_FILE_CLOSE) to close it. But what if I do not want to just close the window but instead have it to do the same thing described above. How can I accomplish this?
Any help would be much appreciated! Thanks!
|
|
|
|
|
Try WM_SYSCOMMAND with nID parameter SC_CLOSE
When the user clicks on the Close or X button of a FormView, I would like a dialog box to appear asking if the user would like to save the changes
>
SetModifiedFlag(TRUE); //Of CDocument class
will do this for you.
|
|
|
|
|
I have several forms in the application that I would like to save to memory before writing all to disk. So the SetModifiedFlag() may not work in my case. There are two things that I would like to do. (1) When the user clicks on the Windows Close(X) button, what function do I need to override in order to do my custom save. Does a message call using WM_SYSCOMMAND with SC_CLOSE just closes the window? Depending on what function I override, it should be the same function I would use to call within my OnCancel() function when the user clicks on the Cancel button right? I am little confused on where and how the WM_SYSCOMMAND is used and if that is what I need.
Thanks!
|
|
|
|
|
I meant like this.You can map the WM_SYSCOMMAND for the MainFrame class.When the X button is clicked the value of nID will be SC_CLOSE.
void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam) <br />
{<br />
if(nID == SC_CLOSE)
{<br />
CSaveDlg SaveDlg;<br />
if( IDOK == SaveDlg.DoModal() )<br />
{<br />
}<br />
}<br />
CFrameWnd::OnSysCommand(nID, lParam);<br />
<br />
}
|
|
|
|
|
I inserted the following code in CMainFrame class but nothing happens when I close the form. The save dialog box should appear but it doesn't. Am I doing something wrong or am I not doing something?
Thanks!
void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam)
{
int save_button;
if(nID == SC_CLOSE) //Check If [X] Button
{
save_button = MessageBox(
"Save file",
"Save file data", MB_YESNO);
if (save_button == IDYES)
{
g_id->lp = lp_copy;
}
}
CFrameWnd::OnSysCommand(nID, lParam);
}
|
|
|
|
|
Code looks fine.Same thing works for me
But this will show the MessageBox when you are closing the main window.For the different FormViews you have to do this in the corresponding ChildFrame class.
Sorry
|
|
|
|
|
Can somebody give me good link that will give great information on -Remote Procedure Call.
I would like to know-
What are RPC based protocols.
What r the advantages of RPC
What r the disadvantages of RPC
Pls guide
|
|
|
|
|
Start here.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi
It is first message for you, because I regester in this site this month. Please talk to me about this site , its qualities , and other case of it.
Are you know the meaning of "MARZOGH"?
If YES,Please send for me.
|
|
|
|
|
mf14 wrote:
Please talk to me about this site , its qualities , and other case of it.
Well, its a site run for programmers by programmers.
It runs several forums dedicated to certain subjects. You posted this in the Visual C++ forum. You may have been better posting in the Lounge (see top right of browser window) to get better results.
It is also a great resource for articles on most if not all standard Microsoft technologies.
mf14 wrote:
Are you know the meaning of "MARZOGH"?
Sorry, cannot help with this one.
Roger Allen - Sonork 100.10016
Strong Sad: I am sad I am flying
Who is your favorite Strong?
|
|
|
|
|
I have an external file in notepad(.txt) and I have many lines of records in it:
example:
my name is jim
I have a car
it is a beautiful day
.
.
.
If I want to store the next four lines start from "my name is jim" to an array of string class, how can I do it?
I was trying to use strcmp to find line, but after I locate the line, I can only store one line into a string class.
How can I store the following three lines into the string classes?
|
|
|
|
|
Either store each following line in its own string (i.e. have 3 different string objects), or concatenate the strings.
e.g.
std::string str = "my name is jim";
str += "\n" + getLineFromInputFile();
//...
|
|
|
|
|
Hi
I am just starting out to learn C++ and I was wondering how long It took on average for you different people to lean and be throughly read on the subject??
|
|
|
|
|
It takes however long you want it to take. If you really crack down on it, and you're already comfortable with at least one other Object-Oriented programming language, you could become proficient in only a week or two. If you've never programmed or have only programmed in a structure-oriented language, expect to spend a month or two (possibly more), assuming you're willing to put a good bit of work into it. If you're not wanting to put the effort into coding, you'll probably never become proficient.
Code a lot if you want to learn C++, or any language. Find a project you are interested in, and write it in C++. Or write some module/component for it, if it's not a new project. And of course, read a lot of other people's code, paying attention to style (that means learning to recognize good AND bad C++ style).
|
|
|
|
|
Hi,
I started learning C++ about 5 years ago. At the moment, I still learn more about C++ and I still find interesting articles I should read.
After 5 months (C++ was my first programming language and it started as a hobby) I could understand almost every article, and I was able to use almost every well documented piece of code I could find.
I guess that the time to learn C++ depends on the person in question and his/her experiance in the field.
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|