|
A direct function call would be the fastest, but direct function calls can only occur within a process. Since you're hooking other processes this could cause problems.
Steve
|
|
|
|
|
I need to create a dll that will wrap Microsoft wininet.dll
The idea is to install this Dll instead of the regular one in all the organization workstation and add some adjustments to few actions in the wininet.dll, especially logs
Is it possible? I need to do it so the application that use the wininet.dll wont be noticed the different.
|
|
|
|
|
alto wrote: I need to create a dll that will wrap Microsoft wininet.dll
The idea is to install this Dll instead of the regular one in all the organization workstation and add some adjustments to few actions in the wininet.dll, especially logs
Is it possible? I need to do it so the application that use the wininet.dll wont be noticed the different
little difficult task but achievable! you need to program all the function exposed by WinInet with same order and need to deploy it over wininet!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Probably a bad idea... thinking about how many legal scenarios there are to change wininet.dll.
|
|
|
|
|
Fat file system store file create date in 2 bytes. Same way it stores file create time in 2 bytes.
Is there any function which tells whether this 2 bytes date/time is valid or not?
|
|
|
|
|
Provided you have the reference documentation, I suppose you (or we) may possibly write it.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
I got the following code from Niklas Lindquist
CBitmap *bm = new CBitmap;
bm->LoadBitmap((UINT) IDD_BITMAP);
CDC *cdcwindow = this->GetDC();
CDC cdcimage;
cdcimage.CreateCompatibleDC(cdcwindow);
CBitmap *oldbit = cdcimage.SelectObject(bm);
cdcimage.SetDCBrushColor(RGB(125,125,125));
COLORREF cr = cdcimage.GetPixel(0,0);
LPVOID bitptr = NULL;
if (bitptr == NULL)
bitptr = new char[4000];
bm->GetBitmapBits(4000,bitptr);
cdcimage.FloodFill(0,0,cr);
bm = cdcimage.SelectObject(oldbit);
What I am trying to do is fill the background of a Bitmap with a Gray Color
When I look at what is in the bitmap via bm->GetBitmapBits I see a whole buch of white Color
e.g. FF FF FF 00 FF FF FF 00 this pattern continues for many many bytes
After execution of the Floodfill shouldn't the white be whats in the current brush which is gray so that
FF FF FF 00 is now 80 80 80 00
When I look at that adddress in code it still FF FF FF 00
|
|
|
|
|
i think you need to select a brush (specifically, GetStockObject(DC_BRUSH)) into the DC before calling SetDCBrushColor.
|
|
|
|
|
I believe this is the code I gave you here[^]
CDC cdcimage;
cdcimage.CreateCompatibleDC(&cdcwindow);
COLORREF clrFill = RGB(128, 128, 128);
CBrush brush;
brush.CreateSolidBrush(clrFill);
CBrush *pOldBrush = cdcimage.SelectObject(&brush);
CBitmap *oldbit = cdcimage.SelectObject(&m_bitmap);
COLORREF clr = cdcimage.GetPixel(0, 0);
cdcimage.ExtFloodFill(0, 0, clr, FLOODFILLSURFACE);
cdcimage.SelectObject(oldbit);
cdcimage.SelectObject(pOldBrush);
|
|
|
|
|
OK I have a boat load of code, it works, bit its unaware of vectors etc.
I have a vector template that fully supports all standard operators, including scalars
I have a matrix template that supports all standard operators, including vectors and scalars
So give some matrix<template_class> m
int rows=m.data.size()
int cols=m.data[0].size();
what can we do to make m become reduced row echelon form
no back substitution yet, I just wanted to see a vector way to identify a pivot from m
and make it reduced form
this way I it should be easier to find the rank etc.
So as I see it we need to find a pivot
My matrix works with std::swap for any 2 rows
My m[] returns a vector, m[][] returns template_class
m = m + v[] works
m = m + template_class works
so do the other operators
I made it assignable by element or row
BTW my vector and matrix templates are parallel, hence the reason I wanted to leverage them
http://www.contract-developer.tk
|
|
|
|
|
Hi.
I am very new to C and C++, what is the best way of downloading data from a HTTP server, meaning, how to i download the HTML from http://www.google.com?
|
|
|
|
|
Have a look at the MFC classes CHttpFile and CHttpConnection ...
also, look at this article on CP : Retrieving a file via. HTTP[^]
Max.
Watched code never compiles.
|
|
|
|
|
Hi. i am developing to a linux device, is there any way without MFC?
|
|
|
|
|
Well, since it's a Windows development site, I assume you were developing for Windows.
on linux, yeah, there's probably something that does it; but it's probably more complicated.
a quick googling returns this : http://curl.haxx.se/[^] or this : http://rosettacode.org/wiki/Web_scraping[^]
just to give you a good start.
good luck.
Watched code never compiles.
|
|
|
|
|
One way would be with URLDownloadToFile() . Other ways exist, too.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
I'd recommend cURL, it's got an interface only it's programmer could love but it's actually fairly easy to do what you want to do. Run, don't walk to http://curl.haxx.se/[^] and download it. Actually if you're using Linux it's probably available as a package in your distro.
Cheers,
Ash
|
|
|
|
|
very simple and good article for achieving your goal :-
AmHttpUtilities[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
|
I have the following code:
class A
{
public:
A(void);
~A(void);
};
class B
{
public:
B(void);
~B(void);
};
void testfunction(A* x){};
I want to be able to directly use:
B* x;
testfunction(x);
instead of doing an explicit cast, like
B* x;
testfunction((A*)x);
Is there a way to do this. I tried using a conversion constructor in testclass (i.e. A::A(B)) but that didn't work, also I tried defining a A* operator in B but that also failed. Is there any way I can do this?
|
|
|
|
|
Why do you want to do something like that ? A and B are two completely different classes so, why do you want to be able to pass a B to a function expecting an A object ? It's a bit like asking how can I convert an apple to a car, it doesn't make any sense.
If the objects are related in some way, then I would suggest that they have a common base class and that your function expect a pointer to the base class. Then you can pass a pointer to an instance of A or a pointer to an instance of B but the function will treat them as a pointer to the base class.
But if the class are unrelated, I think you are making a very bad design decision.
|
|
|
|
|
The project is bigger than what I've written down. I know it's usually not safe but we're sure the memory layout of the classes permit this forced cast and that it actually works. My questions still stands. Also, the question is how (if at all) this can be done, not whether it is safe or not.
|
|
|
|
|
Also, the function expects a pointer to an A object, not an A object itself. I'm just looking for a way to tell the compiler I want the (A*) operator implicitly cast so I don't have to change the whole project (which is pretty big).
|
|
|
|
|
Arkh wrote: I know it's usually not safe but we're sure the memory layout of the classes permit this forced cast and that it actually works.
Then state this relation giving them a common base class or interface.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Arkh wrote: but we're sure the memory layout of the classes permit this forced cast and that it actually works
Honnestly, that's a receipt for disaster: if later you have a programmer who wants to document the class and innocently swap two variables of your class, you are doomed. This is an extremly bad practice, and that's one of the reason why type safety is so strong in C++.
Anyway, you still didn't answer the question: WHY do you want something like that ? It doesn't make any sense that your function accept a pointer to A and you pass a pointer to B making believe the function that it is a pointer to A
|
|
|
|
|
Ok here goes. We're migrating our software to run on more platforms. Initially we had something like:
class A : public B {};
void function(B* x) {};
Obviously
A* y;
function(y);
used to work. Now we have some wrapper classes, call them xA (over A) and xB (over B). Therefore:
class xA : protected A {};
class xB : protected B {};
void function(xB* x){};
Since xA is not derived from xB, calling the function as before no longer works.
xA* x;
function(x);
function((xB*)x);
The protected in the inheritence between the base and wrapper classes is necesarry. All functions in A and B are overwritten in xA and xB respectively but no new members are added. This is part of the specs.
Now can you answer the question?
|
|
|
|