|
I need to be able to have one application monitor and control the behaviour of another Windows application. Sadly I don't have the source for that app. nor is the producer for the app. prepared to provide an interface for what we need to do. I thought therefore that maybe the way to get round it is to use and interface similar to what Visual Test uses. Does anyone out there have an idea where I may find sample code to do this or suggestions on the best way to tackle this. Is it possible to hook into another apps message loop and intercept and retrieve messages to acchieve this?
Thanks in advance.
Happy programming!!
|
|
|
|
|
I need to be able to have one application monitor and control the behaviour of another Windows application. Sadly I don't have the source for that app. nor is the producer for the app. prepared to provide an interface for what we need to do. I thought therefore that maybe the way to get round it is to use and interface similar to what Visual Test uses. Does anyone out there have an idea where I may find sample code to do this or suggestions on the best way to tackle this. Is it possible to hook into another apps message loop and intercept and retrieve messages to acchieve this?
Thanks in advance.
Happy programming!!
|
|
|
|
|
as title.
thank you for any respnse!!
|
|
|
|
|
Simply add your executable filepath in the following registry place:
Current_User -> Software -> Microsoft -> Windows -> CurrentVersion -> Run
|
|
|
|
|
This may be a stupid, stupid idea, but I have several VB6 ActiveX DLLs that I would *like* to be able to access from a C++ app. The reason being that I have a lot of classes that access our database in those DLLs that I need to be able to access and use in an NT service. From what I've read, there's really no good way to create a service from VB, so I plan to do it in C++. All the examples I've found make it look really easy, however when I #import the DLLs (and create the .h and *_i.c files with the MIDL compiler) there are a lot of objects that don't seem to get defined. These objects are in DLLs that I don't control (i.e. CDO.DLL, MSRDO20.dll, excel98.olb, MSVBVM60.dll) Is there a good way to import a DLL and not have to worry with the DLLs it depends on? It would seem like the DLL you are importing would have to take care of that itself?
This all may be a horrendous idea anyway, but I hate to reprogram DB routines that already work in a new language.
Any input is appreciated.
|
|
|
|
|
When running regsvr32 from Start .. Run, the application starts up correctly. However, if I build an ATL object, the registration fails stating it doesn't recognise the batch file. Any ideas ?
Thankyou
|
|
|
|
|
I have an ATL COM object that implements two custom interfaces and IDispatch. I can simply CoCreate the object from a C++ console app but when I try to expand the object within the debugger (to see whether IDispatch and IUnknown are inherited correctly), the development environment crashes and Spins up another instance of MSDEV with assembly in it.
Has anyone seen these symptoms before ? Any ideas ?
Thanks
|
|
|
|
|
I want to concatenate two files like Dos prompt.
Example :
COPY File1.txt+File2.txt File3.txt
Thanks in advance
|
|
|
|
|
here it is in plain old C.
FILE *f1 = fopen(file1, "r");
FILE *f2 = fopen(file2, "r");
FILE *f3 = fopen(file3, "w");
unsigned char buf[4096];
int read=0;
read = fread(buf, 1, 4096, f1);
while (read!=0)
{
fwrite(buf, 1, read, f3);
read = fread(buf, 1, 4096, f1);
}
fclose(f1);
read = fread(buf, 1, 4096, f2);
while (read!=0)
{
fwrite(buf, 1, read, f3);
read = fread(buf, 1, 4096, f2);
}
fclose(f2);
fclose(f3);
|
|
|
|
|
Hi
I have problem capturing desktop screen and saving it into a bitmap using DirectDraw. Please help if you've done this before.
Thank you very much for your time.
JD
|
|
|
|
|
We often can see that some function will return a pointer to a structure or a buffer, it must be aollocated by function itself. The question is how the memory is freed? and when it is freed? Can I aollocate some memory in a function and hope the caller will clean up the mass?
I am using C, so the C++ destruction function is not what I want. Thanks
|
|
|
|
|
As long as you tell the programmer calling your function that he/she has to free memory that you are allocating, there's nothing wrong with what you describe.
Also, you should tell the caller which function to use when freeing the memory (free, delete, delete [] , GlobalFree, etc.).
I do it all the time...
-c
|
|
|
|
|
You often see this? You shouldn't. That's very poor programming style.
There are a few cases in the C Runtime library where you see this, but what happens here is that the C runtime library allocates the memory and cleans it up when the program exits.
Generally, memory should be copied, or passed to a function through a pointer or reference, and that memory should be used by the function.
Additionally, COM utilizes a mechanism where the Caller has to clean up memory when using SysAllocString and IMalloc. These rules are clearly documented though. you can't just assume people will clean up your allocations.
|
|
|
|
|
First, I would like to thank both of you for your help.
I am programming a set of netbios support function, one of which need return a structure pointer. and I need call it several times, yesterday i find a way to do this, that is use the 'static' modifier. then there will be only one copy of the structure and it will initialize when the program start and clean up when the program exit. although it will keep it's content through function calls, but that is not a matter.
It's the solution that the C library used?
by the way, I am sorry about my poor english, I am still a student.
mask
|
|
|
|
|
Hi, I can't figure out the cause of the following:
I've derived a general dialog class (say CMyDialogBase) from CDialog and in that class I've put OnOK() with ClassWizard. Then I've derived another dialog classes (say CMyDialogFinal from CMyDialogBase and put in OnOK() as well. Now when I call OnOK() from within CMyDialogFinal::OnOK() I expect CMyDialogBase::OnOK() to be called, but instead CDialog:OnOK() is called, even when I write the call like this CMyDialogBase::OnOK().
With OnCancel I don't get this problem - skipping the base class.
Can anyone tell me what is going on here?
Thx, Joep
|
|
|
|
|
You have inherit two classes from CDialog:
CDialog virtual OnOK()
|
v
CMyDialogBase virtual OnOK()
|
v
CMyDialogFinal virtual OnOK()
and implemented in all classes OnOK().
If you will call always CMyDialogBase::OnOK from class
MyDialogFinal, then delete function MyDialogFinal::OnOK().
The system will always find the virtual-function in
CMyDialogbase and execute this function.
If you use virtual-function, the system checks all class
(start at class from where you call the function) until it finds the function in this class or a higher-class.
I hope that help's.
|
|
|
|
|
Are you certain that you have capitalized OnOK the same in all classes? The fact that CDialog::OnOK is being called when you call CMyDialogBase::OnOK would seem to be a direct indicator that CMyDialogBase::OnOK doesn't exist (or may be spelled or capitalized differently).
|
|
|
|
|
I'm learning about COM in C++.
I want to create a com dll which will have 2 interfaces. 1 public method in each.
I then want to create a client to call a method on interface1, then use QueryInterface to return an interface pointer to interface2, so I can call the method on the second interface.
Both interfaces will have the same method name & parameters.
Where can I get sample code or tutorial to do this?
Cheers.
|
|
|
|
|
Create a new ATL project. Insert an ATL Simple Object from the ATL Wizard and define interface 1. Interface 2 can be implemented through a relatively simple cut and paste operation (although there are a couple of gotchas) - If you have MSDN - this is a good source of explanation. Otherise Inside COM by Microsoft Press, Beginning ATL by Wrox Press
p.s. You can't have the same method name for both interfaces, if you're planning on implementing this within the same C++ class.
|
|
|
|
|
I would like to know if there are any methods to intercept WIN32 API functions? For example, I want to get the string that would be displayed on the screen before it is actually displayed. Any code examples?
Thanks very much and I am looking for examples eagerly.
|
|
|
|
|
Hello eveybody
I didn't understand the values of lpdwFlags in the fonction InternetGetConnectedState
If we know that the possible values are:
#define INTERNET_CONNECTION_MODEM 1
#define INTERNET_CONNECTION_LAN 2
#define INTERNET_CONNECTION_PROXY 4
#define INTERNET_CONNECTION_MODEM_BUSY 8
why I had different results like these:
2: When i use only a LAN
18: When I use a modem (not connected)
81: When I use a modem (connected)
86: When I use LAN and PROXY
What is these values means?
Please I need your help
Thanks for all
Sylvain Demers
demerssy@ift.ulaval.ca
|
|
|
|
|
Hi,
I'm trying to set an enviroment variable from my program, but it vanishes after I make
the call, but it works (at least for the return code)
Is there any trick to make it work ? Or is there another function I need to use ?
Thanks,
Dennis
|
|
|
|
|
I have a dialogue based GUI aaplication,which i need to make a service.How can I do that ? I do not have any main function wherein I can take any commandline arguments.
Xzyeena.
|
|
|
|
|
There should be some helpful information in P.J. Naughter's article here on the site:
http://www.codeproject.com/system/cntservice.asp
|
|
|
|
|
check this:
CCommandLineInfo cmdInfo;
AfxGetApp()->ParseCommandLine(cmdInfo);
if (AfxGetApp()->m_lpCmdLine[0] != '\0')
{
char tmp[1000];
sprintf(tmp,"%s",AfxGetApp()->m_lpCmdLine),
AfxMessageBox(tmp);
}
else;
In CDialog-GUI you need the CWinApp-pointer (AfxGetApp()).
|
|
|
|