|
May be you can move your post to General Database forum[^] where it is more likely to get answered.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
I want to drop an image from Internet Explorer onto my dialog and capture the URL of the image, when I implement OnDropFiles(WPARAM wParam, LPARAM lParam) ,but only can get a local file name from DragQueryFile without url from IE or other browser.who can help me how can I do this?
I also seach one article Drop images from IE[^]on codeproject seem do this ,but I also cannot do for the arguments I do not know how to get?
Thank you for any advice.
Regards,
|
|
|
|
|
Help
|
|
|
|
|
There is an application, i sadly can't recall the name, but maybe you can google it up, that will list you what data formats are "contained in a drag-drop operation", so to say (all you have to do is grab an image in your browser and drop it onto the window of this app). You probably won't be able to gain the URL from the FILEDROP format BUT using this app (it's free btw, could be that it is even somewhere here on CodeProject) you could check what other formats the browser gives to you when you drag a picture and one of these might just be what you need. If i can remember the name of this app i will tell you...
p.s.: Are you handling WM_FILEDROP? If so, i recommend you rather use the OLE way, check this[^] article.
And hey, that article uses the proggie i mentioned before, it is called "ClipSpy". What are the odds...
[EDIT]
So i checked it myself dragging from FireFox, the drop contains the URL in many formats, seems like it has CF_TEXT and CF_UNICODETEXT or a format called UniformResourceLocator or UniformResourceLocatorW and some other formats which all contain the URL (http://www.whatever.com/pics/picturename.jpg for example).
[EDIT]
I just checked it with IE too and it seems to contain only UniformResourceLocator for the URL so that's your best bet.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
modified on Wednesday, July 29, 2009 4:13 AM
|
|
|
|
|
Code-o-mat,Thanks for your reply.I really want to gain the image URL from browser
Handing WM_FILEDDROP can only get the local file name,so I want to how can I get the URL or other informations which can help me gain URL from this Message ?
OLE seem can do this,Let's try
Thanks again for your answer.
|
|
|
|
|
I'm not sure now if you are asking how to do it or just saying that you will do it that way, but i give some pointers. If you check out that article i have given you you can learn how to make your window a drop target the OLE way. To accept the URL data all you have to do is to look for a different clipboard format than CF_HDROP. Thanks to ClipSpy we now know that what you need is the "UniformResourceLocator" format, you can use RegisterClipboardFormat[^] to gain the identifier for this format and then you should use that ID instead of CF_HDROP. Also thanks to ClipSpy we know that this format seems to be nothing else but a string containing the URL, so if you look at the article again and check out what CMyDropTarget::OnDrop does you should not have too much trouble changing it to gain the string.
Does this all help?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Yes,Code-o-mat,Thanks,I thinks those enough can help me out of trouble and I will follow this tomorrow
Thanks again and sorry for my English.
BTW:Your reply is so fast
modified on Wednesday, July 29, 2009 11:01 PM
|
|
|
|
|
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.
|
|
|
|