|
hi can anyone help me in making graphs in visual c++. Setting the scale properly.
S@r@
|
|
|
|
|
Hi!
I've made a post similar to this earlier. Due to misunderstanding I've rebuild the Q.
What could possible be wrong when CFtpConnection::GetFile(…) returns 5 (Access is denied). I know the file exists because I've just successfully made a CFtpConnection::PutFile(…). I'm using the same CFtpConnection object.
How could I have right to write to my ftp but no right to read.
Any tips are helpful…
_____________________________
...and justice for all
APe
|
|
|
|
|
Can you 'get' the file manually (i.e., without using code)?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Yes, and with any (tried two) other FTP-clients with same login. Both of them success.
_____________________________
...and justice for all
APe
|
|
|
|
|
Ok, let's see the relevant code that uses GetFile() .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
At first, this Upload function works OK:
<br />
bool CFTP::UploadFileToFolder(const CString &strFile, const CString &strFolder )<br />
{<br />
if( !bConnectionEstablished )<br />
{<br />
AfxMessageBox( "FTP - No server connected." );<br />
return false;<br />
}<br />
<br />
CFileFind Finder;<br />
CString strFileName;
<br />
if( Finder.FindFile( strFile ) )<br />
{<br />
Finder.FindNextFile();<br />
strFileName = Finder.GetFileName();<br />
Finder.Close();<br />
} <br />
<br />
BOOL bUploaded = m_pFtpConnection->PutFile(strFile, strFileName, FTP_TRANSFER_TYPE_BINARY, 1 );<br />
<br />
if( !bUploaded )<br />
Error( "CFTP::UploadFileToFolder(...)" );<br />
<br />
return true;<br />
}<br />
and (using the same CFtpConnection object, m_pFtpConnection)
this funk doesn't work:
<br />
bool CFTP::DownloadFile(const CString &strFromUrl, const CString &strLocalPath)<br />
{<br />
if( !bConnectionEstablished )<br />
{<br />
AfxMessageBox( "FTP - No server connected." );<br />
return false;<br />
}<br />
<br />
return m_pFtpConnection->GetFile( strFromUrl,
strLocalPath,
TRUE,<br />
FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_BINARY, 1);<br />
}<br />
_____________________________
...and justice for all
APe
|
|
|
|
|
hi.
i wuould like to ask if anybody knows that pattern infermation of a cif video file (header, data etc).
also, is it possible to "divide" the cif video file into a series of still images (preferably bitmaps). if it is possible, how am i be able to do it. Our instructor required us to use Visual C++.
thanks in advance...
|
|
|
|
|
Hi,
I am writing an app which requires some CSocket derived objects to be created and processed in seperate threads. All was going well until I made the release build, when I started getting the SOCKET NOTIFICATION SINK errors (I was using CSocket within the CWinThread object).
OK, so after looking for a reason, I discover that it is to do with the CSocket not having an owner window to handle the messages (or some such - still a bit vague about it) and that it's a bit of a bug.
My workaround at the moment is to create a hidden dialog from the thread and put the CSocket derived class in here. This works great, except I get the pesky dialog appearing in the task manager. Since I plan to have several threads running, this is all a bit tacky.
Anyone got any better ideas? or failing that, anyone knwo how I can hide these dialogs without hiding the main window?
BTW using VC++ 6.0
Many Thanks
|
|
|
|
|
I don't think the problem lies within CSocket, because there is absolutely no connection between a CSocket and a window.
It must be something you are doing in your derived class.
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
I don't know if this is your problem, but I was having a problem yesterday with using a thread and CSocket. Microsoft has a confirmed bug in which certain members of CAsyncSocket don't get initialized correctly in a second thread (or something like that). The resolution was to put a call to the function I'm going to include below. This function can be a member of your class as long as you also make this static. Also this must be called before EVERY creation of a CSocket object in the second thread if you're doing it like I was in a loop.
void [YourClassName]::SocketThreadInit(void)
{
#ifndef _AFXDLL
#define _AFX_SOCK_THREAD_STATE AFX_MODULE_THREAD_STATE
#define _afxSockThreadState AfxGetModuleThreadState()
_AFX_SOCK_THREAD_STATE* pState = _afxSockThreadState;
if (pState->m_pmapSocketHandle == NULL)
pState->m_pmapSocketHandle = new CMapPtrToPtr;
if (pState->m_pmapDeadSockets == NULL)
pState->m_pmapDeadSockets = new CMapPtrToPtr;
if (pState->m_plistSocketNotifications == NULL)
pState->m_plistSocketNotifications = new CPtrList;
#endif
}
[insert witty comment here]
bdiamond
|
|
|
|
|
Thanks, this looks very helpful.
Any idea whether I call this before /after /instead of AfxSocketInit()?
Also, is it OK to declare a CSocket (derivative) as a member and then call it's Create() after running this, or should I just create it on the heap?
Thanks
|
|
|
|
|
In my app, it's called after AfxSocketInit(). I don't think it matters how you declare your CSocket object, as long as you call it before each Create in your new thread. In my app I allocate a CSocket object on the stack because it's only useful for the duration of the function.
[insert witty comment here]
bdiamond
|
|
|
|
|
I cant even get the fuction to run, it barfs at
#ifndef _AFXDLL
So I am at a real loss here. I tried removing this from my preprocessor defs and then I was in real trouble!
Are you actually creating /using your socket from the WinThread? or are you creating a CWnd for it?
Any chnace you can post some code up?
thanks,
|
|
|
|
|
Can any body help me in project in which I want to write data to cd in MFC
|
|
|
|
|
If it is required under XP only, you may check ASPI interface. Otherwise quickest solution will be using 3rd party libraries, like that of binarymagics.com
Igor Green
http://www.grigsoft.com[^]
Compare It! + Synchronize It! : Files and folders comparison never was easier!
|
|
|
|
|
Thanks other then VC++ which other plateform may be best
|
|
|
|
|
I don't know - I'm VC developer myself. But it should not matter - any Win32 development platform will have same limitation - well, maybe you will find free Delphi library for this. Another choice could be .Net - but it will limit your target platform anyway.
Igor Green
http://www.grigsoft.com[^]
Compare It! + Synchronize It! : Files and folders comparison never was easier!
|
|
|
|
|
Maybe. I have written to CDs, and my programs work under windows 2000.
If you can limit yourself to windows XP, there is a cd burning interface that will be easy to use. Check out the limits of that, it might meet your needs.
You can get third party libraries to do the hard work. A little costly, but it might be worth it.
The hardest is what I did: write pure scsi commands to the device, handeling everything manually.
I've been meaning to write a CP artical about what I did (no code as my boss won't approve it, but I can give a lot of hints on what your design needs to account for). Let me know if this would be useful, I've been trying to find some motivation.
|
|
|
|
|
Hi,
I am loading one BMP image from Resource file using CBitmaps::LoadBitmap() function. actually it is 24 bit image but if I use GetBitmap function of CBitmap to see the properties of the Bitmap the it shows the number of bits per pixel column as 32 bits. how come it is.
I want to convert this 32 bit image to 24 bit image. please let me know the how can i do that
Thanks in Advance
|
|
|
|
|
Hello,
The reason that the bitmap is 32 bpp instread of 24 is because of memory alignment.
Pentium processors work faster when data is aligned at 4 bytes (32 bits). Data that isn't aligned at multiple of 32 bits will wreck havoc on the Pentium processor.
The other reason for this alignment is that the most graphics cards don't support true 24 bit color modes. The reason for this is the same as for the Pentium.
Also there are no api's that can copy 3 bytes of memory at once. So for optimizing purposes the momory is aligned at 32 bits.
So you don't need to worry about the 32 bpp since the extra 8 bits are for your own good...
Hope this information was of any help.
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
same question i will ask, and the answer of you Mr is not enough, i want to convert from 32bits bimap to 24bits because i am using an engine supports only 24bits bitmap, the conversation is at C# level,
any information is more than welcomed.
|
|
|
|
|
Hi,
Interesting that you found my reply of more than 6 years ago . I can't help you here. Try posting your question in the C# section. Also try to elaborate on the ways that you've explored so far.
Kind regards,
Bob Stanneveld
|
|
|
|
|
Hello,
I want to give SSH based tunneling in my app. My app will then connect to the local port for secure communication over network.
For this I am using PLINK.exe provided at http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Now I want to connect to my server only if PLINK is successful in making a connection to the SSH server.
To do this I am using the following code:
[CODE]
char plinkapp[] = "g:\\myapp\\debug\\plink.exe -ssh -l username -pw pwd -L 1234:127.0.0.1:1235 127.0.0.1";
STARTUPINFO si;
PROCESS_INFORMATION pi;
memset ( &si, 0, sizeof(si) );
memset ( &pi, 0, sizeof(pi) );
si.cb = sizeof( si );
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
bool pret = CreateProcess ( NULL, plinkapp, NULL, NULL, NULL, NULL, NULL, NULL, &si, &pi );
assert ( pret );
WaitForSingleObject ( pi.hProcess, INFINITE );
/* my server code starts from here */
[/CODE]
Now the problem is that if PLINK is successful in connecting to the SSH server then it spawns up a new shell and waits there for input. So if the connection is successful the code segment is never coming out from WaitForSingleObject() code.
Now I want to execute my code only if the connection is successful otherwise return with an error? How do I find out if PLINK was successfull coz it just opens up a shell and waits there. I cant use some arbitrary millisecond to wait in WaitForSingleObject because if the network is slow then it will take more time to connect to the SSH server.
I was just hoping if there is a more elegant method? I tried piping but then the output after connection depends upon the SSH server which might be Linux or BSD or Windows based. So the output is never same.
The only thing i could figure out is that to modify PLINK source code (its opensource and there are no legal issues )? Do you suggest this method?
Thanks in advance.
Regards,
Karam
|
|
|
|
|
Hi
I created a network application using VC++ and CSockets
But the application fails on windows 2003 what could be wrong. ?
Regards
The Best Relligion is Science.
Once you understand it, you will know God.
|
|
|
|
|
I can't give you any specific help, just remember that Win 2003 runs very tight restrictions on almost every IO operations.
But you have to provide more info, it could be that you haven't got access to the MFC library, or that you are denied access to the library by Win 2003.
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|