|
Hi, thanks i have seen those. I'm looking for something that shows the bare minimum code for a dll and application needed to record all the messages an application sends to an object.
I simply want to use this to scrape data from an application. Any ideas?
Thanks!
|
|
|
|
|
Hi,
Okay, I think I understand what you are trying to do right now. I will try and put a quick something together to make sure this works, but if you want to play around with it take a look at this link: http://www.codeproject.com/system/KeyHook.asp[^]
This project implements a keyboard hook, but I think what you want to do can be accomplished with a similar approach. Conceptually, what you have to do is install a hook with SetWindowsHookEx (I think with the first parameter as WH_GETMESSAGE), then, in your hook message handler, you need to look at each message and see which one is the message you want to get to the specific control you want to get it from. Then, once you have identified that message, all you need to do is grab the data from the LPARAM or WPARAM of the message.
As I said, I'll try and pull something together to see if this works. Let me know if you have any more questions.
Sincerely,
Alexander Wiseman
Est melior esse quam videri
It is better to be than to seem
|
|
|
|
|
WM_GETTEXT cannot work across process boundaries. Notice the 'lParam' parameter is a pointer to a buffer. This buffer will only be valid in the calling process.
What you need to do is put the WM_GETTEXT code in a DLL and have that DLL load into the target process' memory space. A common technique for doing this is using any type of hook via SetWindowsHookEx().
Bikram Singh
|
|
|
|
|
Hi
I made a sample Win32 Console program to know if the VC++ debugger will detect memory leaks in Win32 apps:
Code:
#include "stdafx.h"
int main(int argc, char* argv[])
{
printf("Hello World!\n");
char* ch=new char[100];
return 0;
} this shows a clear 100 bytes memory leak
After the program ends .. the debugger did not notify me about any memory leaks
But when making a Win32 Console program with MFC Support and try the same sample I get this :
Detected memory leaks!
Dumping objects ->
H:\Try\memLeakMFC\memLeakMFC.cpp(39) : {56} normal block at 0x002F2AA0, 100 bytes long.
Data: < > CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD
Object dump complete.
How can I make the debugger detect Win32 apps memory leaks ?
Is there any other way to do it ?
|
|
|
|
|
Check the beginning of a typical cpp-file in a MFC-project, you'll see:
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
new is replaced by DEBUG_NEW when _DEBUG is defined. You can read about DEBUG_NEW on MSDN.
One easy way to get this functionality is to develop your console application in a MFC-enabled project, and when finished and tested, create a new console application and move the code over.
The best way to avoid leaks, however, is to make sure that each new is matched to a delete while developing. Then you won't need any special tools.
|
|
|
|
|
|
Hi, I want to know how do I store all of the list box items into Access Database file?
Thanks
|
|
|
|
|
get the string and list box and save in database . Find how to save in database in the database section here at code project
Work hard and a bit of luck is the key to success.
|
|
|
|
|
Hi, has anybody downloaded YM on Win 98. I was surprised to find out that YM changes the look of the "connect dialog" of IE when it wants to connect. I think YM used XP theme. But I thought that it isn't possible in Win 98. How was this done?
|
|
|
|
|
Hi, has anybody downloaded YM on Win 98. I was surprised to find out that YM changes the look of the "connect dialog" of IE when it want's to connect. I think it used XP theme. But I thought that it isn't possible in Win 98. How was this done?
|
|
|
|
|
If I know a block of memory is just the data of an icon, how can I get the handle of this icon?
<font=sans-serif>|-|3llo Wo|2ld
|
|
|
|
|
|
Is the ICONINFO struct at the front of the memory block?
<font=sans-serif>|-|3llo Wo|2ld
|
|
|
|
|
afxloadlibrary doesn't want to compile in my program. I'm writing and MFC app, and if I compile with the line:
hLibrary = AfxLoadLibrary(pathtodll);
I get a compiler error that AfxLoadLibrary is an undeclared identifier. If I use the global namespace, like so:
hLibrary = ::AfxLoadLibrary(pathtodll);
I get the error that AfxLoadLibrary isn't a member of the global namespace. The documentation says that AfxLoadLibrary IS a member of the global namespace, and if you type ::, when VC++ generates that LONG list of functions in the global namespace, AfxLoadLibrary DOES show up on that list. What's the deal? How do I get it working?
Thanks,
augy
|
|
|
|
|
Sounds weird.
Did you try doing a "Rebuild All"? That usually fixes those kind of weird errors.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
|
Hmmm, didn't fix it. The errors were the exact same. Does anybody know what header file afxloadlibrary is declared in?
augy
|
|
|
|
|
afxdll_.h
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Well, it compiles now, but the linker tells me that afxloadlibrary is an unresolved external. Is name mangling the problem?
augy
|
|
|
|
|
You said your app was an MFC app, but it sounds to me like you have not included afx.h.
Afx.h will automatically include afxdll_.h plus link your app to all the lib files needed.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
this is just a simple c++ question. Ive already got this much of the program written. I just need seats first class seats to be full at 5 and economy at 10. I need it to prompt the user to enter y/n when one is full if the other section is ok. This is what i have so far
#include<iostream.h>
#include<stdlib.h>
int main()
{
void seatedr(int charted);
int plane[10];
int seated;
int firstclass=1;
int economy=6;
seated = 0;
for(int x=1; x<=5; x++)
{
if (plane[x] == 0)
{
plane[x] = 1;
seated = 1;
}
}
for(int i=1; i<=10; i++)
{
cout << endl;
cout << "Please type 1 for First Class" << endl;
cout << "Please Type 2 for Economy" << endl;
cin >> x;
if(x==1)
{
cout << "First Class seat : " << firstclass <
|
|
|
|
|
Your question is quite unclear - and this goes for the code as well.
Let us assume that this is not an assignment question and you are actually trying to learn C++ on your own
Have a class with the seat array as a member. Add functions to set a first- or second class seat, returning true or false depending on if it is possible or not. If the function returns false in your assigment loop, ask and try the other function.
The important thing - try to break the problem down into smaller pieces, think functions, not having one big loop doing it all, you'll never learn programming that way.
|
|
|
|
|
Hello,
As a MFC newbie I am, it is with much frustration and also humbleness that I would like to know from one of you experienced programmers what the hell is going wrong with my program.
It happens that I have several custom controls operating in different dialog boxes (one per each) and in one of these I have a 7 segment (LCD) display outputting a 5 digit (signed) number.
There is no problem whatsoever unless you hover a dialog box over the one that contains the above referred 7 segment display control -- if it is painting at that particular time, it stops with a debug assertion, as, apparently there isn't a valid DC . Just before starting any graphical output, I attach the control's own DC, by means of calling GetDC() , set the viewport up, and at the end of the output, I simply Detach it.
I really don't know what's wrong... so if you could please lend me a hand or two, that would be great. (A finger would be enough, as I would be more than happy to know the direction to take )
Thanks,
David
|
|
|
|
|
|
But Mike, can I ask you to explain me why you should use CPaintDC ? I mean, what is the difference between using CDC or using the handle hDC you get from the PAINTSTRUCT that OnPaint provides you with?
By the way, many thanks for the reply.
David
|
|
|
|