|
Joined: Feb 2004
Posts: 119
Vogon poet
|
OP
Vogon poet
Joined: Feb 2004
Posts: 119 |
i did not get far with this DLL... was wondering if anyone could help me, with maybe 1 of the functions and i'll try and figure the rest out.. was looking at this page... but don't get how to use it.. http://msdn.microsoft.com/library/defaul...sktopwindow.asp
;
;Start's here...
;
#pragma check_stack(off)
#pragma comment(linker,"/OPT:NOWIN98")
#include <windows.h>
// general constants
#define mFunc(x) int __stdcall x(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause)
// Structures
typedef struct {
DWORD mVersion;
HWND mHwnd;
BOOL mKeep;
} LOADINFO;
HWND mHWnd;
mFunc(Desktop)
{
//Sticks any window onto the desktop
}
mFunc(UnDesktop)
{
//Put's desktop window back into mIRC
}
mFunc(IsDesktop)
{
//Checks to see if a window is on the desktop
}
|
|
|
|
Joined: Jun 2003
Posts: 195
Vogon poet
|
Vogon poet
Joined: Jun 2003
Posts: 195 |
really theres no need for mfc in this case. the functions your looking for a re SetParent and GetParent. To make a window a desktop window you have to do 2 things. first use SetParent using GetDesktopWindow() as the hParent and second use SetWindowLong to remove the WS_CHILD style bit. this is not done for you. something like this would work SetParent(hWnd,GetDesktopWindow()); SetWindowLong(hWnd,GWL_STYLE,GetWindowLong(hWnd,GWL_STYLE) &~WS_CHILD); to reverse that simply re add the WS_CHILD and set the parent back to hte previous value. You can use if (GetParent(hWnd) == GetDesktopWindow()) to tell if its on the desktop Have Fun
Have Fun
|
|
|
|
Joined: Feb 2004
Posts: 119
Vogon poet
|
OP
Vogon poet
Joined: Feb 2004
Posts: 119 |
[code] mFunc(Desktop) { //get the hwnd from mirc with something like // $dll(my.dll,Desktop,$window($active).hwnd) HWND mircwindow = (HWND)atoi(data); //get the desktop hwnd HWND dpt = GetDesktopWindow(); SetParent(mircwindow,dpt); lstrcpy(data,"yay"); return 3; } [code]
and this would work for //dll bla.dll Desktop $window(#scripting).hwnd
is this right?
|
|
|
|
Joined: Jun 2003
Posts: 195
Vogon poet
|
Vogon poet
Joined: Jun 2003
Posts: 195 |
dont forget to remove the WS_CHILD style bit.
Have Fun
|
|
|
|
Joined: Feb 2004
Posts: 119
Vogon poet
|
OP
Vogon poet
Joined: Feb 2004
Posts: 119 |
"dont forget to remove the WS_CHILD style bit. " << i don't get you.. what do i change in the code bellow?
mFunc(Desktop)
{
//get the hwnd from mirc with something like
// $dll(my.dll,Desktop,$window($active).hwnd)
HWND mircwindow = (HWND)atoi(data);
//get the desktop hwnd
HWND dpt = GetDesktopWindow();
SetParent(mircwindow,dpt);
lstrcpy(data,"yay");
return 3;
}
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
Well Naru gave you two lines of example code: SetParent(hWnd,GetDesktopWindow()); SetWindowLong(hWnd,GWL_STYLE,GetWindowLong(hWnd,GWL_STYLE) &~WS_CHILD);
And you're currently using one of them here: SetParent(mircwindow,dpt);
So I don't think it takes too much imagination to guess that the other line is what you need: SetWindowLong(mircwindow,GWL_STYLE,GetWindowLong(mircwindow,GWL_STYLE) &~WS_CHILD);
Then when you're setting the window as a child of mIRC again that line would (presumably) be: SetWindowLong(mircwindow,GWL_STYLE,GetWindowLong(mircwindow,GWL_STYLE) &WS_CHILD); Notice the missing bitwise NOT operator (~).
Spelling mistakes, grammatical errors, and stupid comments are intentional.
|
|
|
|
Joined: Jun 2003
Posts: 195
Vogon poet
|
Vogon poet
Joined: Jun 2003
Posts: 195 |
close you would use | WS_CHILD to readd it.
Have Fun
|
|
|
|
Joined: Feb 2004
Posts: 119
Vogon poet
|
OP
Vogon poet
Joined: Feb 2004
Posts: 119 |
OK this is what i vae now... the desktop works fine.. but can't test the undesktop and isdesktop for some reason.. When it adds the window to the desktop..ican't type anything on it. i can right click and move it around.. but can't type anyidea's why?
#pragma check_stack(off)
#pragma comment(linker,"/OPT:NOWIN98")
#include <windows.h>
// general constants
#define mFunc(x) int __stdcall x(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause)
mFunc(Desktop)
{
//get the hwnd from mirc with something like
//echo -s $dll(hdll.dll,Desktop,$window($active).hwnd)
HWND mircwindow = (HWND)atoi(data);
//get the desktop hwnd
HWND dpt = GetDesktopWindow();
SetParent(mircwindow,dpt);
lstrcpy(data,"S_OK");
return 3;
}
mFunc(UnDesktop)
{
//echo -s $dll(hdll.dll,UnDesktop,$window($active).hwnd)
HWND mircwindow = (HWND)atoi(data);
HWND dpt = GetDesktopWindow();
SetWindowLong(mircwindow,GWL_STYLE,GetWindowLong(mircwindow,GWL_STYLE) |WS_CHILD);
lstrcpy(data,"S_OK");
return 3;
}
mFunc(IsDesktop)
{
// $dll(hdll.dll,IsDesktop,$window($active).hwnd)
HWND mircwindow = (HWND)atoi(data);
HWND dpt = GetDesktopWindow();
if (GetParent(mircwindow) == dpt)
lstrcpy(data,"S_OK");
return 3;
}
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
Oh yeah, that would make more sense wouldn't it.
Spelling mistakes, grammatical errors, and stupid comments are intentional.
|
|
|
|
Joined: Feb 2004
Posts: 119
Vogon poet
|
OP
Vogon poet
Joined: Feb 2004
Posts: 119 |
"Oh yeah, that would make more sense wouldn't it. " <<< huh? If it help's i'm using mirc 6.12 and windows XP...
|
|
|
|
Joined: Feb 2004
Posts: 119
Vogon poet
|
OP
Vogon poet
Joined: Feb 2004
Posts: 119 |
can anyone help me please?
|
|
|
|
Joined: Jun 2003
Posts: 195
Vogon poet
|
Vogon poet
Joined: Jun 2003
Posts: 195 |
your Undesktop fn does not set the parent back to the original parent window.
as for the Isdesktop it probably would be better to test to see if the WS_CHILD style bit is currently set.
UINT style = (UINT)GetWindowLong(hwnd,GWL_STYLE); if ((style & WS_CHILD) == WS_CHILD) //it is not a desktop window else //it is
Have Fun
|
|
|
|
Joined: Jun 2003
Posts: 195
Vogon poet
|
Vogon poet
Joined: Jun 2003
Posts: 195 |
also in your isdektop you fill data only when it is a desktop window but do nothing if it isnt. the best thing to do would be fill it with $true and $false. this way scripters can use it in direct comparisons for example
if ($dll(blah blah)) //its a desktop window
or
if (!$dll(blah blah)) //its not a desktop window
of course the convention you use is up to you. your current setup however will always return a true value. if its not a desktop window it will return whatever data was (i.e the window handle) so they cant use the ! negate operator. again its up to you it just seems to make more sense and fits easier with mIRC script.
oops meant to edit the previous post sorry
Have Fun
|
|
|
|
|