|
Well, the error gives you a lot of information.
I'm assuming _Application is the Excel interface. An interface is pretty much just a C++ class with all the methods abstract. So you can't create it directly.
I suggest you search for examples, and look for CoCreateInstance, or CoCreateInstanceEx.
Under Platforms, Frameworks & Libraries on CP, there is a COM category - there are several good tutorials there. They may not clue you in on excel, but they will give you the COM concepts you need.
Iain.
|
|
|
|
|
Thanks Iain,
I wonder why the heck Microsoft publish an example in their web site, when it does not applying in the real world practice.
Anyway, In my case, either the intellisense system works so, I have to find out the methods that this interface hosts, by manual.
Am I doing something wrong in my initial setup ?
I am using VS2008 pro and I want to create a skill test application for the MS Office. Is that too much complicated in MFC ?
Should I leap to Visual Basic instead?
Regards,
sdancer75
|
|
|
|
|
I like C++ for my main programming needs, but what little I know of VB, is that it eats IDispatch for breakfast, then burts delicately into a napkin. Don;t write device drivers in it, or software that talks to device drivers (liem I do), or... But for working with automation etc, it will serve you well.
This is from someone who knows a bunch about C++, and a smidgeon about VB, so take this advice with a pinch of salt.
Iain.
|
|
|
|
|
Hi all..
I've one dialog box which i'm moving up from taskbar(Just like popup or bubble dialog or notification)... This is done by getting coordinates and putting SetWindowPos in loop(Tried AnimateWindow() but it's not compatible in NT)...
Now i've some buttons on that dialog.. The problem is that while dialog moves the buttons keeps hidden and only shows when dialog stops after moving.. I want to show buttons moving along with the dialog.... Any idea??
Thanks..
|
|
|
|
|
|
Is this code in the application itself? I suspect it is, and it's in a loop like:
void HandleTheTaskMessageAskingMeToComeBackFromTheDead ()
{
for (int n = 0; n < 100; n++)
{
SetWindowPos (hMyWnd, NULL,0,0, n,n, SWP_NOMOVE | SWP_NORESIZE);
Sleep (10);
}
}
(parameters from memory)
[modded here - posted instead of previewing! ]
In which case, the SetWindowPos invalidates your window, but you don't process any messages, so your dialog never gets any WM_PAINTs until you're done with animation.
That's my guess going on the information you've given.
On another note...
Unless you have a compelling argument for it, I hate slow reveals. I've clicked and asked for your dialog, so I want it NOW DAMMIT! If I wanted it later, I'd ask later.
Iain.
|
|
|
|
|
It's something like this..
for(;thisWindowRect.top > SlideDialog.top- 164; thisWindowRect.top--)
{
SetWindowPos(hWnd, NULL,thisWindowRect.left, thisWindowRect.top, 0, 0, SWP_NOSIZE);
Sleep(20);
}
Sorry but do we have "SWP_NORESIZE" Flag in SetWindowPos???
And no i'm not handling any messages..Just need to pop up my dialog from task bar along with all the controls
|
|
|
|
|
I did tell you it was from memory. You've proven my point - you have a loop, a setwindowpos, and a sleep.
Nowhere do you handle messages in the message queue.
SetWindowPos will generate WM_SIZE, WM_MOVE, etc, which in turn invalidate your window, which ends up doing WM_PAINT. So, no painting of contents.
I AM PSYCHIC!
Try the following:
for(;thisWindowRect.top > SlideDialog.top- 164; thisWindowRect.top--)
{
SetWindowPos(hWnd, NULL,thisWindowRect.left, thisWindowRect.top, 0, 0, SWP_NOSIZE);
Sleep(20);
UpdateWindow (hWnd);
}
This should redraw the dialog window. It might not redraw any child controls, in which case you are going to have to rethink your design.
If AnimateWindow does not work under windows NT, then don't use it. Try using LoadLibrary to attempt the function. If it fails, then take that as a hint to skip the whole animation process entirely. You users of old OS's will thank you for it.
Iain.
|
|
|
|
|
Wow Iain you must have a full charged CPMRU 's battery pack!
My 5 .
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]
|
|
|
|
|
Hello everybody,
I am trying to change working directory in c++, For example: My programs is in c://work, I run the program from there, but during running this program, I have to change working directory, do something there.I tried to do it like this:
system("cd c:/work/test"); but it does not change working directory
Is there a way to change current working directory in c/c++?
Thanks in advance
It is never late to learn
|
|
|
|
|
chdir is the function you should use. as for what you tried it works in the sense that cmd.exe which is started as a child process whenever you call system() changes its working directory.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
chdir is c/c++ function? or shell function?
can i use it like
system("chdir c:/work/test");
It is never late to learn
|
|
|
|
|
Gofur Halmurat wrote: can i use it like
system("chdir c:/work/test");
Yes, with the same result you got before.
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]
|
|
|
|
|
_chdir [^].
SetCurrentDirectory [^].
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]
|
|
|
|
|
Actually, I am using GNU c compiler for UNIX, it seems chdir and SetCurrentDirectory for windows only, is there any other way for UNIX?
It is never late to learn
|
|
|
|
|
Gofur Halmurat wrote: I am using GNU c compiler for UNIX
GNU isn't for Linux (after all "G nu is N ot U nix" )?
Gofur Halmurat wrote: it seems chdir and SetCurrentDirectory for windows only, is there any other way for UNIX?
chdir should be available on any POSIX compliant system, like GNU/Linux .
Are you aware that CodeProject has a Linux forum?
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]
|
|
|
|
|
Did you use if these functions and what was result?
|
|
|
|
|
Hi,
I want to create an application that will work as a skill test for users that just started to learn the applications of the ms office like word, excel, access etc.
I saw some apps that starts automatically the application like MS Word and ask the user to do something like formatting the selected text.
Then, they capture the user response and reply if the answer was wrong or correct.
How they do that ? Is there any recommendations to start with ? I think that the examination app, for the Microsoft Office User Specialist (MOUS) works in that way.
Regards,
sdancer75
|
|
|
|
|
Hi Everyone!
I work with multithreaded server applications in C++. In our environment we use the Visual C++ and gcc compilers. I often have to write and maintain multithreaded code. I have a basic idea of how things work, from our internal documentation and looking at our code. But I find my knowledge is still not very deep. I'm looking for references on how to write multithreaded code.
The only useful and relevant links I've found online so far are these articles:
http://www.ddj.com/cpp/184403766
http://www.cs.wustl.edu/~schmidt/PDF/locking-patterns.pdf
I've found that online information on this topic is rare and hard to find. Does anyone know of any other online articles I can have a look at?
Further, a search on scholar.google.com lists the following books:
[BOOK] Win32 Multithreaded Programming
A Cohen, M Woodring - 1998 - O'Reilly
[BOOK] Multi-threaded programming in C++
M Walmsley - 2000 - Springer
[BOOK] Object-oriented multithreading using C++
C Hughes, T Hughes - Wiley
[CITATION] Object Oriented Multithreading using C++: architectures and components, volume 1
C Hughs, T Hughes - 1997 - John Wiley Sons
[BOOK] Modern Multithreading: Implementing, Testing, and Debugging Multithreaded Java and C++/Pthreads/ …
RH Carver, KC Tai - 2005 - Wiley-Interscience
Can anyone recommend any of these books? I can only afford one or two at the moment.
Any help greatly appreciated!
Thanks,
Steven
modified on Thursday, October 2, 2008 4:41 AM
|
|
|
|
|
The best resource for learning multithreading in my opinion can be found here[^].
You should also read some other essays that Newcomer wrote about how to use semaphores[^] and how to avoid pitfalls[^].
There are more essays on his site that are absolutely worth reading and re-reading until understood.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Thanks!
These articles seem to be a bit biased to Win32 - we actually write cross-platform code, and the Win32 specifics tend to be embedded deep within our libraries. However, I'm planning to do a personal project on Windows sometime soon, so these should help.
While I'm on, perhaps I should post a few more of the links I've found, although these are more introductory tutorials:
CodeProject[^]
Paul Bridger[^]
www.intelligentedu.com[^]
FlipCode[^]
HotScripts[^]
Advanced topics:
Hyper Threading[^]
Thread Pools[^]
- Steven
|
|
|
|
|
Steven Swart wrote: These articles seem to be a bit biased to Win32
Well, no surprise there.
You're posting on a forum dedicated to windows programming with C++ and the MFC framework in particular.
However, the concurrency problems addressed in the essay applies to all platforms, not only Win32.
Perhaps you should take a look at the POSIX thread library for Win32.
Writing code for multithreading with POSIX thread API makes the code more portable.
Have a look here[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Heh. I do realise this forum is biased to Win32, but I've yet to find a better one for my purposes...
A bit of background on our architecture, our apps are all server applications (services or daemons). GUI access is via a web-interface, so I don't need to know any GUI/OS specific stuff to do my job. Our codebase compiles on Windows, Solaris, Linux and FreeBSD. We do use pthreads for our unices, but our Windows build uses the native Win32 API. All of this is however nicely abstracted in our threading classes.
At some stage I would like to start developing my own applications though, and to do that I will need to know the nitty-gritty. So I'm starting to do the research now.
Thanks for all your help!
S.
|
|
|
|
|
> Heh. I do realise this forum is biased to Win32, but I've yet to find a better one for my purposes...
OK, found a discussion on Slashdot which some of you may find interesting:
Good Books On Programming With Threads? [^]
|
|
|
|
|
|