|
Hi David,
After breaking my head with this DIALOG Handle stuff, I have finally decided that this is not going to help in any ways. I guess I need to work on COM now, for automation. I am very new to COM and VC++(1 month into my VC++ stuff). So will be bugging you all untill I get the solution for this.
Please If possible suggest some good tutorials for COM , ATL . I am a biginner in this field.
Kamaal
|
|
|
|
|
Are you limited to ShellExecute() , or can you use Office Automation?
"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
|
|
|
|
|
No limitations to ShellExecute(). Can use Office automation too.. Presently trying with that...
kamaal hassan
software engg
|
|
|
|
|
skamaal wrote: I am really not sure of this Office Automation tool.. could you suggst some more details regarding this.
It's not a tool per se. See here.
skamaal wrote: Will it be possible to pass the password through createProcess /p password as suggested in the previous post by one of the forum friend.??
No, unless the application that you are starting can handle such a command-line argument. Office cannot.
"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
|
|
|
|
|
Yeah I got to know that once I started to Automate WORD. Any how the Office Automation is out of site as this is adding a lot of code to my application.
I read that some article on how to get the handle to close the window opened through SHELLEXECUTE. SO I thought I can use the same concept to solve my problem.
When I try to open password protected word file through my aplication (ShellExecute(...)), I get a dialog box that asks for the password. So if i could Some how get the Handle for this DIALOG, I could probably pass my password using that HANDLE.
I was trying with some window programming (Very new to this). still not sure how to get the HANDLE. Please could you help in this regard.
|
|
|
|
|
salimhassan wrote: Any how the Office Automation is out of site as this is adding a lot of code to my application.
Not as much as you think.
The question at this point becomes, why are you wanting to open the file?
"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
|
|
|
|
|
Its the need of the hour..
Daily I need to Open some 15 - 20 files that are password protected and need to compare them for the changes and start my work accordingly.
So I guess if I can open these files without me typing the password, I can later use some comparison in the same application that will just give a new file with only the changes found in these docs. this will save alot of time.
I can later implement this in office too. (Frankly speaking its purely for my april appraisal )
kamaal
|
|
|
|
|
salimhassan wrote: So I guess if I can open these files without me typing the password...
Which would require about 4-5 lines of code:
_Application app;
app.CreateDispatch("Word.Application");
Documents docs = app.GetDocuments();
_Document doc = docs.Open(strFile, vtOptional, vtOptional, vtOptional, strPassword,
vtOptional, vtOptional, vtOptional, vtOptional,
vtOptional, vtOptional, vtOptional);
"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
|
|
|
|
|
Hi I tried that one too...
getting error
error C2065: '_Application' : undeclared identifier
I selected classes _Application, _Document, Documents, Bookmarks, Bookmark, Range and Selection..
Project->add class->MFC Class From TypeLib->(from available type classes selected the one for the word). then selected the above mentioned classes.
Even then I am getting the same errors. Dont know how to proceed further.
I guess I need to import some files
#import "mso9.dll" rename("RGB", "MSRGB")
#import "VBE6EXT.OLB" raw_interfaces_only, rename("Reference", "MyReference"), rename("VBE", "testVBE")
#import "msword.olb" rename("ExitWindows", "MyExitWindow"), rename("VBE", "testVBE"), rename("FindText", "WFindText"), rename("NoPrompt", "WNoPrompt")
I am totally confused now... Going ahead witht he Dialog option but same result getting assertion erors at run time...
Guess I need to go on with the manual entering the password...
kamaal
|
|
|
|
|
salimhassan wrote: ...but same result getting assertion erors at run time
What line of what file is asserting?
"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
|
|
|
|
|
Sorry, mixed some other issue . Actually that was some debug assertion eror in some other application. that was due to some initialization problem.
I guess I am missing some basic concept fom COM. So going through this as I have started VC++ just a little while ago...
|
|
|
|
|
A Friend function can be avoided if get()(to read) and set()(to write) member functions(public) are provided on (private) data members of a class.
Is it True or False.
Can anyone help me clearing this doubt with an appropriate reason?
|
|
|
|
|
The friend keyword allows you to specify functions or other classes which will be able to access all member (public, protected or private) of the class in which the friend keyword is used. Thus one way to avoid using it would be to provide getters and setters. But this is not always a good approach because all your members will become 'visible' to everybody, which is not always what you want.
|
|
|
|
|
dubeypankaj wrote: A Friend function can be avoided if get()(to read) and set()(to write) member functions(public) are provided on (private) data members of a class.
Is it True or False.
Well, you can do it with a friend function. You use getters-setters to access the read/write the private members. The same can be archived through friends but that would look raw.
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
A friend function basically gives access to the internal data members of a class to an external function.
This can definitely be achieved using getters and setters.
But in reality friend functions are not used for this purpose.
For example, if you look at the CStringT class, the overloaded + operator is declared as a friend function. This is so that the + operator can be used to concatenate two string in the following 2 ways
CString cs1 = L"Hello";
CString cs2 = L"World";
CString cs3 = L"";
cs3 = cs1 + L" World";
cs3 = L"Hello " + cs2;
If the + operator was an ordinary member function of the CStringT class, then only the first call would have been possible.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Anyone know of a simple way to convert bmp to jpg without any expensive conversion library (www.catenary.com ..etc) ??
Thanks
Matt
|
|
|
|
|
See 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
|
|
|
|
|
I don't know if you're using .NET, but .NET bitmaps support both formats, so you can just write your bmp to a file with a jpg extension, and .NET will automatically do the conversion for you.
|
|
|
|
|
What are the problems associated with self assignment(object = object; )?
|
|
|
|
|
Nice subject.
BTW, Generally speaking, I don't see problems. Be aware, anyway, that = operator is called...
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]
|
|
|
|
|
|
|
well, Vunic, If you don't worry about self assignment, you'll expose yourself to some very subtle bugs that have very subtle and often disastrous symptoms.
|
|
|
|
|
dubeypankaj wrote: you'll expose yourself to some very subtle bugs that have very subtle and often disastrous symptoms
For example..
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
VuNic wrote: For example..
If you do weird things in the = operator (re-)definition, for instance, i.e. if you write it (implicitely) assuming it will be never used to do self-assignment. Have a look at the following code
(please note, it is silly, written just to spot the point; moreover no check is done on memory allocation, for brevity)
class Foo
{
static const int N = 10;
char * _buf;
public:
Foo(char c){_buf = new char [N]; memset(_buf, c, N);}
Foo & operator=(const Foo & foo)
{
if ( _buf )
{
delete _buf;
_buf = new char[N];
}
memcpy(_buf, foo._buf, N);
return *this;
}
Foo(const Foo & foo){...}
};
void main()
{
Foo f('A');
f = f;
}
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]
|
|
|
|