|
Ok, what does GetFile() return? If it's FALSE , what about GetLastError() .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Error code is 12003, but string is empty
|
|
|
|
|
lewislewis_lewis wrote:
Error code is 12003...
Which is ERROR_INTERNET_EXTENDED_ERROR . Use InternetGetLastResponseInfo() to get more details.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Do we have the way to manipulate the files?
|
|
|
|
|
I'm not sure what you mean by "manipulate." You are wanting to download a file from an FTP server using GetFile() . My suggestions thus far have been unsuccessful (it's not like I was holding something back, I just don't have an FTP server to test stuff on). You might try using the CFtpConnection ::OpenFile() /CInternetFile::Read() /CInternetFile::Write() trio instead.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
ftp://ftp.microsoft.com/PSS/Tools/Developer%20Support Tools/WINDBG 4.0.18/
dbg_x86.exe
and use CFtpConnection class function : GetFile, OpenFile, SetCurrentDirectory
Thanks
|
|
|
|
|
This worked for me:
CInternetSession ISession;
CFtpConnection *pFTPConnect = NULL;
BOOL bContinue;
pFTPConnect = ISession.GetFtpConnection(_T("ftp.microsoft.com"), _T("anonymous"), _T("name@company.com"));
bContinue = pFTPConnect->SetCurrentDirectory(_T("/PSS"));
if (bContinue)
bContinue = pFTPConnect->SetCurrentDirectory(_T("Tools"));
if (bContinue)
bContinue = pFTPConnect->SetCurrentDirectory(_T("Developer Support Tools"));
if (bContinue)
bContinue = pFTPConnect->SetCurrentDirectory(_T("WINDBG 4.0.18"));
if (bContinue)
pFTPConnect->GetFile(_T("dbg_x86.exe"), _T("c:\\dbg_x86.exe"));
if (NULL != pFTPConnect)
pFTPConnect->Close();
delete pFTPConnect; You'll need to put in the necessary error checking.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
1)If your code ok for "ftp://ftp.microsoft.com/deskapps/games/public/cc3/Screenshots/Stalingrad zoom out.bmp"?
The file name have space!!!
2)_T() is necessary? why?
3) How to use CFtpConnection ::OpenFile()/CInternetFile::Read()/CInternetFile::Write()? Why not use CFtpConnection::GetFile()
Thanks!!!
|
|
|
|
|
I tried to disable the "Save" toolbutton on the toolbar.
I tried to set the state of "Save" toolbutton to disabled mode by specifying
TBSTATE_INDETERMINATE . But this doesnt disable the save toolbutton.
TBBUTTONINFO buttonInfo;
buttonInfo.cbSize = sizeof( TBBUTTONINFO );
buttonInfo.dwMask = TBIF_COMMAND;
buttonInfo.fsState = TBSTATE_INDETERMINATE ;
m_wndToolBar.GetToolBarCtrl().SetButtonInfo(ID2_FILE_SAVE, &buttonInfo);
Let me know the exact procedure to do the same.
Thanx in advance
laiju
|
|
|
|
|
Check out ON_UPDATE_COMMAND_UI(ID2_FILE_SAVE, ...) . In the handler function, you can easily enable/disable the Save button.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
|
Hi,
I have a query on pointer arithmetic.
I declared a structure like this
struct myStruct{
int index;
char sz[124];
};
Inside the main(), I created 10000 objects of the structure and assigned it to a pointer variable.
myStruct* obj = new myStruct[10001];
memset( obj,0,sizeof(myStruct) * 10005);
myStruct* obj1 = obj;
long l1 = 0;
for( long l=0;l<100000000;l++)
{
obj++;
l1 += obj->index; //just an addition so that compiler wont remove the previous line
if( i % 10000 == 0 ){
obj = obj1;
l1 = 0; //reseting the values;
}
}
When I executed this, it took me 8 sec.
But if I reduce the size of myStruct to 64, it takes only 4 sec.
ie.
struct myStruct{
int index;
char sz[60];
};
and again reducing the size to 32, it takes only 2 secs.
I examined the assembly code which was generated by Disassembly, and the only change was in the 2nd line
obj++;
mov edx,dword ptr [ebp-14h]
add edx,100h
mov dword ptr [ebp-14h],edx
thats in
add edx,100h ( 256 b ) time : 8sec
add edx,20h ( 32 b ) time : 2sec
Can anybody pl. give me an explanation for this behaviour.
I was able to reproduce this behaviour in Unix also....
Thanks and Regards
Jagadeesh
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
This is an effect of L1 cache. You did not mention the CPU you were using. I assume it was a P4. The L1 access line size is 64 bytes if my memory serves me right. If there are no alignment issues(your compiler often does a good job at this), the smaller size the structure is the more effective for a single L1 line access. Nowadays, people often talk about structure of arrary (SoA), that address such issues....
|
|
|
|
|
Hello,
Jagadeesh VN wrote:
Inside the main(), I created 10000 objects of the structure and assigned it to a pointer variable.
myStruct* obj = new myStruct[10001];<br />
memset( obj,0,sizeof(myStruct) * 10005);
Here you actually create 10.001 structs and initialize 10.005! This is very wrong!
Jagadeesh VN wrote:
for( long l=0;l<100000000;l++)<br />
{<br />
obj++;<br />
l1 += obj->index;
<br />
if( i % 10000 == 0 ){<br />
obj = obj1;<br />
l1 = 0;
}
A couple of questions on this piece of code:
<list> Why the dummy addition (l1 += obj->index; ) The compiler won't remove the line, since you use the object further down your code!
Why such a long loop?
Your loop does nothing usefull, why?
To get to an answer, I honestly don't think that the long loop is your problem. I think the problem lies with memset() . Let me explain: your execution time drops liniear with the size of the struct. So the size of the array decreases also liniear. (You halve the size of the stuct, so the size of the array is also halved.) So the amount of memory that memset() has to fill is also halved!
Besides that, your loop executes 100 million times! Don't expect that to finish in a few ms..
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
I am trying to write a function that copies a jpg or a gif to the clipboard, when I pass the path to it.
ie
jpgclip("C:\test.jpg")
Can anybody help me?
Regards
Paul
|
|
|
|
|
Have you looked at SetClipboardData() ?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Yes I have looked at this function, but could use a few pointers on how to use it. I know I can send a bmp to the clipboard with this, but is there anything I need to know when sending jpg or gif?
|
|
|
|
|
See if this search helps.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi Everybody
I am doing a project in image processing using MFC.
Could some one tell how to save a bitmap (1 bit,4,8,24 bits respectively).
Thanks in advance.
|
|
|
|
|
No 16 bit ?
If you're using GDI+, read my articles on the subject. Otherwise, I guess either save to bitmap only ( the format is well documented and simple ), or find some other library to use.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi I am doing a project in image processing using MFC. GetBitmapBits() stores the pixel value in a BYTE array. It works fine with 8 bits bitmap, but when working with 4 bits bitmap, it combines 2 pixel values and stores in the BYTE array.
How to overcome this problem
|
|
|
|
|
Use && and || to combine and mask values, instead of + or =. For example, FF && F0 == F0. If you take an 8 bit number and set it to equal itself && 15, you get only the low four bits, && 240 gives you the high four. In that way, you can set one pixel to zero. Then if you want to set the pixel in the low four bits, you just put oldVal || newval, that copies it in. to copy into the high four, do this: oldval || ( newVal << 4). this shifts the values up four bits first. To just set two pixels do this (pixelLeft << 4) + pixelRight. You can use plus here, because you're replacing both values.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
Dagnamit. Sorry.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
hiho@ll
i try to change the source of a browser helper object, which makes some strange things (like opening google, if i want to open a .js file )
my question (because i don't really know much about helper objects) how can i debug the object?
it is visible as an Add on in Inernet Explorer
and when i try to debug the bho visual studio .net asks which application holds the debug information
i tried using Internet Explorer, but didn't work
the helper object is a dll
maybe the question should be how to debug a dll?
thx@ll
|
|
|
|