Hi,
I would like to use functions from User32.dll in my extension. How can I do this?
Thanks in advance.
Printable View
Hi,
I would like to use functions from User32.dll in my extension. How can I do this?
Thanks in advance.
Which specific functions? You just have to include the respective header file. VC++ should automatically link with User32.lib.
Thanks, Jamie -- I'll try that.
And thanks for only taking 4 minutes!
I hope this is not too much to ask for: Could you give me the code for an action of how to flash a window (takes window handle as a param, uses User32.dll FlashWindow() function). Having an example would help me add many actions to the extension.
Thanks for your help and time.
Here is the MSDN article: http://msdn.microsoft.com/en-us/library/ms679346.aspx
Hmm... isn't there already an extension that flashes the window?
Yes.
There are two reasons I am asking for an example:
1. An example would help me understand using functions from DLLs.
2. It would show me what to include.
3. It is improved on in my extension compared to others.
1) To call the DLL function, you just need to type FlashWindow(foo,bar). Nothing special about that.
2) All you need to include is windows.h, and in an extension, that is included by default
3) Not yet it isn't ;)
1. I tested this recently with the code:
Everything works, but if I enter the application's window handle and run it, the window simply does not flash. Even if I build the app.Code:ACTION(
/* ID */ 1,
/* Name */ "Flash Window %0",
/* Flags */ 0,
/* Params */ (1,PARAM_NUMBER,"Handle")
) {
FlashWindow((HWND)Param(TYPE_INT),false);
}
2. Okay.
3. Thanks for informing me. I really needed to know that.
What are you entering as a parameter? I'm pretty sure you need to use FindWindow or something similar to get the HWND.
Try to use rhPtr->rhHEditWin, it returns the handle of the runtime window.
My extension retrieves the Main Window Handle.Quote:
Originally Posted by Jamie
I'll try that.Quote:
Originally Posted by Looki
Both the Main Handle (rhPtr->rhHMainWin) and the Runtime Handle (rhPtr->rhHEditWin) do not make the window flash.
How exactly are you using them?
I don't understand what you mean. What code am I using to retrieve them, or how do I enter them? Or do you mean something else entirely?
Paste the source code of your action.
I have also tried the code I pasted on the previous page and had the same results.Code:ACTION(
/* ID */ 0,
/* Name */ "Flash Window %0 (Number of Times: %1, Flash Rate: %2)",
/* Flags */ 0,
/* Params */ (5,PARAM_NUMBER,"Handle",PARAM_NUMBER,"Number of Times to Flash",PARAM_NUMBER,"Flash Rate (In Milliseconds)(0=Cursor Blink Rate)",PARAM_NUMBER,"Flash Window Caption (0=False, 1=True)",PARAM_NUMBER,"Flash Taskbar Button (0=False, 1=True)")
) {
int hn=Param(TYPE_INT);
int fln=Param(TYPE_INT);
int flr=Param(TYPE_INT);
int ca=Param(TYPE_INT);
int tb=Param(TYPE_INT);
FLASHWINFO fl;
fl.cbSize = sizeof(fl);
fl.hwnd = (HWND)hn;
fl.uCount = fln;
fl.dwTimeout = flr;
if(ca) fl.dwFlags |= FLASHW_CAPTION;
if(tb) fl.dwFlags |= FLASHW_TRAY;
FlashWindowEx(&fl);
}
And what are you passing as the handle value? I don't see any mention of rhPtr->rhHEditWin..
My extension has two expressions. One retrieves the Main Handle using:
LPRH rhPtr = rdPtr->rHo.hoAdRunHeader;
HWND MainHwnd = rhPtr->rhHMainWin;
One retrieves the Runtime Handle (Or whatever it's called) using:
LPRH rhPtr = rdPtr->rHo.hoAdRunHeader;
HWND RunHwnd = rhPtr->rhHEditWin;