|
If you just need to display an AVI file without processing, you can use an animation control and macros such as Animate_Open and Anumate_Play . In MFC, you can use CAnimateCtrl control.
If you need to extract frames, you probably have to use AVIStreamGetFrame function.
There is an article which can guide you: http://www.codeproject.com/audio/ExtractAVIFrames.asp[^].
|
|
|
|
|
Purpose of my program is to get notification (a messagebox) whenever a new window is created on the operating system.
In my win32 dll
I put following code.
<br />
#include "stdafx.h"<br />
#include "hookdll.h"<br />
<br />
HHOOK WndHook; <br />
HINSTANCE hInst;<br />
<br />
__declspec(dllexport) bool InstallHook(void); <br />
__declspec(dllexport) bool UninstallHook(void); <br />
__declspec(dllexport) LRESULT CALLBACK WndHookProc(int, WPARAM, LPARAM); <br />
<br />
<br />
<br />
<br />
BOOL APIENTRY DllMain( HANDLE hModule, <br />
DWORD ul_reason_for_call, <br />
LPVOID lpReserved<br />
)<br />
{<br />
switch (ul_reason_for_call)<br />
{<br />
case DLL_PROCESS_ATTACH:<br />
case DLL_THREAD_ATTACH:<br />
case DLL_THREAD_DETACH:<br />
case DLL_PROCESS_DETACH:<br />
break;<br />
}<br />
<br />
hInst = (HINSTANCE)hModule; <br />
<br />
return TRUE;<br />
}<br />
<br />
<br />
HOOKDLL_API int nHookdll=0;<br />
<br />
HOOKDLL_API int fnHookdll(void)<br />
{<br />
return 42;<br />
}<br />
<br />
CHookdll::CHookdll()<br />
{ <br />
return; <br />
}<br />
<br />
<br />
__declspec(dllexport) bool InstallHook(void) <br />
{ <br />
if(WndHook == NULL) <br />
WndHook = SetWindowsHookEx(WH_SHELL, (HOOKPROC)WndHookProc, <br />
hInst, 0); <br />
<br />
return (WndHook != NULL); <br />
} <br />
<br />
__declspec(dllexport) bool UninstallHook(void) <br />
{ <br />
if(WndHook != NULL) <br />
{ <br />
if(UnhookWindowsHookEx(WndHook)) <br />
WndHook = NULL; <br />
} <br />
return (WndHook == NULL); <br />
<br />
<br />
} <br />
<br />
<br />
__declspec(dllexport) LRESULT CALLBACK WndHookProc(int nCode, WPARAM wParam, LPARAM lParam) <br />
{ <br />
if (nCode<0) <br />
return CallNextHookEx(WndHook, nCode, wParam, lParam); <br />
<br />
<br />
::MessageBox(NULL,"Window created","here",MB_OK);<br />
<br />
return CallNextHookEx(WndHook, nCode, wParam, lParam); <br />
}
Now watch my client program.. MFC exe, dialog based. On its OkButton handler
I put following code. I am not using load library and getProce address , because I am linking the library in the project settings and copying the hookdll in the debug directory of my application .
<br />
void CHookclientDlg::OnOK() <br />
{<br />
InstallHook();<br />
}
But my client application can not call InstallHook.
Is this coding right or will it inform all the windows creation. (other applications , threads).
Please tell me
Marcoslav
|
|
|
|
|
Uninitialized WndHook value can cause problems in your InstallHook function.
You should initialize it like this:
HHOOK WndHook = NULL;
What do you mean by "my client application can not call InstallHook"?
|
|
|
|
|
HHOOK WndHook is a global variable and by default its zero.
Regards,
FarPointer
Blog:http://farpointer.blogspot.com/
|
|
|
|
|
Thanks it worked.
But it went in to infinite loop, cos it was creating messagebox to show that some window was created. so for messagebox themselves also messagebox was getting displayed.. so infinite loop.
My first virus I guess
|
|
|
|
|
In order to avoid infinite loop, I think you can first try this:
static bool isMyMessageBox = false;
if( ! isMyMessageBox)
{
isMyMessageBox = true;
::MessageBox(....);
isMyMessageBox = false;
}
If it works, you should take care it works in multi-threaded case too. (Probably TlsGetValue and TlsSetValue can help).
|
|
|
|
|
Well I guess you need to use the WH_CBT hook and check the LPARAM for the HCBT_CREATEWND.
Regards,
FarPointer
Blog:http://farpointer.blogspot.com/
|
|
|
|
|
i ahve one dialog box ont that i have a bitmap i.e world map once i point out any point in that bitmap at that point i have to open a child dialog box on that we should get the relative time.
my problem is when i point out particular area i get hte child window. but i dinot get the time because this child window is taking the points from windows so that we are unble to campare with the parent dialog window.
please tell me how we get parent points in child or else how we can send pointsd from main to child window
|
|
|
|
|
I assume the logic to determine the time is in your child dialog. If that is the case,
1) If you used GetCursorPos(...) to get your point, then you have to call ScreenToClient(...) to convert them to client coordinates.
2) Then before you display your child dialog with DoModal(), store these coordinates in your child dialog.
|
|
|
|
|
if the point in the main dialog is (428,500) by using this
ScreenToClient iget x=-5;
so please help me,
sree.
|
|
|
|
|
sree_as wrote: if the point in the main dialog is (428,500)
Post some code on how you get your point, as well as the part where u call ScreenToClient(...)
|
|
|
|
|
i used this in on timer in child window
GetCursorPos(&cp1);
ScreenToClient(&cp1);
i think screentoclient taking client as child window.
sree.
|
|
|
|
|
ScreenToClient(...) takes 2 parameters, first one is a handle to your window, the second is your point. Since you are calling this in your child window, then you have to call GetParent() to get the handle to your parent window and pass it into ScreenToClient(...). e.g.
GetCursorPos(&cp1);
HWND hParentWnd = GetParent();
ScreenToClient(hParentWnd, &cp1);
|
|
|
|
|
Weiye Chen wrote: GetCursorPos(&cp1);
HWND hParentWnd = GetParent(/* Handle to your child window */);
ScreenToClient(hParentWnd, &cp1);
I Think following change sholud be there in program.
<br />
::ScreenToClient(hParentWnd, &cp1);
Check the Scope Resolution Operator( :: ) before ScreentoClient API.
I Think this correction should be there.
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|
|
sorry to say that the properties of the second dialog is not child it is pop up .is ur code is applicable to this one also,
sree.
|
|
|
|
|
sree_as wrote: sorry to say that the properties of the second dialog is not child it is pop up .is ur code is applicable to this one also,
Yes, it is applicable as well.
|
|
|
|
|
i got an error getparent does not take one parameter
|
|
|
|
|
Try putting the scope operator asMahesh have pointed out:
GetCursorPos(&cp1);
HWND hParentWnd = ::GetParent();
::ScreenToClient(hParentWnd, &cp1);
|
|
|
|
|
i think problem with my popup handle shall u show me ow we do it.i just verify it.
thank u ,
sree
|
|
|
|
|
sree_as wrote: i think problem with my popup handle shall u show me ow we do it.i just verify it.
If your problem is solved, then good for you cos i dont quite understand what you are talking about.
|
|
|
|
|
again iam getting window coordiantes.not parent co-ordinates
please help me.
CProfileWindow myWindow;
HWND hParentWnd = ::GetParent(myWindow);
::ScreenToClient(hParentWnd, &cp1);
|
|
|
|
|
Didn't you said you are calling it from OnTimer of your child window? If that's the case, then you should get the handle of that window for GetParent(...).
Btw, are you using mfc?
|
|
|
|
|
"that window",which window should be handled,yes,iam calling from OnTimer(),can u explain in detail please,
sree.
-- modified at 7:12 Monday 19th June, 2006
|
|
|
|
|
If you are using mfc, then you can do this:
AfxGetMainWnd()->ScreenToClient(&cp1);
<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
|
|
|
|
|
thank u very much,
really u helped me a lot,
sree.
|
|
|
|