|
Hi All
How can i get url monitor?If url open in Internet explorer or mozilla etc i want to make log file of open url.
|
|
|
|
|
Don't you like the browser's history feature?
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]
|
|
|
|
|
yes i think it's solve my problem.how can i get browser's history?
|
|
|
|
|
It is browser-dependent. A quick search gave me the follow pages for Firefox and Internet Explorer [^], [^]. There's also the CodeProject's article: "Access Internet Explorer's History in MFC".
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]
|
|
|
|
|
How to get hard disk size, partition size and partition start position in
disk through windows API or using win ioctl code
I tried to use SetFilePointerEx on winxp but got compile error(unrecognized function)
|
|
|
|
|
|
As suggested above DeviceIOControl is needed.
In addition to that if you want to get the partition size and partition start position
you have to call IOCTL_DISK_GET_DRIVE_LAYOUT_EX([^]) as device control code then you will get the partition data.
It has structure DRIVE_LAYOUT_INFORMATION_EX([^]), which will give the required data.
Величие не Бога может быть недооценена.
modified on Thursday, February 4, 2010 1:33 AM
|
|
|
|
|
Thanks
IOCTL_DISK_GET_DRIVE_LAYOUT gives geometry of partition (size, starting offset in disk, type etc).
How to get disk(PHYSICALDRIVE0,1..) size.
|
|
|
|
|
MKC002 wrote: How to get disk(PHYSICALDRIVE0,1..) size.
Follow the link I provided and check out some of the other commands.
MVP 2010 - are they mad?
|
|
|
|
|
|
Thanks
GetDiskFreeSpace gives geometry of partition (total cluster,sector per cluster, sector size and free cluster).
How to get disk(PHYSICALDRIVE0,1..) size. I think GetDiskFreeSpace will not work for it
|
|
|
|
|
Writing Object Succeeds with the following code
#include <iostream>
#include <fstream>
using namespace std;
class Data
{
public:
string name;
int id;
public:
Data(){}
Data(string n,int id){name=n;this->id=id;}
};
int main() {
Data objdata("sujan dhakal",1);
fstream file("c:\\test.txt",ios::out | ios::binary);
if(file.is_open())
{
file.write((char*)&objdata,sizeof(Data));
cout<<"Success";
file.close();
}
else
{
cout<<"Error";
}
return 0;
}
but why reading not working
#include <iostream>
#include <fstream>
using namespace std;
class Data
{
public:
string name;
int id;
public:
Data(){}
Data(string n,int id){name=n;this->id=id;}
};
int main() {
Data objdata;
fstream file("c:\\test.txt",ios::in | ios::binary);
if(file.is_open())
{
file.read((char*)&objdata,sizeof(Data));
cout<<objdata.name<<objdata.id<<endl;
cout<<"Success";
file.close();
}
else
{
cout<<"Error";
}
return 0;
}
help me
|
|
|
|
|
I suggest you read this series of articles[^]. They are about serrialization, this is what you need to do in order to save/load objects.
|
|
|
|
|
i'm writing a simple program using Ansi C++. I'm not using Microsoft C++. that doesnot applies to me. what's your suggestion?
|
|
|
|
|
You cannot do that.
You're trying to serialize an object (see "Serialization" topic at Wikipedia [^]) in a wrong way.
Since std::string is not a scalar type, the object instance (objdata ) holds just a reference to it (and you're saving just such a reference, i.e. storing an address to disk, clearly it makes no sense).
So you cannot save the class as a whole using
file.write((char*)&objdata,sizeof(Data));
instead you have to store each of its members in order to restore appropriately them, for instance:
file.write((char*)&(objdata.id),sizeof(objdata.id));
string::size_type len = objdata.name.length();
file.write((char*) &len, sizeof(len));
file.write((char*)(objdata.name.c_str(), len);
Can you spot the code for reading back the class?
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]
|
|
|
|
|
so it was only the issue of std::string class, thanks i succeed with the following code.
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
class Data
{
public:
char name[20];
int id;
public:
Data(){}
Data(char *n,int id){strcpy(name,n);this->id=id;}
};
int main() {
Data objdata;
fstream file("c:\\test.txt",ios::in | ios::binary);
if(file.is_open())
{
file.read((char*)&objdata,sizeof(Data));
cout<<objdata.name<<objdata.id;
cout<<"Success";
file.close();
}
else
{
cout<<"Error";
}
return 0;
}
|
|
|
|
|
Hi All,
I need to pass data from my program to an active notepad window. I got the handle to notepad and copied the data to clipboard but nothing is getting pasted in notepad window after sending WM_PASTE message to notepad window. Here is the code
if(!OpenClipboard(hWnd))
errorExit();
HGLOBAL clipbuffer;
char * buffer;
EmptyClipboard();
clipbuffer = GlobalAlloc(GMEM_DDESHARE, extractedTime.GetLength()+1);
buffer = (char*)GlobalLock(clipbuffer);
strcpy(buffer, LPCSTR(extractedTime));
GlobalUnlock(clipbuffer);
SetClipboardData(CF_TEXT,clipbuffer);
if(notepadWnd != NULL)
{
SendMessage(notepadWnd, WM_PASTE, 0, 0);
}
CloseClipboard();
I used this article as reference. Any pointers what am I doing wrong?
Thanks
|
|
|
|
|
I don't know the answer to your question, but I can break it into two parts:
1/ Am I putting my text successfully on the clipboard...
2/ Is notepad getting my WM_PASTE message?
You can check (1) yourself... Just run notepad, and use the Edit | Paste menu. If that doesn't work, then your clipboard code is wrong.
If you can manually paste into notepad, then maybe notepad does not respond to WM_PASTE, or maybe you are sending the message to the wrong window.
Using Spy++, I get three windows making up notepad - the app window, a child Edit window, and a child status bar.
Maybe you are sending WM_PASTE to the app window, not the child edit one?
Another thing to consider... Notepad could be different on different OS's...
Good luck,
Iain.
I have now moved to Sweden for love (awwww).
|
|
|
|
|
lazy_panther wrote: Any pointers what am I doing wrong?
Sure; you're assuming way too much. For instance, what makes you think that NotePad's mainframe is going to respond to a WM_PASTE message in just the way you want?
Why do you need to paste text to an open NotePad window, anyway? If you need to gather textual input, show a dialog with a text window and collect it that way.
And don't use the clipboard to pass data internally in your program. It's very bad style; suppose, for instance, the user had text already on the clipboard that he'd copied from a browser window with the intention of pasting it later into a Word document. Don't you think that user is going to be a little irritated to find the text he'd placed there is overwritten with something your program did internally, without user consent?
L u n a t i c F r i n g e
|
|
|
|
|
And don't use the clipboard to pass data internally in your program. It's very bad style; suppose, for instance, the user had text already on the clipboard that he'd copied from a browser window with the intention of pasting it later into a Word document. Don't you think that user is going to be a little irritated to find the text he'd placed there is overwritten with something your program did internally, without user consent?
In my application, we can assume that user won't be doing Copy-Paste.
Let me briefly describe my applcation
My program will be running in background with a icon residing in notification area. Based on user signal, I need to process some information without prompting user for it and paste it in word document. The information required has already been pre-processed. User should press a short cut key and pre-processed information should get pasted at the current cursor position of MS word.
I tried sending WM_PASTE to notepad first because it seemed much simpler than operating with MS word.
Can you please suggest some alternate routes for pasting information to word document from win32 program?
Really appreciate your help.
|
|
|
|
|
Word can be automated; that is, it can be programatically started, it's document contents manipulated, etc. Data could be inserted without resorting to clipboard functions.
I've done this sort of thing from C# before, but not C++. That being said, if you really want to do it from C++, it should be possible. You can either use managed C++ and .NET classes to interact with Word, or I think it can also be done from native C++ via COM. (You'll have to check on that.) The COM thing is probably moot anyway; managed C++ would be a lot easier, although it would involve .NET dependencies...
Not a very definitive answer - hopefully someone else can give more direction.
L u n a t i c F r i n g e
|
|
|
|
|
|
That sounds like just what you're looking for.
L u n a t i c F r i n g e
|
|
|
|
|
#include <iostream><br />
#include <fstream><br />
using namespace std;<br />
<br />
int main() {<br />
<br />
char data[5];
fstream file("c:\\test.txt",ios::in | ios::binary);<br />
if(file.is_open())<br />
{<br />
while(!file.eof())<br />
{<br />
file.read(data,sizeof(data));<br />
cout<<data;<br />
}<br />
file.close();<br />
}<br />
else<br />
{<br />
cout<<"Error";<br />
}<br />
<br />
return 0;<br />
}
I've written "abcf" to text.txt file in binary mode. i'm reading back the data into the variable "data". why the heck the output is "abcfabcf". I should be "abcf" but what happened to this one. and another question do anybody knows how to write and read string data-type in binary mode. please help.
|
|
|
|
|
This works for me (error handling left to the reader)
#include <iostream>
#include <fstream>
using namespace std;
int main() {
fstream file("C:\\test.txt", ios::out | ios::binary);
char out[]="hello";
file.write(out, sizeof(out));
file.close();
file.open("C:\\test.txt", ios::in | ios::binary);
char in[sizeof(out)];
file.read(in, sizeof(in));
cout << out << ", " << in << endl;
file.close();
return 0;
}
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]
|
|
|
|