|
Problem:
while downloading a huge file from a ftp server, if my service lost the connection in between, how can i resume the download?
The problems are
1: Since it is a huge file, it is not a good idea to restart the download.
2: If we are download by parts in different threads, then each thread should have different connection. This will not work when the server restricts the number of users.
Anybody please suggest a better algorithm for this.
|
|
|
|
|
that depends on whether the ftp server runs a version of ftp which allows resumes AND you have an ftp client which also supports Resume
cheers
bryce
---
Publitor, making Pubmed easy.
http://www.sohocode.com/publitor
|
|
|
|
|
To resume a download you need to use the REST command:
REST <byte offset="">
The REST command will make the server start at a give byte offsett and not at the start of the file.
When you send that command the server will reply with either a negative response, or the code 350, which means it will start at the byte offsett you've specified.
NOTE: The REST command must be followed by a service command (RETR or STOR).
-Rune SVendsen
|
|
|
|
|
When writing some text to a DC, it appears that the font creates it's own background for it's character spacing. I was wondering if there was a way to change this. Thanks.
bob
|
|
|
|
|
CDC::SetBkColor()<br />
CDC::SetBkMode()
~RaGE();
|
|
|
|
|
CDC::SetBkMode
int SetBkMode( int nBkMode );
Return Value
The previous background mode.
Parameters
nBkMode
Specifies the mode to be set. This parameter can be either of the following values:
OPAQUE Background is filled with the current background color before the text, hatched brush, or pen is drawn. This is the default background mode.
TRANSPARENT Background is not changed before drawing.
Remarks
Sets the background mode. The background mode defines whether the system removes existing background colors on the drawing surface before drawing text, hatched brushes, or any pen style that is not a solid line.
|
|
|
|
|
Iam doing a project in MFC using ODBC classes which can connect to any ODBC compilant database ..
1.I created a ODBC DSN for a access database mdb .WHile creating the DSN i did not specify any SYSTEM DATABASE .
2.When i executed the program ,it gave me an error "could not find "c:\cb\debug\dbo.db" .FIrst of all the access database i have given in DSN creation is different from that pointed out in the error message . Secondly the path shown in the ERROR message is the path of the executable .
How do i solve the problem .....
Every LIFE is unique and so there is no use in comparing ....
|
|
|
|
|
Iam doing a project in MFC using ODBC classes ..
1.I created a ODBC DSN for a access database mdb .WHile creating the DSN i did not specify any SYSTEM DATABASE .
2.When i executed the program ,it gave me an error "could not find "c:\cb\debug\dbo.db" .FIrst of all the access database i have given in DSN creation is different from that pointed out in the error message . Secondly the path shown in the ERROR message is the path of the executable .
How do i solve the problem .....
Every LIFE is unique and so there is no use in comparing ....
|
|
|
|
|
hi there,
Set the listctrl styles to OWNER_DATA and put a break point in OnItemChangingList function, it does not enter this function at all.
I can some how handle it in OnItemChangedList function by comparing the uOldState, but my question is why does not OnItemChangingList function not called when the list is in this style. If the control is not set to OWNER_DATA it works fine.
eagerly waiting for solution
bye
rajs
|
|
|
|
|
hi
well, I am trying to do the following:
I put a button on the dialog and associated it with exe file
that is:
void CMyView::CMyButton()
{
CIniReader ini;
ini.setINIFileName("./gm.ini");
CString ttl;
ttl = ini.getKeyValue("total", "path");
WinExec(ttl,SW_SHOWNORMAL);
// change the path in .ini file
//WinExec("D:\\Misc\\StarCraft\\StarCraft.exe", SW_SHOWNORMAL);
}
I have drawn the icon on the button (found the article for Button Image here). It works.
but, how to make the program so that when I change the .exe to execute in ini file, the icon on the button take the icon of exe
|
|
|
|
|
Dear Friends,
Hi !
I would like to retreive the program name of my program as a variable so can use in my program.
Is there is any such Function in WinAPI.
Kindly write to me.
Thanking you.
Adarsh
|
|
|
|
|
|
Hi PJ Arends
Thanks!
LPSTR also gives a name of a program with it`s complete path.
Anyway thanks a lot.
Bye
Binay
|
|
|
|
|
Hi PJ Arends
Thanks!
LPSTR also gives a name of a program with it`s complete path.
Anyway thanks a lot.
Bye
Adarsh
|
|
|
|
|
I tried to use CTreeCtrl::SetItemState, setting the flag TVIS_SELECTED. But I found that only one items was highlighted. How can I highlight a set of items? Thanks
|
|
|
|
|
TreeCtrl does not natively support multiple selection you will probably need to track selection state externally and use customdraw etc etc. Maybe block tvn_selectionchanging, listen to mouse leftclick and evaluate it in conjunction with keyboard state using HTREEITEM TreeView_HitTest(HWND hwndTV, LPTVHITTESTINFO lpht) or similar. Its not a simple ask.
You also need to define behaviour such as whether selecting a parent node auto selects all its children and whether the user can select nodes at varying different levels of the tree at the same time.
|
|
|
|
|
How could I highlight certain items in CTreeCtrl? I tried to use CTreeCtrl::SetItemState(),setting the flag as TVIS_SELECTED. But only one item was highlighted. Thanks.
|
|
|
|
|
AKAIK, it is only possible to select one item in the standard CTreeCtrl . Look in the CP articles for some enhanced CTreeCtrl .
~RaGE();
|
|
|
|
|
Hi, I wrote an application to make an exe a service.
it is a console based application(with a simple menu to create, delete, start, stop etc of service).
I can see my service added to services but when i try to start that service through my program or even manually I am getting 1053 error
can any body know why this error comes?
please help me yaar.
if you want i can give the code also.
thanks in advance
Harinath Reddy
HOneywell Technology Solutions Lab,
Bangalore,
India-560076
harinath@vandemataram.com
|
|
|
|
|
my purpose is to start a service which will put an icon in system tray.
and I already explained the problem.
now i did minor modification.
i added SERVICE_INTERACTIVE_PROCESS also for the 5th parameter of Create parameter.
<br />
SC_HANDLE schService;<br />
schService = CreateService( <br />
schSCManager,
lpszServiceName,
lpszDisplayName,
SERVICE_ALL_ACCESS,
SERVICE_WIN32_OWN_PROCESS| SERVICE_INTERACTIVE_PROCESS,
SERVICE_DEMAND_START,
SERVICE_ERROR_NORMAL,
lpszBinaryPathName,
NULL,
NULL,
NULL,
NULL,
NULL);
now it seems service is starting (i can see icon on system tray but after a minute it is diappearing and i am getting the same old error (1053)
same thing through program and manually also.
any more ideas pls
Harinath Reddy
HOneywell Technology Solutions Lab,
Bangalore,
India-560076
harinath@vandemataram.com
|
|
|
|
|
1053 means The service did not respond to the start or control request in a timely fashion.
You have to report to the SCM that your service is up and running using the SetServiceStatus() function...
If a service don't do that, the SCM think it hangs and kill it.
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
well, Thank you very much for your help. I understood the logic.
But where should i do that? let me put the question in other way. see the following is my code for starting the service (i took it from msdn)
<br />
DWORD StartSampleService(SC_HANDLE schSCManager) <br />
{ <br />
SERVICE_STATUS ssStatus; <br />
DWORD dwOldCheckPoint; <br />
DWORD dwStartTickCount;<br />
DWORD dwWaitTime;<br />
DWORD dwStatus;<br />
SC_HANDLE schService;<br />
CString cstrMessage,cstrCaption;<br />
cstrCaption="Service Message";<br />
<br />
char ServiceName[50];<br />
LPCTSTR lpszServiceName;<br />
cout<<"Enter the Name of the service: ";<br />
cin>>ServiceName;<br />
lpszServiceName=(LPCTSTR)ServiceName;<br />
<br />
<br />
schService = OpenService( <br />
schSCManager,
lpszServiceName,
SERVICE_ALL_ACCESS);
<br />
if (schService == NULL) <br />
{ <br />
cstrMessage="OpenService";<br />
cout<<"Error code "<<GetLastError()<<endl;<br />
}<br />
<br />
if (!StartService(<br />
schService,
0,
NULL) )
{<br />
cstrMessage="OpenService";<br />
cout<<"Error code "<<GetLastError()<<endl;<br />
}<br />
else <br />
{<br />
<br />
cstrMessage="Service start pending.\n";<br />
cout<<"Error code "<<GetLastError()<<endl;<br />
}<br />
<br />
<br />
if (!QueryServiceStatus( <br />
schService,
&ssStatus) )
{<br />
cout<<"QueryServiceStatus"<<endl; <br />
cout<<"Error code "<<GetLastError()<<endl;<br />
}<br />
<br />
<br />
dwStartTickCount = GetTickCount();<br />
dwOldCheckPoint = ssStatus.dwCheckPoint;<br />
<br />
while (ssStatus.dwCurrentState == SERVICE_START_PENDING) <br />
{ <br />
<br />
dwWaitTime = ssStatus.dwWaitHint / 10;<br />
<br />
if( dwWaitTime < 1000 )<br />
dwWaitTime = 1000;<br />
else if ( dwWaitTime > 10000 )<br />
dwWaitTime = 10000;<br />
<br />
Sleep( dwWaitTime );<br />
<br />
<br />
if (!QueryServiceStatus( <br />
schService,
&ssStatus) )
break; <br />
<br />
if ( ssStatus.dwCheckPoint > dwOldCheckPoint )<br />
{<br />
<br />
dwStartTickCount = GetTickCount();<br />
dwOldCheckPoint = ssStatus.dwCheckPoint;<br />
}<br />
else<br />
{<br />
if(GetTickCount()-dwStartTickCount > ssStatus.dwWaitHint)<br />
{<br />
break;<br />
}<br />
}<br />
} <br />
<br />
if (ssStatus.dwCurrentState == SERVICE_RUNNING) <br />
{<br />
<br />
cstrMessage="StartService SUCCESS.\n";<br />
<br />
dwStatus = NO_ERROR;<br />
}<br />
else <br />
{ <br />
cstrMessage="\nService not started. \n";;<br />
cout<<" Current State : "<<ssStatus.dwCurrentState<<endl; <br />
cout<<"Exit Code: "<<ssStatus.dwWin32ExitCode<<endl; <br />
cout<<" Service Specific Exit Code:"<<ssStatus.dwServiceSpecificExitCode<<endl; <br />
cout<<" Check Point: "<<ssStatus.dwCheckPoint<<endl; <br />
cout<<" Wait Hint :"<<ssStatus.dwWaitHint<<endl; <br />
dwStatus = GetLastError();<br />
} <br />
<br />
CloseServiceHandle(schService); <br />
return dwStatus;<br />
<br />
<br />
}<br />
<br />
where should i do the changes?
any further help?
thank you very much again.
cheers
harinath
Harinath Mallepally
HOneywell Technology Solutions Lab,
Bangalore,
India-560076
|
|
|
|
|
Ok, this may sound rather dumb, but this problem is irritating me greatly:
In using the CButtonST class I declared this in my code:
CButtonST *buttonArray[10][20]
One would normally think that this would create a 10x20 matrix, but in my program it creates a 20x10 matrix instead! Does anyone know why this is so? I tried to make a different array of the same size, but it too was reversed. Is there something that I'm missing in my code?
Any help would be much appreciated.
|
|
|
|
|
Taken from MSDN......
Array
An array is a collection of like objects. The simplest case of an array is a vector. C++ provides a convenient syntax for declaration of fixed-size arrays:
Syntax
decl-specifiers dname [ constant-expressionopt ] ;
The number of elements in the array is given by the constant-expression. The first element in the array is the 0th element, and the last element is the (n-1th) element, where n is the size of the array. The constant-expression must be of an integral type and must be greater than 0. A zero-sized array is legal only when the array is the last field in a struct or union and when the Microsoft extensions (/Ze) are enabled.
Arrays are derived types and can therefore be constructed from any other derived or fundamental type except functions, references, and void.
Arrays constructed from other arrays are multidimensional arrays. These multidimensional arrays are specified by placing multiple [ constant-expression ] specifications in sequence. For example, consider this declaration:
int i2[5][7];
It specifies an array of type int, conceptually arranged in a two-dimensional matrix of five rows and seven columns
5 ROWS X 7 COLUMNS!
|
|
|
|
|
That's not my problem though. I know what a matrix is and how to declare one; it's that my
CButtonST *buttonArray[10][20]
matrix is making a matrix of 20 rows X 10 columns, which is in the wrong order.
|
|
|
|