|
Thanx Rechi One extra question ? R U from Romania ?
I tried that, but unfortunately i get:
ERROR_HTTP_HEADER_NOT_FOUND ... At first i had this in mind that is to play with such functions like Internetqueryoption and stuff, but no matter how much I dig up those flags I didn't find anyone related to the whole file size, just related to sections ...
THANKZ anyway :->
|
|
|
|
|
gecool wrote:
ERROR_HTTP_HEADER_NOT_FOUND
It's about the headers, take a look at this (old) fragment:
HINTERNET hResource=::HttpOpenRequest(hConnection, _T("GET"),
szRelativeFile, NULL, NULL, NULL,
INTERNET_FLAG_KEEP_CONNECTION, 0);
if (hResource)
{
LPTSTR szHeaders=_T("Accept: audio/x-aiff, application/octet-stream, "
"application/x-msdownload, audio/basic, "
"audio/midi, audio/mpeg, audio/wav, image/jpeg, image/gif, "
"image/jpg, image/png, image/mng, image/bmp, text/plain, "
"text/html, text/htm\r\n");
CString szAgentHeader;
szAgentHeader.Format(_T("User-Agent: %s/1.0\r\n"),
(LPCTSTR)m_szAppName);
HttpAddRequestHeaders(hResource, szHeaders, _tcslen(szHeaders),
HTTP_ADDREQ_FLAG_ADD_IF_NEW);
HttpAddRequestHeaders(hResource, (LPCTSTR)szAgentHeader,
szAgentHeader.GetLength(), HTTP_ADDREQ_FLAG_ADD_IF_NEW);
if (HttpSendRequest(hResource, NULL, 0, NULL, 0))
{
DWORD dw=0, dwOut=0, i=0, n=0, dwContentLength,
dwSize=sizeof(DWORD);
CString szFileFromPath=CUpgrader::GetFileFromPath(
szRelativeFile), filepath;
if (!::HttpQueryInfo(hResource, HTTP_QUERY_CONTENT_LENGTH |
HTTP_QUERY_FLAG_NUMBER, &dwContentLength, &dwSize, NULL))
dwContentLength=-1;
and check if something is missing in your code. It's from an update system i wrote a year ago, and it works like a dream :->
gecool wrote:
R U from Romania ?
Yeah!
"though nothing
will keep us together
we can beat them
for ever and ever"
rechi
|
|
|
|
|
Mersi mult
Tocmai asta asteptam sa gasesc un piece of code ....
Geo.
|
|
|
|
|
If you think you can help me to use the code that was published by Allan Nielsen in his article "SuperGrid",
please let me know!!!
thanks in advance,
sheli
|
|
|
|
|
That's why there's a space to post questions under the article
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
I have to set an icon on a toolbar button - how do I do that????
I am programming in visual 6.0.
If you realy wona help me please detail all the steps.
thank you
|
|
|
|
|
At design time or run time?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Please Help.
How can i use the CListView (Add new Items, Columns, Sort, etc?
Thanks
|
|
|
|
|
First call GetListCtrl() to get a reference to the "underlying" list control. Then you can use that object's InsertColumn() and InsertItem() methods.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thanks but I don't find de GetListCtrl()
I Have a Dialog that i Have inserted a New ActiveX Control (MSCOMCTL.OCX V6). When starts a Class Wizard, it add some .cpp and .h files automatically and i have the same problem.
Do you have any example.
Thanks again
Xavier
|
|
|
|
|
ivax wrote:
Thanks but I don't find de GetListCtrl()
It is a member of the CListView class.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thanks, but something fail.
the compiler report an error: GetListCtrl() is not a member of CListView1.
I has find GetListCtrl in CListView.h and CListView1.h and don't find.
Please, can you give me more help?
|
|
|
|
|
Why are you using an ActiveX control rather than one that is already provided by MFC?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi David. This ActiveX is provided by Microsoft in VS 6. Is a Microsoft ListView Control Version 6. The OCX File Name is MSCOMCTL.OCX In VB, it provides more properties and functions and i try to use un VC++.
Many thanks again
Xavier
|
|
|
|
|
ivax wrote:
This ActiveX is provided by Microsoft in VS 6.
So is the other, plus it is easier to use (IMO). The thing about ActiveX controls is that they might not be registered, or even available, on the target machine. Some folks I know do not even allow ActiveX controls to run on their machines (for security reasons).
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
argv[0] only provides how the application has been invoked. How can an application obtain the full path and file name even when the system has found the application using the path environment variable?
|
|
|
|
|
See here.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
<br />
TCHAR lpszPath[MAX_PATH] = {0};<br />
DWORD dwResult = ::GetModuleFileName(AfxGetInstanceHandle(), lpszPath, MAX_PATH);<br />
That should do the trick
|
|
|
|
|
Try looking into GetModuleFileName(...) . Despite the name, it returns a fully qualified path.
Peace!
[EDIT] Hmmm... Guess I should refresh more often...! [/EDIT]
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites
|
|
|
|
|
Hello,
I have a problem with the combo box in the CGridCtrl. I set an options list and I don't get a default selection. Also when I do select an item, the selection goes away when I select an other cell or control...
Do I need to do something special to get a default selection or to get the new selection visible?
Thanks in advance,
Bob
|
|
|
|
|
Hi,
Can you please get me the answers for the following questions
1. VTABLE lies in what part of the memory? Isit in Stack, Heap or Datasegment?
Is VTABLE created at compile time or at runtime?
2. Whats the exact diff. between Abstraction and encapsulation?
3. There is base and derived class, Say there is a virtual fn Draw() in the Base class and its not overrided in the derived class. Now the object for the derived class is created and stored in the base class pointer. Now call the Draw() fn via the base class pointer. The base class Draw() is called as there is no implementation in the derived class.
Internally, two VTABLEs are created one for base and other for derived class. How internally the compiler calls the base class Draw() fn. How does this work wrt the VTABLE?
4. Where class member fn are stored in memory and how the compiler makes a call to these member fns?
5. What are the things the parent and child thread doesn't share?
6. Say, char* pstr = "Helloworld";
Now reverse the string pstr without using any temp variable? When we cout the pstr it should Helloworld should be reversed?
Thanks in advance.
sarathymail
|
|
|
|
|
psmail wrote:
Can you please get me the answers for the following questions
This smells of homework.
psmail wrote:
6. Say, char* pstr = "Helloworld";
Now reverse the string pstr without using any temp variable? When we cout the pstr it should Helloworld should be reversed?
Ue strrev() .
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
DavidCrow wrote:
This smells of homework.
Hmmm... you're right, I didn't see that. Anyway, all the implementation of virtual functions stuff is compiler dependent IIRC, so it's only valid for VC++
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
psmail wrote:
1. VTABLE lies in what part of the memory? Isit in Stack, Heap or Datasegment?
Is VTABLE created at compile time or at runtime?
I'm not sure, but since it's function pointers it makes most sense to me that it is in the code segment. Its definitely not in stack or heap. The vtable is created at compile time, as there is only one vtable per class, and this vtable is shared by all instances of that class
psmail wrote:
2. Whats the exact diff. between Abstraction and encapsulation?
Abstraction is an "is-kind-of" situtation, encapsulation is an "is-made-of". For instance, a luxury car "is-kind-of" car, as is compact car, but car "is-made-of" four wheels, not "is-kind-of" four wheels. Does that make any sense?
psmail wrote:
Internally, two VTABLEs are created one for base and other for derived class. How internally the compiler calls the base class Draw() fn. How does this work wrt the VTABLE
IIRC the vtable for the derived class contains all the vtable entries from the base class. If a virtual function is overriden in the derived class the function pointer in the corresponding slot in the vtable of the derived class is substituted to point to the overriden version of the funcion.
psmail wrote:
4. Where class member fn are stored in memory and how the compiler makes a call to these member fns?
If you mean non-virtual functions then they are stored in the code segment. The compiler/linker resolves the address of these functions during compilation/linking. So when a method invocation is compiled, the compiler marks the spot in the code where the address of the called method is to be put. The linker then finds all these marks and substitute them with the actual address of the method. It's all done pre-runtime.
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Steen Krogsgaard wrote:
I'm not sure, but since it's function pointers it makes most sense to me that it is in the code segment. Its definitely not in stack or heap. The vtable is created at compile time, as there is only one vtable per class, and this vtable is shared by all instances of that class
Don't take it personally, but that's not quite right
The vtable is part of an object - each object has its own copy. It is stored as part of the object's data, and is initialised as part of the object's construction, before the constructor is called (disassemble the constructor code to see where). It's initialised by copying the data verbatim from its class's class-specific vtable.
The reason it's got its own copy is so that virtual functions work. Take the following code:
void myFunc(MyBaseObject* objPtr)
{
objPtr->myVirtualFunction();
}<br/><br/>myFunc(new MyDerivedObject); If the vtable was per class, then this wouldn't work. When myVirtualFunction was invoked, the compiler would have to know what type of object objPtr was so it could invoke the correct implementation of the function. Since the whole point of polymorphism is that compiler doesn't have to know what type of object it's got, this simply will not work. If the vtable is per-object, all the compiler has to do is lookup in the object's vtable the function pointer using the correct table index and call it. The compiler has to make sure that each implementation of a virtual function is given the same index into the table for all the classes derived from the same base class. So in essence, this call translates to something like:
(*objPtr->vtable[myVirtualFunctionVTABLEindex])() Hopefully that clears things up a little
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|