|
An outline for a solution of your problem:
An image seen in IE is actually a copy of that image stored on your HD, that's the reason you get a local filename. I quickly red the Article. My conclusion is that the writer somehow copies the HTML-page to the clipboard and then this html-page is inspected (because there's the url). You can mimic this behaviour by opening a html-page in IE, Rightclick (in a textarea), select "View source" from the contextmenu. Now it shows the Html-source in Notepad, select Paste to put it on the clipboard. (Inspect the writer's code to find out how he automated this.)
Now it's our turn: your program must inspect the clipboard to get the right URL... This is basicly a search in a textfile, although an Html-parser could help you).
Rozis
|
|
|
|
|
Yes,Rozis,Your solution is right.
I do as Code-o-mat told me this morning and using a CF_DIB format to get ahGlobal ,save it as bitmap and it's work now.
I also find I can do follow as ClipSpy did,Get the image URL(It's seem use a "application/x-moz-file-promise-url" format can let's me get right URL directly without search textfile) first and then add some code to download it ,It's should be work.
Anyway,thanks Rozis
Edit:
Sorry, "application/x-moz-file-promise-url" can only be get from firefox . it's seem like Rozis said ,If we want to gain the true image's URL across browser we should prase the html by ourself
modified on Thursday, July 30, 2009 11:08 PM
|
|
|
|
|
I have a file, which contains a set of ip addresses, i.e:
123.456.111.222
222.555.111.777
.....
The file will be installed with software together to users' PC.
The file will be updated by auto downloading, so it is independent from software, and IPs can not be written inside C++ code.
I hope users can't see these IPs, so I want to encoding it in a security format, maybe with password or not, and my software can read the file properly.
I think there must be some classes which can help me to do this.
Thanks for any links, comments or ideas - C++ classes are best.
|
|
|
|
|
|
Thanks,
I will have a ditail look.
|
|
|
|
|
I am curious if these operations return the same results:
<br />
_tzset();<br />
if (GetTimeZoneInformation(&tzInfo) == TIME_ZONE_ID_STANDARD)<br />
ctime = new CTime(startTime, 0);<br />
else<br />
ctime = new CTime(startTime, 1);<br />
<br />
time_t nTime = (time_t) ctime->GetTime();<br />
and
<br />
_tzset();<br />
CTime *ctime = new CTime(startTime, -1);<br />
time_t nTime = (time_t) ctime->GetTime();<br />
I cannot guarantee if the host machine will have Time Zone information and/or Daylight Savings time info set on their operating system.
Can anyone tell me one way or the other?
|
|
|
|
|
john john mackey wrote: I cannot guarantee if the host machine will have Time Zone information and/or Daylight Savings time info set on their operating system.
And if they aren't set, maybe there's a reason. Trying to override something that the user has configured is rarely a good idea.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
OK!! I tried to figure out all the error.... but plz can anyone confirm Is this correct ... and will it work...
strcut is in header file
typedef struct
{
unsigned int flag;
vector <unsigned char=""> data;
} Packet;
void funcA (Packet *);
int funcB (vector<unsigned char="">);
And now below code is in my *.cpp file
class Handler
{
Public:
void Handler::funcA (Packet *Packet)
{
vector <vector <unsigned="" char=""> > savedata;
if(flag = 1)
{
savedata.push_back(Packet->data)
funcB(savedata); // I am getting error cannot convert parameter 1 from td::vector<_ty> // // to std::vector<_ty>
}
}
int funcB (vector<unsigned char=""> Usedata)
{
}
Please can someone tell me how can I pass vector to an func... and is my vector to vector assignment correct I am not gettign error.... for tht one..
I am getting error cannot convert parameter 1 from std::vector<_ty> to std::vector<_ty>
Thanks!!!
|
|
|
|
|
Please read #5 and #6 from here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
My question may be more on style than on correctness of coding.
I have 2 functions in different projects that I'm consolidating into one class.
<br />
CMyClassA<br />
bool GetAbsTime(SYSTEMTIME *startTime, double hourTime, ClockTime *absTime);<br />
...<br />
CMyClassB<br />
bool GetAbsTime(SYSTEMTIME *realWorldTime, double hourTime, ClockTime *absTime);<br />
...<br />
the internals of these functions are different, but they have the same name and the arguments are the same type-wise.
My Question: what would be best way to preserve these function names (as they are now), but have a way of distinguishing each function?
<br />
CTimeUtilities
<br />
bool GetAbsTime(SYSTEMTIME *startTime, double hourTime, ClockTime *absTime);<br />
bool GetAbsTime(SYSTEMTIME *realWorldTime, double hourTime, ClockTime *absTime);
|
|
|
|
|
You can't have both : you need to either change the name of one of the methods or change the type of an argument so that they can be differentiated.
Another option is to combine the two methods into one and pass an additional argument that tells it what code path to execute. The argument can have a default value so that the code that uses that method does not have to be changed if you want.
|
|
|
|
|
You could add an extra dummy parameter to one of the functions just like the prefix/postfix ++/-- operators.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
thanks _Superman_ and Rick York (and others) for their advice. I may check into your suggestion for sake of learning (dummy parameter like the prefix/postfix operators.)
I believe the work involved to rename would be about the same as additional parameters for each instance in where I make a call to the specific function in question.
Cheers!
|
|
|
|
|
for consolidation is best to use an additional parameter, but for clarity is best to introduce different names. The third way: You can do both, via copying the stuff
I personally prefer strongly simplicity and clarity, so I can use also old and long not seen code.
So choose your way...
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Erm, I may be a bit thick...
But to read your post:
john john mackey wrote: CMyClassA
bool GetAbsTime(SYSTEMTIME *startTime, double hourTime, ClockTime *absTime);
...
CMyClassB
bool GetAbsTime(SYSTEMTIME *realWorldTime, double hourTime, ClockTime *absTime);
...
You have two classes, and they have method that have the same name. So what? I can do the following if I like:
CCorrect
{
public:
UINT HowCoolIsIain () { return 99; }
};
CWrong {
public:
UINT HowCoolIsIain () { return 1; }
};
main ()
{
CCorrect answer1l;
CWrong answer1l;
cout << answer1.HowCoolIsIain ();
cout << answer2.HowCoolIsIain ();
}
This is not operator overloading. I could have called those two functions Alive and Bob, and it would have generated the same machine code. Done the same thing... It can be handy doing this sort of thing - many of my classes have a GetSize () method for how large they'd be if stored on the hard disk, etc.
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
to clarify, I want to combine (merge) my two functions into one common class
<br />
CTimeUtilities<br />
bool GetAbsTime(type-A arg1, type-B arg2, type-C arg3);
bool GetAbsTime(type-A myArg1, type-B arg2, type-C arg3);
I don't want to use a new name for either function, but the work seems about the same to change all instances of my function to have a new argument (parameter) as it would to change the name.
alas, i believe I must just bite the bullet and rename
Regards,
John John
|
|
|
|
|
Did you read what I said ?
You can add another parameter and it can have a default value which means that you don't have to change any of the code that calls it using the default value. You only have to change the code that would use the non-default parameter. This could cut the amount of work to do considerably.
|
|
|
|
|
I have a picture control in a dialog box. I know how to draw by mouse all over the dialog box, but how to limit mouse drawing to some event over specific picture control?
For example: on click on picture control - draw by mouse in this control, on left click - stop drawing.
|
|
|
|
|
You must confine the cursor to the rectangle area of the picture control.
In the WM_LBUTTONDOWN message handler, get the rectangle of the picture control using GetClientRect[^] and then call ClipCursor[^] to confine the cursor to the picture control.
In the WM_LBUTTONUP message handler, Call ClipCursor again with a NULL as its parameter.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Thank you for advise. It works, however I have another problem on ClipCursor it clips not to the picture control rectangle, but to the rectangle which has size of the picture control and it begins in the top-left corner of the screen. I guess that i have move this area over my picture control, but how to find coordinates of the top-left corner of the picture control ??
|
|
|
|
|
You need to use ScreenToClient[^].
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
while working in vc++ i am getting stuck with a small thing...
in the out put screen suppose i am getting
output line 1
output line 2
output line 3
output line 4
now i just wish to output the total output lines are 4 ???
|
|
|
|
|
Can't you just count them while they are generated ? or maybe there is a counter somewhere that sets the number of lines generated that you could use ?
This signature was proudly tested on animals.
|
|
|
|
|
You could use string::getline[^] in a loop to read the file line by line till the end of the file. In this loop you can have a counter which counts the number of lines in the file.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
How to access the registry using c language?
What is the header file I needed to do this task?
WHERE THERE IS A WILL THERE IS A WAY
-MS
|
|
|
|