Пример #1
0
BOOL CALLBACK EnableProc (HWND hWnd, LPARAM lParam)
{

	// do nothing if its the one we ignore
	if (hWnd == (HWND) LOWORD (lParam))
		return (TRUE);

	// in the property we keep the enabled/disabled state in the low
	//   byte and our recursion in the high byte
	if (HIWORD (lParam) == FALSE)
	  {
		WORD iCount = (WORD) GetProp (hWnd, sEnableProp);
		if (iCount == 0)
			iCount = IsWindowEnabled (hWnd) & 0xFF;
		ASSERT (HIBYTE (iCount) < 255);
		iCount += 0x100;												// inc HIBYTE
		SetProp (hWnd, sEnableProp, (HANDLE) iCount);
		EnableWindow (hWnd, FALSE);
	  }
	else
	  {
		WORD iCount = (WORD) GetProp (hWnd, sEnableProp);
		// will return 0 if this window was created after we disabled all
		if (iCount == 0)
			return (TRUE);
		ASSERT (HIBYTE (iCount) != 0);
		if (HIBYTE (iCount) != 0)
			iCount -= 0x100;
		if (HIBYTE (iCount) != 0)
			SetProp (hWnd, sEnableProp, (HANDLE) iCount);
		else
		  {
		  EnableWindow (hWnd, LOBYTE (iCount));
			RemoveProp (hWnd, sEnableProp);
		  }
	  }

	return (TRUE);
}
VOID SetTabletInputServiceProperties()
{
    DWORD_PTR dwHwndTabletProperty = 
    TABLET_DISABLE_PRESSANDHOLD | // disables press and hold (right-click) gesture
    TABLET_DISABLE_PENTAPFEEDBACK | // disables UI feedback on pen up (waves)
    TABLET_DISABLE_PENBARRELFEEDBACK | // disables UI feedback on pen button down (circle)
    TABLET_DISABLE_FLICKS; // disables pen flicks (back, forward, drag down, drag up)
    
    ATOM atom = ::GlobalAddAtom(MICROSOFT_TABLETPENSERVICE_PROPERTY);  
    SetProp(g_hWnd, MICROSOFT_TABLETPENSERVICE_PROPERTY, reinterpret_cast<HANDLE>(dwHwndTabletProperty));
    GlobalDeleteAtom(atom);

}
Пример #3
0
int CALLBACK TokenDialogProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
    sDIALOG_token * tk;
    switch (message) {
    case WM_INITDIALOG: {
        sIMessage_2params * msg = (sIMessage_2params *)lParam;
        tk = (sDIALOG_token *) msg->p1;
        SetProp(hwnd , "sDIALOG_token*" , (HANDLE)tk);
        SetDlgItemText(hwnd , IDC_INFO , tk->info);
        SetDlgItemText(hwnd , IDC_EDIT1 , tk->token);
        SetWindowText(hwnd , tk->title);
        int imageType;
        HANDLE bmp = cUIIcons::getImageFromURL(tk->imageURL , imageType , (HINSTANCE)ICMessage(IMC_PLUGID_HANDLE , msg->sender));
        IMDEBUG(DBG_DUMP , "getImageFromURL(%s) = %x" , tk->imageURL , bmp);
        if (bmp) {
            SendDlgItemMessage(hwnd , IDC_TOKEN , STM_SETIMAGE , imageType , (LPARAM)bmp);
            RECT rc;
            BITMAP bi;
            GetObject(bmp , sizeof(BITMAP),&bi);
            GetWindowRect(hwnd , &rc);
            IMDEBUG(DBG_DUMP , "Token size - w=%d h=%d" , bi.bmWidth , bi.bmHeight);
            SetWindowPos(hwnd , 0 , 0 , 0 , rc.right - rc.left , rc.bottom - rc.top + bi.bmHeight , SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER);
            SetWindowPos(GetDlgItem(hwnd , IDC_TOKEN) , 0 , 0 , 0 , rc.right - rc.left - 28 , bi.bmHeight , SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER);
        }
        SetFocus(GetDlgItem(hwnd , IDC_EDIT1));
        break;
    }
    case WM_CLOSE:
        EndDialog(hwnd , 0);
        return 0;
    case WM_DESTROY:
        DeleteObject((HGDIOBJ)SendDlgItemMessage(hwnd , IDC_TOKEN , STM_GETIMAGE , IMAGE_BITMAP , 0));
        return 0;
    case WM_COMMAND:
        tk = (sDIALOG_token*) GetProp(hwnd , "sDIALOG_token*");
        switch(HIWORD(wParam)) {
        case BN_CLICKED: {
            switch (LOWORD(wParam)) {
            case IDOK: {
                tk->token = (char*)Ctrl->GetTempBuffer(500);
                GetDlgItemText(hwnd , IDC_EDIT1 , tk->token , 500);
                EndDialog(hwnd , IDOK);
                return 0;
            }
            }
            break;
        }
        }
        break;
    }
    return 0;//DefWindowProc(hwnd , message , wParam , lParam);
}
Пример #4
0
//=============================================================================
//
//  DirList_Init()
//
//  Initializes the DLDATA structure and sets up the listview control
//
BOOL DirList_Init(HWND hwnd,LPCWSTR pszHeader)
{

  HIMAGELIST hil;
  SHFILEINFO shfi;
  LV_COLUMN  lvc;

  // Allocate DirListData Property
  LPDLDATA lpdl = (LPVOID)GlobalAlloc(GPTR,sizeof(DLDATA));
  SetProp(hwnd,pDirListProp,(HANDLE)lpdl);

  // Setup dl
  lpdl->hwnd = hwnd;
  lpdl->cbidl = 0;
  lpdl->pidl = NULL;
  lpdl->lpsf = NULL;
  lstrcpy(lpdl->szPath,L"");

  // Add Imagelists
  hil = (HIMAGELIST)SHGetFileInfo(L"C:\\",0,&shfi,sizeof(SHFILEINFO),
                    SHGFI_SMALLICON | SHGFI_SYSICONINDEX);

  ListView_SetImageList(hwnd,hil,LVSIL_SMALL);

  hil = (HIMAGELIST)SHGetFileInfo(L"C:\\",0,&shfi,sizeof(SHFILEINFO),
                    SHGFI_LARGEICON | SHGFI_SYSICONINDEX);

  ListView_SetImageList(hwnd,hil,LVSIL_NORMAL);

  // Initialize default icons - done in DirList_Fill()
  //SHGetFileInfo(L"Icon",FILE_ATTRIBUTE_DIRECTORY,&shfi,sizeof(SHFILEINFO),
  //  SHGFI_USEFILEATTRIBUTES | SHGFI_SMALLICON | SHGFI_SYSICONINDEX);
  //lpdl->iDefIconFolder = shfi.iIcon;

  //SHGetFileInfo(L"Icon",FILE_ATTRIBUTE_NORMAL,&shfi,sizeof(SHFILEINFO),
  //  SHGFI_USEFILEATTRIBUTES | SHGFI_SMALLICON | SHGFI_SYSICONINDEX);
  //lpdl->iDefIconFile = shfi.iIcon;

  lpdl->iDefIconFolder = 0;
  lpdl->iDefIconFile = 0;

  // Icon thread control
  lpdl->hExitThread = CreateEvent(NULL,TRUE,FALSE,NULL);
  lpdl->hTerminatedThread = CreateEvent(NULL,TRUE,TRUE,NULL);

  lvc;
  pszHeader;

  return TRUE;

}
Пример #5
0
static int ch_newindex (lua_State* l) {
HWND h = gethandle(l,1);
if (lua_isnumber(l,2)) {
int pos = luaL_checkint(l,2);
if (pos==0) pos=-1;
if (pos<0) pos += SendMessage(h, LB_GETCOUNT, 0, 0);
else pos--;
const char* str = luaL_checkstring(l,3);
const wchar_t* wstr = strcvt(str, CP_UTF8, CP_UTF16, NULL);
int sel = SendMessage(h, LB_GETCURSEL, 0, 0);
SendMessage(h, LB_DELETESTRING, pos, 0);
SendMessage(h, LB_INSERTSTRING, pos, wstr);
SendMessage(h, LB_SETCURSEL, sel, 0);
free(wstr);
return 0;
}
const char* nm = luaL_checkstring(l,2);
if (streq(nm, "selectedIndex")) {
int n = lua_tonumber(l,3);
if (n==0) n=-1;
else if (n<0) n += SendMessage(h, LB_GETCOUNT, 0, 0);
else n--;
SendMessage(h, LB_SETCURSEL, n, 0);
}
else if (streq(nm, "selectedItem")) {
const char* str = luaL_checkstring(l,3);
const wchar_t* wstr = strcvt(str, CP_UTF8, CP_UTF16, NULL);
SendMessage(h, LB_SELECTSTRING, -1, wstr);
free(wstr);
}
else if (streq(nm, "onClose")) SetProp(h, L"onClose", lua_topointer(l,3));
else if (streq(nm, "onAction")) SetProp(h, L"onAction", lua_topointer(l,3));
else if (streq(nm, "onSelect")) SetProp(h, L"onSelect", lua_topointer(l,3));
else if (streq(nm, "onContextMenu")) SetProp(h, L"onContextMenu", lua_topointer(l,3));
//SUITE
else luaL_argerror(l, 2, "undefined property");
return 0;
}
Пример #6
0
bool WndProcEater::SetWndHandle(HWND hWnd)
{
	if(hWnd == hWndEaten) return true;

	//printf( "(Lilypad) (Re)-Setting window handle! -> this=0x%08x, hWnd=0x%08x\n", this, hWnd );

	Release();
	SetProp(hWnd, L"LilyHaxxor", (HANDLE)this);

	eatenWndProc = (WNDPROC) SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)OverrideWndProc);
	hWndEaten = (eatenWndProc) ? hWnd : 0;

	return !!hWndEaten;
}
Пример #7
0
/*****************************************************
 * Hack ahead !!!
 *
 * Problems here have to do with focus handling, i.e.
 * sharing and passing keyboard focus back and forth from
 * the gecko window to the rest of the app. The gecko
 * wants us to turn focus on and off when we receive the
 * WM_ACTIVATE message for our window; Gtk+ does not give
 * us an opportunity to act on this message (TODO: patch
 * gtk+ to do so and run tests).
 *
 * Also tried to turn on and off focus near when activate
 * messages come (i.e. focus in/out of the toplevel window)
 * with no luck (works to get started, but the gecko
 * will never relinquish focus afterwords).
 *
 * The current hack/workaround:
 *   We are using a native toplevel window, that we reposition
 * to follow the widget hierarchy on toplevel configure events,
 * this way we handle the WM_ACTIVATE messages and focus handleing
 * works, on the other hand accelerators keys tied into the higher
 * level window wont trigger when the gecko has focus (is that
 * already the case ?) and the apps toplevel will be painted as
 * an inactive window.
 */
static HWND
create_native_window(GtkWidget *widget)
{
    static ATOM klass = 0;
    HWND window_handle, parent_handle;
    DWORD dwStyle, dwExStyle;

    if (!klass) {
         static WNDCLASSEXW wcl;

         wcl.cbSize = sizeof(WNDCLASSEX);
         wcl.style = 0;

        /* DON'T set CS_<H,V>REDRAW. It causes total redraw
         * on WM_SIZE and WM_MOVE. Flicker, Performance!
         */
         wcl.lpfnWndProc = (WNDPROC)window_procedure;
         wcl.cbClsExtra = 0;
         wcl.cbWndExtra = 0;
         wcl.hInstance = GetModuleHandle(NULL);
         wcl.hIcon = 0;
         wcl.hIconSm = 0;
         wcl.lpszMenuName = NULL;
         wcl.hIcon = NULL;
         wcl.hIconSm = NULL;
         wcl.hbrBackground = NULL;
         wcl.hCursor = LoadCursor(NULL, IDC_ARROW);
         wcl.lpszClassName = L"MozWindow";

         klass = RegisterClassExW(&wcl);
    }

    dwExStyle = WS_EX_TOOLWINDOW; // for popup windows
    dwStyle = WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; // popup window

    parent_handle = (HWND)GDK_WINDOW_HWND(gtk_widget_get_parent_window(widget));
    window_handle = CreateWindowExW(dwExStyle,
                                    MAKEINTRESOURCEW(klass),
                                    L"",
                                    dwStyle,
                                    0, 0, 1, 1,
                                    parent_handle,
                                    NULL,
                                    GetModuleHandle(NULL),
                                    NULL);

    SetProp(window_handle, "moz-view-widget", (HANDLE)widget);

    return window_handle;
}
Пример #8
0
INT_PTR onMoveDialogCancel (HWND hDlg, WPARAM wParam, LPARAM lParam)
{
	TCHAR str1 [512];
	TCHAR str2 [512];
	LONG hInst = GetWindowLong (hDlg, GWL_HINSTANCE);
	LoadString ((HINSTANCE)hInst, IDS_SHURE_CANCEL_COPY, str1, sizeof(str1));
	LoadString ((HINSTANCE)hInst, IDS_CAPTION, str2, sizeof (str2));
	if (MB_OK == MessageBox (hDlg, str1, str2, MB_OK | MB_ICONQUESTION))
	{
		// Сбросить флаг активности операции копирования
		SetProp (hDlg, L"running", (HANDLE) FALSE);
	}
	return 0;
}
Пример #9
0
/*
* DesktopListDialogProc
*
* Purpose:
*
* Desktop list page.
*
* WM_INITDIALOG - Initialize listview.
* WM_NOTIFY - Handle list view notifications.
* WM_SHOWWINDOW - Collect desktop info and fill list.
* WM_DESTROY - Free image list.
*
*/
INT_PTR CALLBACK DesktopListDialogProc(
	_In_  HWND hwndDlg,
	_In_  UINT uMsg,
	_In_  WPARAM wParam,
	_In_  LPARAM lParam
	)
{
	LPNMLISTVIEW	nhdr = NULL;
	PROPSHEETPAGE *pSheet;
	PROP_OBJECT_INFO *Context = NULL;

	switch (uMsg) {

	case WM_SHOWWINDOW:
		if (wParam) {
			Context = GetProp(hwndDlg, T_PROPCONTEXT);
			DesktopListSetInfo(Context, hwndDlg);
			if (DesktopList) {
				ListView_SortItemsEx(DesktopList, 
					&DesktopListCompareFunc, DesktopListSortColumn);
			}
			return 1;
		}
		break;

	case WM_NOTIFY:
		nhdr = (LPNMLISTVIEW)lParam;
		DesktopListHandleNotify(hwndDlg, nhdr);
		return 1;
		break;

	case WM_DESTROY:
		if (DesktopImageList) {
			ImageList_Destroy(DesktopImageList);
		}
		RemoveProp(hwndDlg, T_PROPCONTEXT);
		break;

	case WM_INITDIALOG:
		pSheet = (PROPSHEETPAGE*)lParam;
		if (pSheet) {
			SetProp(hwndDlg, T_PROPCONTEXT, (HANDLE)pSheet->lParam);
		}
		DesktopListCreate(hwndDlg);
		return 1;
		break;

	}
	return 0;
}
Пример #10
0
// Many thanks to sunnyandy for helping out with this approach.  What we're doing here is setting up
// a Windows hook to see incoming messages to the IEFrame's message processor.  Once we find one that's
// WM_GETMINMAXINFO, we inject our own message processor into the IEFrame process to handle that one
// message.  WM_GETMINMAXINFO is sent on a resize event so the process can see how large a window can be.
// By modifying the max values, we can allow a window to be sized greater than the (virtual) screen resolution
// would otherwise allow.
//
// See the discussion here: http://www.codeguru.com/forum/showthread.php?p=1889928
LRESULT WINAPI CallWndProc(int nCode, WPARAM wParam, LPARAM lParam)
{
    CWPSTRUCT* cwp = (CWPSTRUCT*) lParam;

    if (WM_GETMINMAXINFO == cwp->message)
    {
        // Inject our own message processor into the process so we can modify the WM_GETMINMAXINFO message.
        // It is not possible to modify the message from this hook, so the best we can do is inject a function that can.
        LONG_PTR proc = SetWindowLongPtr(cwp->hwnd, GWL_WNDPROC, (LONG_PTR) MinMaxInfoHandler);
        SetProp(cwp->hwnd, L"__original_message_processor__", (HANDLE) proc);
    }

    return CallNextHookEx(nextHook, nCode, wParam, lParam);
}
Пример #11
0
bool CLinkControl::ConvertStaticToLink(HWND hwndCtl)
{
    // Subclass the parent so we can draw the controls ourselves
    HWND hwndParent = GetParent(hwndCtl);
    if (hwndParent)
    {
        WNDPROC pfnOrigProc = (WNDPROC) GetWindowLongPtr(hwndParent, GWLP_WNDPROC);
        if (pfnOrigProc != _HyperlinkParentProc)
        {
            if (SetProp(hwndParent, PROP_ORIGINAL_PROC, (HANDLE)pfnOrigProc))
                SetWindowLongPtr(hwndParent, GWLP_WNDPROC, (LONG_PTR)(WNDPROC)_HyperlinkParentProc);
        }
    }

    // Make sure the control will send notifications.

    LONG_PTR Style = GetWindowLongPtr(hwndCtl, GWL_STYLE);
    SetWindowLongPtr(hwndCtl, GWL_STYLE, Style | SS_NOTIFY);

    // Create an updated font by adding an underline.

    m_StdFont = (HFONT) SendMessage(hwndCtl, WM_GETFONT, 0, 0);

    if (g_counter++ == 0)
    {
        createGlobalResources();
    }
    SendMessage(hwndCtl, WM_SETFONT, (WPARAM)CLinkControl::g_NormalFont, FALSE);

    // Subclass the existing control.

    m_pfnOrigCtlProc = (WNDPROC)GetWindowLongPtr(hwndCtl, GWLP_WNDPROC);
    if (SetProp(hwndCtl, PROP_OBJECT_PTR, (HANDLE)this))
        SetWindowLongPtr(hwndCtl, GWLP_WNDPROC, (LONG_PTR)(WNDPROC)_HyperlinkProc);

    return true;
}
Пример #12
0
//---------------------------------------------------------------
bool hxc_buttonpicker::create(Display *d,Window daddy,int x,int y,int w,int h,
            LPHXC_BUTTONPICKERNOTIFYPROC pass_notifyproc,void *o,int pass_ID)
{
  if (XD) destroy(this);
  XD=d;
  parent=daddy;
  notifyproc=pass_notifyproc;
  id=pass_ID;
  owner=o;

  load_res(XD);

  XSetWindowAttributes swa;
  swa.backing_store=NotUseful;
  swa.background_pixel=col_bk;
  handle=XCreateWindow(XD,parent,x,y,w,h,0,
                           CopyFromParent,InputOutput,CopyFromParent,
                           CWBackingStore | CWBackPixel,&swa);
	hxc::x=x;hxc::y=y;hxc::w=w;hxc::h=h;

  if (handle==0){
    XD=NULL;
    return 0;
  }

  SetProp(XD,handle,cWinProc,DWORD(WinProc));
  SetProp(XD,handle,cWinThis,DWORD(this));

  XSelectInput(XD,handle,ButtonPressMask | ButtonReleaseMask |
                  ExposureMask | StructureNotifyMask | FocusChangeMask |
                  EnterWindowMask | LeaveWindowMask |
                  KeyPressMask | KeyReleaseMask);

  XMapWindow(XD,handle);

  return true;
}
Пример #13
0
INT_PTR CALLBACK PhpProcessTokenHookProc(
    _In_ HWND hwndDlg,
    _In_ UINT uMsg,
    _In_ WPARAM wParam,
    _In_ LPARAM lParam
    )
{
    switch (uMsg)
    {
    case WM_DESTROY:
        {
            RemoveProp(hwndDlg, PhMakeContextAtom());
        }
        break;
    case WM_SHOWWINDOW:
        {
            if (!GetProp(hwndDlg, PhMakeContextAtom())) // LayoutInitialized
            {
                PPH_LAYOUT_ITEM dialogItem;

                // This is a big violation of abstraction...

                dialogItem = PhAddPropPageLayoutItem(hwndDlg, hwndDlg,
                    PH_PROP_PAGE_TAB_CONTROL_PARENT, PH_ANCHOR_ALL);
                PhAddPropPageLayoutItem(hwndDlg, GetDlgItem(hwndDlg, IDC_USER),
                    dialogItem, PH_ANCHOR_LEFT | PH_ANCHOR_TOP | PH_ANCHOR_RIGHT);
                PhAddPropPageLayoutItem(hwndDlg, GetDlgItem(hwndDlg, IDC_USERSID),
                    dialogItem, PH_ANCHOR_LEFT | PH_ANCHOR_TOP | PH_ANCHOR_RIGHT);
                PhAddPropPageLayoutItem(hwndDlg, GetDlgItem(hwndDlg, IDC_VIRTUALIZED),
                    dialogItem, PH_ANCHOR_LEFT | PH_ANCHOR_TOP | PH_ANCHOR_RIGHT);
                PhAddPropPageLayoutItem(hwndDlg, GetDlgItem(hwndDlg, IDC_APPCONTAINERSID),
                    dialogItem, PH_ANCHOR_LEFT | PH_ANCHOR_TOP | PH_ANCHOR_RIGHT);
                PhAddPropPageLayoutItem(hwndDlg, GetDlgItem(hwndDlg, IDC_INSTRUCTION),
                    dialogItem, PH_ANCHOR_LEFT | PH_ANCHOR_BOTTOM);
                PhAddPropPageLayoutItem(hwndDlg, GetDlgItem(hwndDlg, IDC_INTEGRITY),
                    dialogItem, PH_ANCHOR_RIGHT | PH_ANCHOR_BOTTOM);
                PhAddPropPageLayoutItem(hwndDlg, GetDlgItem(hwndDlg, IDC_ADVANCED),
                    dialogItem, PH_ANCHOR_RIGHT | PH_ANCHOR_BOTTOM);

                PhDoPropPageLayout(hwndDlg);

                SetProp(hwndDlg, PhMakeContextAtom(), (HANDLE)TRUE);
            }
        }
        break;
    }

    return FALSE;
}
Пример #14
0
LRESULT CALLBACK CBrowserWnd::WndProc( HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam )
{
	CBrowserWnd* pThis = NULL;
	if(IsWindow(hWnd))
	{
		pThis = (CBrowserWnd*)GetProp(hWnd, TEXT("browser_this"));
		if(pThis && pThis->m_hWnd != hWnd)
		{
			pThis = NULL;
		}
	}

	if(pThis || uMessage == WM_CREATE)
	{
		switch (uMessage)
		{
		case WM_ERASEBKGND:
			return TRUE;
		case WM_CREATE:
			{
				LPCREATESTRUCT lpcs = (LPCREATESTRUCT)lParam;
				pThis = (CBrowserWnd*)(lpcs->lpCreateParams);
				SetProp(hWnd, TEXT("browser_this"), (HANDLE) pThis);
				pThis->m_hWnd = hWnd;
				pThis->OnCreate();
			}
			break;
		case WM_SIZE:
			pThis->OnSize(LOWORD(lParam), HIWORD(lParam));
			return 0;
		case WM_DESTROY:
			RemoveProp(hWnd, TEXT("browser_this"));
			pThis->OnDestroy();
			delete pThis;
			return 0;
		case WM_CLOSE:
			PostQuitMessage(0);
			return 0;
		case WM_ACTIVATE:
			if(LOWORD(wParam) != WA_INACTIVE)
			{
				SetFocus(pThis->m_view->wnd());
			}
			return 0;
		}
	}

	return DefWindowProc(hWnd, uMessage, wParam, lParam);
}
Пример #15
0
WndUltimate*BindWindow(HWND hWnd,WndUltimate*pWindow,DWORD wndStyle,DWORD wndStyleEx)
{
	if(pWindow)
	{
		SetProp(hWnd,__UMyProp__,pWindow);
		pWindow->m_hWnd = hWnd;
		pWindow->_wndParent = GetParent(hWnd);
		pWindow->_wndStyle = wndStyle;
		pWindow->_wndStyleEx = wndStyleEx;
		pWindow->_oldProc = (WNDPROC)SetWindowLong(hWnd,GWL_WNDPROC,(LONG)_afxWndUltimate);
		pWindow->GetWindowSize();
		pWindow->OnEnvReset();
	}
	return(pWindow);
}
Пример #16
0
AHTPROP *AHTMODEL::SetProperty( char *propname, char *name, char *value )
{
    AHTPROP *p;
    p = GetProperty( propname );
    if ( p == NULL ) {
        char ptmp[128];
        strcpy2( ptmp, propname, 128 );
        strcase( ptmp );
        p = AddProperty();
        SetPropOrgName( p, ptmp );
    }
    if (( name == NULL )||( value == NULL )) return p;
    if ( SetProp( p, name, value ) < 0 ) return NULL;
    return p;
}
Пример #17
0
/*++

Routine Name:

    CDocPropPage::StoreThis

Routine Description:

    Stores a pointer to this instance of the CDocPropPage class
    that will be associated with the windows handle provided.

Arguments:

    hDlg - Handle of the property page window associated with this class.

Return Value:

    HRESULT
    S_OK - On success
    E_*  - On error

--*/
HRESULT
CDocPropPage::StoreThis(
    __in CONST HWND hDlg
    )
{
    HRESULT hr = S_OK;

    if (!SetProp(hDlg, MAKEINTATOM(ID_XDSMPL_DLG_ATOM), reinterpret_cast<HANDLE>(this)))
    {
        hr = E_FAIL;
    }

    ERR_ON_HR(hr);
    return hr;
}
Пример #18
0
void	THelp :: RemoveWindowProc  ( int  index )
   {
	THelpDefinition &	e	=  HelpTable [index] ;
	HANDLE			hProp	=  GetProp ( e. WindowHwnd, HELP_PROPERTY ) ;


	if  ( ( int ) hProp  ==  1 )  	// On peut remettre la bonne window proc
	   {
		RemoveProp ( e. WindowHwnd, HELP_PROPERTY ) ;           	
		RemoveProp ( e. WindowHwnd, WNDPROC_PROPERTY ) ;
		SetWindowLong ( e. WindowHwnd, GWL_WNDPROC, ( DWORD ) e. WindowProc ) ;
	    }
	else if  ( ( int ) hProp > 1 )  // sinon compter une référence de moins
		SetProp ( e. WindowHwnd, HELP_PROPERTY, ( HANDLE ) ( ( int ) hProp - 1 ) ) ;
     }
Пример #19
0
HWND CreateSearchControl(
    _In_ UINT CommandID
    )
{
    PEDIT_CONTEXT context;

    context = (PEDIT_CONTEXT)PhAllocate(sizeof(EDIT_CONTEXT));
    memset(context, 0, sizeof(EDIT_CONTEXT));

    context->CommandID = CommandID;

    // Create the SearchBox window.
    context->WindowHandle = CreateWindowEx(
        WS_EX_CLIENTEDGE,
        WC_EDIT,
        NULL,
        WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | ES_LEFT | ES_AUTOHSCROLL | WS_VISIBLE,
        CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
        RebarHandle,
        NULL,
        NULL,
        NULL
        );

    // TODO: Why does the Edit control require WS_VISIBLE to be correctly initialized under some conditions?
    //  For now just call ShowWindow with SW_HIDE instead of removing the WS_VISIBLE style passed to CreateWindowEx.
    if (SearchBoxDisplayMode == SEARCHBOX_DISPLAY_MODE_HIDEINACTIVE)
    {
        ShowWindow(SearchboxHandle, SW_HIDE);
    }

    //NcAreaInitializeTheme(context);
    NcAreaInitializeImageList(context);

    // Set initial text
    Edit_SetCueBannerText(context->WindowHandle, L"Search Processes (Ctrl+K)");

    // Set our window context data.
    SetProp(context->WindowHandle, L"EditSubclassContext", (HANDLE)context);

    // Subclass the Edit control window procedure.
    SetWindowSubclass(context->WindowHandle, NcAreaWndSubclassProc, 0, (ULONG_PTR)context);

    // Initialize the theme parameters.
    SendMessage(context->WindowHandle, WM_THEMECHANGED, 0, 0);

    return context->WindowHandle;
}
Пример #20
0
/*
* PipeTypeDialogProc
*
* Purpose:
*
* Pipe Properties Dialog Procedure
*
*/
INT_PTR CALLBACK PipeTypeDialogProc(
    _In_  HWND hwndDlg,
    _In_  UINT uMsg,
    _In_  WPARAM wParam,
    _In_  LPARAM lParam
)
{
    HDC               hDc;
    PAINTSTRUCT       Paint;
    PROPSHEETPAGE    *pSheet = NULL;
    PROP_OBJECT_INFO *Context = NULL;

    switch (uMsg) {

    case WM_INITDIALOG:
        pSheet = (PROPSHEETPAGE *)lParam;
        if (pSheet) {
            SetProp(hwndDlg, T_PROPCONTEXT, (HANDLE)pSheet->lParam);
        }
        return 1;
        break;

    case WM_SHOWWINDOW:
        if (wParam) {
            Context = GetProp(hwndDlg, T_PROPCONTEXT);
            if (Context) {
                PipeQueryInfo(Context, hwndDlg);
            }
        }
        return 1;
        break;

    case WM_PAINT:
        hDc = BeginPaint(hwndDlg, &Paint);
        if (hDc) {
            ImageList_Draw(PipeDlgContext.ImageList, 0, hDc, 24, 34, ILD_NORMAL | ILD_TRANSPARENT);
            EndPaint(hwndDlg, &Paint);
        }
        return 1;
        break;

    case WM_DESTROY:
        RemoveProp(hwndDlg, T_PROPCONTEXT);
        break;

    }
    return 0;
}
Пример #21
0
nsresult
SimplePluginInstance::PlatformSetWindow(nsPluginWindow* window)
{
    if( fWindow != NULL ) /* If we already have a window, clean
                           * it up before trying to subclass
                           * the new window. */
    {
        if( (window == NULL) || ( window->window == NULL ) ) {
            /* There is now no window to use. get rid of the old
             * one and exit. */
            SetWindowLong( fPlatform.fhWnd, GWL_WNDPROC, (LONG)fPlatform.fDefaultWindowProc);
            fPlatform.fDefaultWindowProc = NULL;
            fPlatform.fhWnd = NULL;
            return NS_OK;
        }

        else if ( fPlatform.fhWnd == (HWND) window->window ) {
            /* The new window is the same as the old one. Exit now. */
            return NS_OK;
        }
        else {
            /* Clean up the old window, so that we can subclass the new
             * one later. */
            SetWindowLong( fPlatform.fhWnd, GWL_WNDPROC, (LONG)fPlatform.fDefaultWindowProc);
            fPlatform.fDefaultWindowProc = NULL;
            fPlatform.fhWnd = NULL;
        }
    }
    else if( (window == NULL) || ( window->window == NULL ) ) {
        /* We can just get out of here if there is no current
         * window and there is no new window to use. */
        return NS_OK;
    }

    /* At this point, we will subclass
     * window->window so that we can begin drawing and
     * receiving window messages. */
    fPlatform.fDefaultWindowProc =
        (WNDPROC)SetWindowLong( (HWND)window->window,
                                GWL_WNDPROC, (LONG)SimplePluginInstance::PluginWindowProc);
    fPlatform.fhWnd = (HWND) window->window;
    SetProp(fPlatform.fhWnd, gInstanceLookupString, (HANDLE)this);

    InvalidateRect( fPlatform.fhWnd, NULL, TRUE );
    UpdateWindow( fPlatform.fhWnd );
    return NS_OK;
}
Пример #22
0
BOOL AeroSubClassChild(HWND hwnd, WNDPROC pWndProc, DWORD dwAddFlags, PAERO_SUBCLASS_WND_DATA pWndParentAeroData)
{
    if(!hwnd || !pWndProc || !pWndParentAeroData)
    {
        SetLastError(ERROR_INVALID_PARAMETER);        
        return FALSE;
    }


    PAERO_SUBCLASS_WND_DATA pControlSubclassWndData = (PAERO_SUBCLASS_WND_DATA)GetProp(hwnd, WINDOW_DATA_STRING);
    if(pControlSubclassWndData)
    {
        SetLastError(ERROR_ALREADY_INITIALIZED);
        return FALSE;
    }



    pControlSubclassWndData = (PAERO_SUBCLASS_WND_DATA)LocalAlloc(LPTR, sizeof(AERO_SUBCLASS_WND_DATA));
    if(!pControlSubclassWndData)
        return FALSE;   // use the LocalAlloc last error

    memcpy(pControlSubclassWndData, pWndParentAeroData, sizeof(AERO_SUBCLASS_WND_DATA));
    pControlSubclassWndData->m_dwFlags |= dwAddFlags;

    pControlSubclassWndData->m_dwSelFirst = pControlSubclassWndData->m_dwSelLast = (DWORD) -1;


    CLocalFreeData ctrlData(pControlSubclassWndData);

    if(!SetProp(hwnd, WINDOW_DATA_STRING, pControlSubclassWndData))
        return FALSE;   // use the SetProp last error

    pControlSubclassWndData->m_oldWndProc = (WNDPROC) SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) pWndProc);
    
    if(!pControlSubclassWndData->m_oldWndProc)
    {
        DWORD dwLastError = GetLastError();
        VERIFY(pControlSubclassWndData==RemoveProp(hwnd, WINDOW_DATA_STRING));
        SetLastError(dwLastError);
        return FALSE;
    }

    ctrlData.Clear();
    
    return TRUE;
}
Пример #23
0
void ResetScrollBars(HWND hWnd, BOOL bOn)
{
    if (bOn)
    {
        WORD wScroll = GetProp(hWnd, PutSBBack);
        
        if (wScroll)
        {
            long lStyle = GetWindowLong(hWnd, GWL_STYLE);
                  
            RemoveProp(hWnd, PutSBBack);
            if (wScroll & VERT)
            {
                lStyle |= WS_VSCROLL;
                SetScrollRange(hWnd, SB_VERT, 0, 100, TRUE);
            }
            if (wScroll & HORZ)
            {
                lStyle |= WS_HSCROLL;
                SetScrollRange(hWnd, SB_HORZ, 0, 100, TRUE);
            }
            SetWindowLong(hWnd, GWL_STYLE, lStyle);
        }
    }
    else if (!GetProp(hWnd, PutSBBack))
    {
        ATOMID idWidget = KpsGetWidgetFromWindow(hWnd);
        
        if (KppIsAKindOf(idWidget, lpWNs->idDrawWN))
        {
            long lStyle = GetWindowLong(hWnd, GWL_STYLE);
            WORD wScroll = 0;
                  
            if (lStyle & WS_VSCROLL)
            {
                wScroll = VERT;
                SetScrollRange(hWnd, SB_VERT, 0, 0, FALSE);
            }
            if (lStyle & WS_HSCROLL)
            {
                wScroll |= HORZ;
                SetScrollRange(hWnd, SB_HORZ, 0, 0, FALSE);
            }
            SetProp(hWnd, PutSBBack, wScroll);
        }
    }
}
Пример #24
0
void AttachAll(HWND hWnd)
{
	UINT uId = (UINT) GetProp(hWnd, gszSubclassProp);
	ATLASSERT(uId == 0);
	if(uId == 0)
	{
		SetProp(hWnd, gszSubclassProp, (HANDLE) guIdSubclass);
		SetWindowSubclass(hWnd, SubclassProc, guIdSubclass, NULL);
	}

	// Subclass all of the children
	hWnd = ::GetWindow(hWnd, GW_CHILD);
	while(hWnd) {
		AttachAll(hWnd);
		hWnd = ::GetWindow(hWnd, GW_HWNDNEXT);
	}
}
Пример #25
0
INT_PTR CALLBACK CRegisterTabs::TabProcFPR(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
    if (msg == WM_INITDIALOG)
    {
        SetProp(hDlg, "attached", (HANDLE)lParam);
        return TRUE;
    }
    if (msg == WM_COMMAND && HIWORD(wParam) == EN_KILLFOCUS)
    {
        bool * attached = (bool *)GetProp(hDlg, "attached");
        if (attached != NULL && *attached)
        {
            RegisterChanged(hDlg, TabFPR, wParam);
        }
    }
    return FALSE;
}
Пример #26
0
bool InitializeKeyboardHook(int threadID, HWND destination)
{
	if (g_appInstance == NULL)
	{
		return false;
	}

	if (GetProp(GetDesktopWindow(), "WILSON_HOOK_HWND_KEYBOARD") != NULL)
	{
		SendNotifyMessage((HWND)GetProp(GetDesktopWindow(), "WILSON_HOOK_HWND_KEYBOARD"), RegisterWindowMessage("WILSON_HOOK_KEYBOARD_REPLACED"), 0, 0);
	}

	SetProp(GetDesktopWindow(), "WILSON_HOOK_HWND_KEYBOARD", destination);

	hookKeyboard = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)KeyboardHookCallback, g_appInstance, threadID);
	return hookKeyboard != NULL;
}
Пример #27
0
bool InitializeShellHook(int threadID, HWND destination)
{
	if (g_appInstance == NULL)
	{
		return false;
	}

	if (GetProp(GetDesktopWindow(), "WILSON_HOOK_HWND_SHELL") != NULL)
	{
		SendNotifyMessage((HWND)GetProp(GetDesktopWindow(), "WILSON_HOOK_HWND_SHELL"), RegisterWindowMessage("WILSON_HOOK_SHELL_REPLACED"), 0, 0);
	}

	SetProp(GetDesktopWindow(), "WILSON_HOOK_HWND_SHELL", destination);

	hookShell = SetWindowsHookEx(WH_SHELL, (HOOKPROC)ShellHookCallback, g_appInstance, threadID);
	return hookShell != NULL;
}
Пример #28
0
bool InitializeGetMsgHook(int threadID, HWND destination)
{
	if (g_appInstance == NULL)
	{
		return false;
	}

	if (GetProp(GetDesktopWindow(), "WILSON_HOOK_HWND_GETMSG") != NULL)
	{
		SendNotifyMessage((HWND)GetProp(GetDesktopWindow(), "WILSON_HOOK_HWND_GETMSG"), RegisterWindowMessage("WILSON_HOOK_GETMSG_REPLACED"), 0, 0);
	}

	SetProp(GetDesktopWindow(), "WILSON_HOOK_HWND_GETMSG", destination);

	hookGetMsg = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)GetMsgHookCallback, g_appInstance, threadID);
	return hookGetMsg != NULL;
}
Пример #29
0
bool InitializeCallWndProcHook(int threadID, HWND destination)
{
	if (g_appInstance == NULL)
	{
		return false;
	}

	if (GetProp(GetDesktopWindow(), "WILSON_HOOK_HWND_CALLWNDPROC") != NULL)
	{
		SendNotifyMessage((HWND)GetProp(GetDesktopWindow(), "WILSON_HOOK_HWND_CALLWNDPROC"), RegisterWindowMessage("WILSON_HOOK_CALLWNDPROC_REPLACED"), 0, 0);
	}

	SetProp(GetDesktopWindow(), "WILSON_HOOK_HWND_CALLWNDPROC", destination);

	hookCallWndProc = SetWindowsHookEx(WH_CALLWNDPROC, (HOOKPROC)CallWndProcHookCallback, g_appInstance, threadID);
	return hookCallWndProc != NULL;
}
Пример #30
0
bool InitializeMouseHook(int threadID, HWND destination)
{
	if (g_appInstance == NULL)
	{
		return false;
	}

	if (GetProp(GetDesktopWindow(), "WILSON_HOOK_HWND_MOUSE") != NULL)
	{
		SendNotifyMessage((HWND)GetProp(GetDesktopWindow(), "WILSON_HOOK_HWND_MOUSE"), RegisterWindowMessage("WILSON_HOOK_MOUSE_REPLACED"), 0, 0);
	}

	SetProp(GetDesktopWindow(), "WILSON_HOOK_HWND_MOUSE", destination);

	hookMouse = SetWindowsHookEx(WH_MOUSE, (HOOKPROC)MouseHookCallback, g_appInstance, threadID);
	return hookMouse != NULL;
}