|
I am trying to capture events from a running instance of Microsoft Word. If I could do this using MFC libraries, this would be a walk in the park. However, I HAVE to do this using straight C++ without the help of MFC libraries what-so-ever.
I have done a lot of reading (especially on this site) on this topic and have tried to implement this event handling in a VC++ console application. I understand that you need to have event sinks to handle these events and that the COM object has to support the interface that the client application is exposing. The problem I have, is that in all the examples I have found on the web, the developers have created their own COM object and have a client that talks to that. What I haven't been able to find, is a straight forward example of how to make a connection to any of the Microsoft Office applications using the Adise method. Every time I try it, it fails.
Could anyone help me? I just need a basic explanation of how to set up this connection, or better yet, some very basic source on how to do this.
Any help would be massively appreciated!
|
|
|
|
|
I need to know if someone can tell me how i can make an struct array what uses an LPSTR or anything similar identifiyng method instead of the normal int method , i need it for a project in that i am.
Thank you for your help
Example:
MyArrayStruct("identifier").Anything=0xFF;
|
|
|
|
|
you need a map. try a CMap or a std::map
CMap< CString, LPCSTR, CPerson, CPerson& > myMap2;
CPerson person;
LPCSTR lpstrName = "Jones";
myMap2->SetAt( lpstrName, person );
or
typedef map< CString , CPerson> clrMap;
theMap clrMap;
...
clrMap::const_iterator it;
it = theMap.find(name);
if (it!=theMap.end())
{
return (*it).second;
}
Software | Cleek
|
|
|
|
|
Thank you Chris Losinger , I only make you one question, the first mode uses MFC if i`m not wrong, but the second don't uses it, right?
PD: I don't use that in my project, i need do it withuot the MFC classes, only with C++...
|
|
|
|
|
correct. if you don't use MFC, std::map will still work for you.
i would recommend std::map over CMap in any case.
-c
Software | Cleek
|
|
|
|
|
another question how i implement this function??
do you can explain me???
please...
Thank you
|
|
|
|
|
|
Pre-compiled a C library using msvc 6, blah.lib
In a new C++ project, include header and library location in Tools->Options->Directories, included header in the C++ file and include library in the Settings->Link tab
I get a linker error stating:
main.obj : error LNK2001: unresolved external symbol "int __cdecl hInitialise(int,struct HWND__ *,struct HDC__ *,unsigned int)" (?hInitialise@@YAHHPAUHWND__@@PAUHDC__@@I@Z)
I was not able to recompile the library into C++, cause of header problems....
|
|
|
|
|
This smells like a name mangling issue. Try to wrap the header file that contains your function declarations with
extern "C"
{
...
... all of your functions
...
} and then rebuild your library and then rebuild your app.
Chris Meech
I am Canadian. [heard in a local bar]
Gently arching his fishing rod back he moves the tip forward in a gentle arch releasing the line.... kersplunk [Doug Goulden]
Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]
|
|
|
|
|
Thanks for the suggestion Chris, it didn't work.
The cpp files generated a host of other errors.
I googled extern "C" to see how else I could use it.
I tried putting the function declaration at the top of my file and used:
extern "C" int hInitialise(int count,
HWND window,
HDC screen,
unsigned int flags);
Got a compile error:
main.cpp(13) : error C2732: linkage specification contradicts earlier specification for 'hInitialise'
But I copied it straight from the header....
|
|
|
|
|
|
Hello,
I have got a handle to a window:
HWND hWndAddEditWindow = NULL;
hWndAddEditWindow = FindWindow(NULL,_T("New/Edit"));
I then open the window using the handle but I then need to populate the text boxes on the window who's names and ID's change each time.
I have been told that there is a way to get a handle to the first textbox, followed by the second textbox and so on, but I have not been able to work out how.
Please could someone help me out by telling me how I can get a handle to the first two textboxes in the window and send some text to them.
Many thanks
Willertron
www.willertron.com
|
|
|
|
|
The EnumChildWindows function enumerates the child windows that belong to the specified parent window by passing the handle to each child window, in turn, to an application-defined callback function. EnumChildWindows continues until the last child window is enumerated or the callback function returns FALSE.
You then could use the GetClassName function retrieves the name of the class to which the specified window belongs on each hWnd to make sure it is a text box.
|
|
|
|
|
after you get the handle to that window, use FindWindowEx() to go through the children. If you're using MFC, use mfc's CWnd version of FindWindowEx(). that way you can get a CWnd*, cast it to CEdit* and do whatever you want with it.
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
I start a new W32 console VC++ project from VC++ .net and
add a class (one .cpp and one .h files) to this project.
It gives an error when compiling:
fatal error C1010: unexpected end of file while looking for precompiled header directive
It doesn't happen in VC++ 6.0.
Could anybody pls help me on this?
|
|
|
|
|
try adding ...
#include "stdafx.h"
.. to the top of your .cpp
Software | Cleek
|
|
|
|
|
|
Hi im searching an alternative Function for ReadProcessMemory. Someone got an idea ?
|
|
|
|
|
Start by telling us why ReadProcessMemory isn't any good for you.
|
|
|
|
|
Im trying to Read the memory from a Game that blocks the ReadProcessMemory function so I ne an Alternative.
|
|
|
|
|
I have placed an WM_ONCHAR message in my view class handled by OnChar().
I would like to be able to call the OnChar() from my main class.
I have tried the "Access View Class from Anywhere" artical, but could not even get the example code to work.
Perhaps I could do as the thread below suggests, "Accessing property pages" (but I don't know what a property page), where data is placed in another class, where the view class could call and obtain it?
What I want to do is to send a character from the serial port (from my main class) to the OnChar() in the view class.
Thanks
John
|
|
|
|
|
Cant you try a PostMessage to the View Object
ViewObject->PostMessage(WM_ONCHAR , ....)
|
|
|
|
|
Thank you for that. That should work, I just don't know how to obtain the ViewObject part.
|
|
|
|
|
CMainFrame* pMainFrmWnd = (CMainFrame*)AfxGetMainWnd();<br />
ASSERT(pMainFrmWnd != NULL);<br />
CYourViewClass* pYourView = NULL;<br />
CWnd* pchildWnd = pMainFrmWnd->GetWindow(GW_CHILD);<br />
ASSERT(pchildWnd->GetSafeHwnd() != NULL);<br />
while(childWnd->GetSafeHwnd() != NULL)<br />
{<br />
ASSERT(childWnd->GetSafeHwnd() != NULL);<br />
if(childWnd->GetRuntimeClass()->m_lpszClassName == "CYourViewClass")<br />
{<br />
pYourView = (CYourViewClass*)childWnd;<br />
break;<br />
}<br />
childWnd = childWnd->GetWindow(GW_HWNDNEXT);<br />
}<br />
ASSERT(pYourView != NULL);
Rahim Rattani
Software Engineer,
Matrix Systems (Pvt) Ltd.,
Karachi - Pakistan
|
|
|
|
|
Hi
I need some help for fuzzy logic and how
i can implement the fuzzy set in c++ code
.
Any help can help me
Thanx for u.
On Earth nothing impossible,
while your mind running.
Faroqtam
|
|
|
|