|
Peter Weyzen wrote: You could have answered "no". But you had to get made and respond with 4 times as many words as I did.
You also were not clear in your intent.
I tried to help.
Lame-o!
First of all my intention was already said hence the topic of the thread. But since i have to spell it out for you then i'll do that. Im Trying To Make A FTP Client That Uploads. Not Something That Downloads. Im Only Trying To Get It To Upload. I hope that was simple enough.
Second of all, for the second poster. Its not my intention to flame anyone or be a jerk. My goal is to figure something out. If you were going to provide helpful suggestions then I would have gladly accepted it. But if your going to ask lame questions like "why dont i just use another FTP client" when i clearly said im trying to 'learn' how to make one. Well then how would you reply if the tables were turned?
|
|
|
|
|
Dude, you weren't clear at all.
From reading your post, your goal could have been either:
* I need to FTP stuff to a server
* I want to implement the FTP protocol myself.
We're all here on CodeProject to get help and to share our experiences with others.
If someone's not answering the question that you think you asked, then maybe you didn't ask your question clearly.
And instead of flaming me for so-called off-topic... why not just phrase your question and your intent clearly.... and apologize for being such a wanker.
Then I might help answer the question you thought you were asking.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</A>
|
|
|
|
|
I was going to suggest something, but now I won't in case I get my nose bitten off too.
LateNightsInNewry
|
|
|
|
|
From Robert Pittenger's Article on Wizard 2000 Style Wizard, I developed my own Wizard; and the Wizard works fine. I load the Wizard from a MDI application I'm building from a Menu Selection in the ???View class of the application.(Select the menu item and the message is passed to the ???View class function to load the Wizard.)
Further, when the User selects an item from one of the pages, the User should be able to provide data thru an already loaded modeless dialog (thats created in the Wizard that contaqins the pages of the Wizard.
My problem is I cannot get the Wnd of the Wizard passed to the individual pages it contains. Since the Wizard holds the creation of the modeless dialog, it alone can get and transfer data to it and from it. Therefore I need the WIZARD'S WND for a page to connect with the modeless dialog.
CWizzardDlg* Dlg(the Wizard) CModeless* m_pModeless(modeless dialog) CPage1 m_pPg1. How can m_pPg1 talk to m_pModeless(a member of Dlg ?
A C++ programming language novice, but striving to learn
|
|
|
|
|
Hi all...
My basic question is this: I have a function that accepts a variable number of arguments using '...' and I want to pass that argument list on to another routine without processing them. I figure this has to be able to be done, so... how?
Here is a bit more information... I am working in Visual Studio 2005, C++ in console mode. I have a class set up to handle the screen (cScreen) which has several instances of 'window' classes (cScreenWindow). The idea is to allow each individual window to take care of it's own maintenance. ONE of the windows will be defined in cScreen as the 'default print window' so any output sent to the screen that isn't targeted for a specific window will print in the default.
To allow formatted printing, I want to use printf styled commands. I already have cScreenWindow::cswPrintf(const char *format, ...) and that works well if I am sending the command from cScreen. But the main program can't access the windows directly, so there is a command cScreen::csPrint(const char *format) that basically just finds the default print window, and passes 'format' to it. Everything works like that so far...
Here is the tricky part... I want the main program to be able to call a function like cScreen::csPrintf(const char *format, ...) that in turn gets the default cScreenWindow::cswPrintf(const char *format, ...) and passes 'format' AND the variable argument '...' to it.
Here is some sample code:
main{}{
cScreen csr;
csr.csPrint("This works");
csr.csPrintf("how do I pass %s??", "this");
}
class cScreen{
public:
// vars
char printWin[20]; // the title of the default print window
// functions
cScreen *getWin(const char *winName); // this part works fine
void csPrint(const char *format); // this part works fine
void csPrintf(const char *format, ...); // how do I pass this???
};
void cScreen::csPrint(const char *format){
cScreenWindow tempWin = getWin(printWin);
tempWin.cswPrintf(format); // this part works fine
tempWin.cswPrintf("this %s too!!", "works"); // this part works fine
}
void cScreen::csPrintf(const char *format, ...){
cScreenWindow tempWin = getWin(printWin);
tempWin.cswPrintf(format, ?????????); // this is the question!!!
}
In cswPrintf, I use: 'va_list argp;' and parse through the arguments when I encounter a format token. I figure there must be a way to pass the arguments through using the va_list, but I'm not sure how.... anyone got any ideas???
My default (which can be done, but I'd rather not) is to allow csPrintf to go ahead and parse the string, and send a fully integrated string to cswPrintf, but that kind of defeats the whole purpose...
Thanx for any ideas/help!
=->Mocs<-=
|
|
|
|
|
there is documentation and Google; among them they know the answer.
And you got some of the keywords already: va_list, va_start, stdarg, vsprintf, ...
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
you can pass that va_list to other functions and iterate over the args there.
|
|
|
|
|
Ok, I modified the csPrintf (the first one that passes the vars to the second) to look like this:
void cScreen::csPrintf(char *format, ...){
va_list argp;
char buffer[1024] = { 0 };
va_start( argp, format );
vsprintf_s( buffer, sizeof( buffer ), format, argp );
va_end(argp);
cScreenWindow tempWin = getWin(printWin);
tempWin.cswPrintf(buffer);
} // end of cScreen::csPrintf
This seems to work fine in most instances... curiously enough, it fails on one... calling csr.csPrintf(...) from the main routine looks like this:
csr.csPrintf("this is to test string function passthrough");
csr.csPrintf("char %c and int %d see if it works!", 'v', 10);
csr.csPrintf("string %s and hex %x see if it works!", "<test>", '\x00');
csr.csPrintf("test non-valid %y", 9);
The new routine above successfully calls tempWin.cswPrintf(buffer) in all instances except, curiously, the last. I have to think that the problem therefore lies in cswPrintf, except the debug keeps telling me it's in csPrintf. Oh well... wouldn't be the first time a computer lied to me...
Anyway, this (for the most part) works, and THAT was the main thing...
Thanks for the assist... I wanted to post to let you know it helped, and so anyone else reading could see how it wound out...
=->Mocs<-=
|
|
|
|
|
Oh.. duh.. the vsprintf is integrating the args into the string, which isn't exactly what I was trying to do... I was TRYING to pass them streight through... but the overall goal was to have the cScreenWindow.cswPrintf print a formatted string called from the main program, so THAT is done.... overall, does what I want it to do, but doesn't answer how to pass the args along (should that ever become necessary)
But that's why it's failing on cScreen.csPrintf (which is where it is trying to integrate the bad token) and not in my routine (where I thought it was)
=->Mocs<-=
|
|
|
|
|
Hello,
On selection(Hignlighted, selected) a word in CEdit, does WINDOWS OS return any message? like Onselect or somethingelse?. How do we know which message WINDOWS OS return on any control? is there a tool to know them?
thanks
|
|
|
|
|
Have a look at Spy++, it's a tool that should be installed with Visual Studio; it's used to spy messages (and other things) in an application.
|
|
|
|
|
The Spy tool does not show what messages windows return on any control on a dialog,
it shows only window's messages,
is there a tool that i can see window's controls messages?
|
|
|
|
|
Gofur Halmurat wrote: How do we know which message WINDOWS OS return on any control?
I always keep a handy link to the control library documentation[^] (in
my online docs).
For each common control, there's a list of the messages and notifications.
For most controls, there's descriptions of how the control handles windows
messages as well.
For example, here's Edit Controls[^]
I wish I had them all memorized
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
can i use like this?
<br />
BOOL CGetSelectedIETextDlg::PreTranslateMessage(MSG* pMsg) <br />
{<br />
if (pMsg->hwnd == GetDlgItem(IDC_EDIT1)->GetSafeHwnd() && pMsg->message == EN_CHANGE )<br />
{<br />
}<br />
return CDialog::PreTranslateMessage(pMsg);<br />
}<br />
or pMsg->message must be windows message, like WM_something?
|
|
|
|
|
Gofur Halmurat wrote: or pMsg->message must be windows message, like WM_something?
Yes. Edit control notifications are sent in WM_COMMAND messages.
When using MFC, I recommend using MFC event handling whenever possible.
That's a big benefit of MFC You should generally only need to override
PreTranslateMessage() in special circumstances, when you absolutely have to
catch a message before it gets dispatched through MFC's message handling.
ON_EN_CHANGE(IDC_EDIT1, OnEditCtrlChange)
...
void CGetSelectedIETextDlg::OnEditCtrlChange()
{
} I don't think EN_CHANGE is going to get sent when text is selected.
I could be wrong.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello, I found out that it must be like this,
thanks for everyone
if (pMsg->hwnd == GetDlgItem(IDC_EDIT1)->GetSafeHwnd() && pMsg->message == EN_KILLFOCUS )<br />
{<br />
<br />
<br />
int mm,nn;<br />
CEdit *myedit;<br />
CString sBuff;<br />
myedit = (CEdit*)GetDlgItem(IDC_EDIT1);<br />
myedit->GetSel(mm, nn); <br />
myedit->GetWindowText(sBuff);<br />
sBuff = sBuff.Mid(mm, nn - mm);<br />
AfxMessage(sBuff)<br />
}<br />
|
|
|
|
|
I guess as long as you get the desired result...
I just thought I'd mention...
EN_KILLFOCUS == WM_MOUSEMOVE == 0x0200
That means you're actually doing your processing (shown) on every
WM_MOUSEMOVE message.
Again, EN_xxx notifications come wrapped in WM_COMMAND messages.
They aren't messages themselves.
I also still wonder why bother using MFC if you're processing all messages
in PreTranslateMessage()...
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I am currently writing a downloading application and I was wondering if anyone had come accross a simple example of monitoring the user apps connection to the network.
I am looking to show something like the bandwidth monitor in limewire in the bottom left corner of their download window.
Any help would be fantastic, I am writing my app in Visual C++.
Kind Regards.
Alisdair Piercy
|
|
|
|
|
I have no idea what the limewire thing is or does, but if it's your application and you want to know what download rate you are getting and you have the number of bytes you received and the length of time to receive them then..... or am I missing something?
|
|
|
|
|
Yeah I am already doing this calculation to see the download rate, the question I am looking into is to see what the actuall bandwidth connection is like.
E.G.
If the network is 10 Mbps connection how much of that does the app actually have etc to show current network connection strength.
Alisdair
|
|
|
|
|
Alisdair Piercy wrote: If the network is 10 Mbps connection
Well I am still not sure I understand what you want but may this[^] will be a lucky guess
|
|
|
|
|
I'm adding exception handling to a C++ application and I get this error when I link.
What do I need to link with to resolve this external?
- BC
|
|
|
|
|
bruccutler wrote: What do I need to link with to resolve this external?
I don't know, but if I was in your situation the first thing I would do is read the documentation for CInvalidArgException
|
|
|
|
|
Is it an MFC application?
|
|
|
|
|
Yes, it is a C++/MFC application. There used to be an option to turn on Exception handling in the project file, but I can't find it.
|
|
|
|