示例#1
0
void GEUIDialog::GEClose()
{
//is all of the following needed?
      LogDebugMessage(_T("Closing GE requested"));
      if (NULL != app && m_bgeisuseable) 
      {
            LogDebugMessage(_T("Closing GE"));
            m_bgeisuseable = false;
            m_bclosed = true;
            try
            {
                  SendMessage((HWND) LongToHandle(app->GetMainHwnd()), WM_COMMAND, WM_QUIT, 0);
                  PostMessage((HWND) LongToHandle(app->GetMainHwnd()), WM_QUIT, 0, 0);
                  long is_initialized;
				  int cnt;
				  cnt = 0;
                  do {
	                  is_initialized = app->IsInitialized();
					  cnt++;
					  wxMicroSleep(1000);
                  } while ( is_initialized != 0 && cnt < 1000 );
                  app->Release();
                  //delete app;
                  app = NULL;
                  CoUninitialize();
            }
            catch(...) {
                  LogDebugMessage(_T("Error closing GE"));
            }
            LogDebugMessage(_T("GE closed"));
      }
}
示例#2
0
void GEUIDialog::GEAttachWindow(bool attach)
{
      LogDebugMessage(_T("Attaching/detaching to GE window requested"));
      if (NULL != app && m_bgeisuseable)
      {
            try
            {
                  if (attach)
                  {
                        LogDebugMessage(_T("Attaching to the GE window"));
                        ShowWindowAsync((HWND) LongToHandle(app->GetMainHwnd()), 0);

                        GEParentHwnd = ::GetParent((HWND) LongToHandle(app->GetRenderHwnd()));
                        ::SetParent((HWND) LongToHandle(app->GetRenderHwnd()), (HWND)this->m_panel1->GetHWND());
                        GEResize();
                  }
                  else
                  {
                        LogDebugMessage(_T("Detaching from the GE window"));
                        ::SetParent((HWND) LongToHandle(app->GetRenderHwnd()), GEParentHwnd);
                  }
            }
            catch(...) {
                  LogDebugMessage(_T("Error attaching/detaching the GE window"));
                  return;
            }
            LogDebugMessage(_T("GE window attached/detached"));
      }
}
示例#3
0
/***********************************************************************
 *           LZCopy   (KERNEL32.@)
 *
 * Copies everything from src to dest
 * if src is a LZ compressed file, it will be uncompressed.
 * will return the number of bytes written to dest or errors.
 */
LONG WINAPI LZCopy( HFILE src, HFILE dest )
{
	int	usedlzinit = 0, ret, wret;
	LONG	len;
 	HFILE	oldsrc = src, srcfd;
 	FILETIME filetime;
 	struct	lzstate	*lzs;
#define BUFLEN	1000
	CHAR	buf[BUFLEN];
	/* we need that weird typedef, for i can't seem to get function pointer
	 * casts right. (Or they probably just do not like WINAPI in general)
	 */
	typedef	UINT	(WINAPI *_readfun)(HFILE,LPVOID,UINT);

	_readfun	xread;

	DPRINT("(%d,%d)\n",src,dest);
	if (!IS_LZ_HANDLE(src)) {
		src = LZInit(src);
                if ((INT)src <= 0) return 0;
		if (src != oldsrc) usedlzinit=1;
	}

	/* not compressed? just copy */
        if (!IS_LZ_HANDLE(src))
		xread=_lread;
	else
		xread=(_readfun)LZRead;
	len=0;
	while (1) {
		ret=xread(src,buf,BUFLEN);
		if (ret<=0) {
			if (ret==0)
				break;
			if (ret==-1)
				return LZERROR_READ;
			return ret;
		}
		len    += ret;
		wret	= _hwrite(dest,buf,ret);
		if (wret!=ret)
			return LZERROR_WRITE;
	}

 	/* Maintain the timestamp of source file to destination file */
 	srcfd = (!(lzs = GET_LZ_STATE(src))) ? src : lzs->realfd;
 	GetFileTime( LongToHandle(srcfd), NULL, NULL, &filetime );
 	SetFileTime( LongToHandle(dest), NULL, NULL, &filetime );

 	/* close handle */
	if (usedlzinit)
		LZClose(src);
	return len;
#undef BUFLEN
}
示例#4
0
void GEUIDialog::SaveView( wxCommandEvent & event ) 
{
      m_pdialog->Clean();
      if (m_pdialog->ShowModal() == wxID_OK)
      {
            wxFileName fn(m_pdialog->m_fpPath->GetPath());
            wxString viewname = m_pdialog->m_tViewName->GetValue();
            int format = m_pdialog->m_rFormat->GetSelection();
            m_pdialog->Close();
            Update();
            InvalidateRect ((HWND) LongToHandle(app->GetRenderHwnd()), NULL, TRUE);
            UpdateWindow ((HWND) LongToHandle(app->GetRenderHwnd()));
            
            if ( format == SAVE_KML )
            {
                  if ( fn.GetExt().Upper() != _T("KML") )
                        fn.SetExt(_T("kml"));
                  SaveViewAsKml( fn.GetFullPath(), viewname );
            }
            else if ( format == SAVE_JPG )
            {
                  if ( fn.GetExt().Upper() != _T("JPG") )
                        fn.SetExt(_T("jpg"));
                  SaveViewAsJPG( fn.GetFullPath() );
            }
            else if ( format == SAVE_GE2KAP )
            {
                  //Paul doesn't need the JPG anymore
                  //if ( fn.GetExt().Upper() != _T("JPG") )
                  //      fn.SetExt(_T("jpg"));
                  //SaveViewAsJPG( fn.GetFullPath() );
                  fn.SetExt(_T("gpx"));
                  SaveViewAsGpx( fn.GetFullPath(), viewname );
            }
            else if ( format == SAVE_IMGKAP )
            {
                  if ( fn.GetExt().Upper() != _T("KMZ") )
                        fn.SetExt(_T("kmz"));
                  SaveViewAsKmz( fn.GetFullPath(), viewname );
            }
      }
      else
      {
            m_pdialog->Close();
      }
      if (m_pfocusedwindow)
            m_pfocusedwindow->SetFocus();
      event.Skip();
}
示例#5
0
文件: hsz.c 项目: conioh/os-design
/***************************************************************************\
* DdeKeepStringHandle (DDEML API)
*
* Description:
* Increments the use count of an HSZ.
*
* History:
* 11-1-91 sanfords Created.
\***************************************************************************/
BOOL DdeKeepStringHandle(
DWORD idInst,
HSZ hsz)
{
    PCL_INSTANCE_INFO pcii;
    BOOL fRet = FALSE;

    EnterDDECrit;

    pcii = ValidateInstance((HANDLE)LongToHandle( idInst ));
    if (pcii == NULL) {
        BestSetLastDDEMLError(DMLERR_INVALIDPARAMETER);
        goto Exit;
    }

    if (ValidateHSZ(hsz) == HSZT_INVALID) {
        SetLastDDEMLError(pcii, DMLERR_INVALIDPARAMETER);
        goto Exit;
    }

    if (LATOM_FROM_HSZ(hsz) == 0) {
        fRet = TRUE;
        goto Exit;
    }
    MONHSZ(pcii, hsz, MH_KEEP);
    fRet = IncLocalAtomCount(LATOM_FROM_HSZ(hsz)) ? TRUE : FALSE;

Exit:
    LeaveDDECrit;
    return (fRet);
}
示例#6
0
文件: hsz.c 项目: conioh/os-design
/***************************************************************************\
* DdeFreeStringHandle (DDEML API)
*
* Description:
* Decrement the use count of an HSZ.
*
* History:
* 11-1-91 sanfords Created.
\***************************************************************************/
BOOL DdeFreeStringHandle(
DWORD idInst,
HSZ hsz)
{
    PCL_INSTANCE_INFO pcii;
    BOOL fRet = FALSE;

    EnterDDECrit;

    pcii = ValidateInstance((HANDLE)LongToHandle( idInst ));
    if (pcii == NULL) {
        BestSetLastDDEMLError(DMLERR_INVALIDPARAMETER);
        goto Exit;
    }

    if (ValidateHSZ(hsz) == HSZT_INVALID) {
        SetLastDDEMLError(pcii, DMLERR_INVALIDPARAMETER);
        goto Exit;
    }

    MONHSZ(pcii, hsz, MH_DELETE);
    fRet = TRUE;
    if (LATOM_FROM_HSZ(hsz) != 0) {
        if (DeleteAtom(LATOM_FROM_HSZ(hsz))) {
            SetLastDDEMLError(pcii, DMLERR_INVALIDPARAMETER);
            fRet = FALSE;
        }
    }

Exit:
    LeaveDDECrit;
    return (fRet);
}
示例#7
0
//
//	Check the details of an existing sender
//
//	1) Find the sender
//	2) Get it's texture info
//	3) Return the sharehandle, width, height, and format
//
//	Returns :
//		true - all OK.
//		  width and height are returned changed for sender size change
//		false - sender not found or size changed
//		  width and height are returned zero for sender not found
//
bool spoutSenderNames::CheckSender(const char *sendername, unsigned int &theWidth, unsigned int &theHeight, HANDLE &hSharehandle, DWORD &dwFormat)
{
	SharedTextureInfo info;

	// Is the given sender registered ?
	if(FindSenderName(sendername)) {
		// Does it still exist ?
		if(getSharedInfo(sendername, &info)) {
			// Return the texture info
			theWidth     = (unsigned int)info.width;
			theHeight    = (unsigned int)info.height;
#ifdef _M_X64
			hSharehandle = (HANDLE)(LongToHandle((long)info.shareHandle));
#else
			hSharehandle = (HANDLE)info.shareHandle;
#endif			
			// hSharehandle	= (HANDLE)info.shareHandle;
			dwFormat		= (DWORD)info.format;
			return true;
		}
		else {
			// Sender is registered but does not exist so close it
			ReleaseSenderName(sendername);
		}

	}

	// Return zero width and height to indicate sender not found
	theHeight = 0;
	theWidth  = 0;

	return false;

} // end CheckSender
示例#8
0
void GEUIDialog::SaveViewAsJPG( wxString filename ) 
{ 
      if (NULL == app || !m_bgeisuseable)
      {
            wxMessageBox(_("Screenshot can't be created, GE looks uninitialized..."), _("Problem!"));
            return;
      }

      RECT rect;
      GetWindowRect((HWND) LongToHandle(app->GetRenderHwnd()), &rect);
      int width, height, x, y;
      width = rect.right - rect.left - 1;
      height = rect.bottom - rect.top - 1;
      x = rect.left;
      y = rect.top;

      wxSize screenSize = wxGetDisplaySize();
	wxBitmap bitmap(screenSize.x, screenSize.y);
	wxScreenDC dc;
	wxMemoryDC memDC;
	memDC.SelectObject(bitmap);
      memDC.Blit(0, 0, screenSize.x, screenSize.y, & dc, 0, 0);
	memDC.SelectObject(wxNullBitmap);
      wxMemoryDC cropDC(bitmap);
      wxBitmap screenshot(width, height, -1);
      memDC.SelectObject(screenshot);
      memDC.Blit( 0, 0, width, height, &cropDC, x, y  );
	memDC.SelectObject(wxNullBitmap);
      screenshot.SaveFile(filename, wxBITMAP_TYPE_JPEG);
}
PPH_PROCESS_RECORD PhSipReferenceMaxCpuRecord(
    _In_ LONG Index
    )
{
    LARGE_INTEGER time;
    LONG maxProcessIdLong;
    HANDLE maxProcessId;

    // Find the process record for the max. CPU process for the particular time.

    maxProcessIdLong = PhGetItemCircularBuffer_ULONG(&PhMaxCpuHistory, Index);

    if (!maxProcessIdLong)
        return NULL;

    // This must be treated as a signed integer to handle Interrupts correctly.
    maxProcessId = LongToHandle(maxProcessIdLong);

    // Note that the time we get has its components beyond seconds cleared.
    // For example:
    // * At 2.5 seconds a process is started.
    // * At 2.75 seconds our process provider is fired, and the process is determined
    //   to have 75% CPU usage, which happens to be the maximum CPU usage.
    // * However the 2.75 seconds is recorded as 2 seconds due to
    //   RtlTimeToSecondsSince1980.
    // * If we call PhFindProcessRecord, it cannot find the process because it was
    //   started at 2.5 seconds, not 2 seconds or older.
    //
    // This means we must add one second minus one tick (100ns) to the time, giving us
    // 2.9999999 seconds. This will then make sure we find the process.
    PhGetStatisticsTime(NULL, Index, &time);
    time.QuadPart += PH_TICKS_PER_SEC - 1;

    return PhFindProcessRecord(maxProcessId, &time);
}
示例#10
0
文件: os_win_gl.c 项目: skyview059/vu
// The initial pixel format is used to get an initial rendering context so
// that more rendering functions can be loaded. These new rendering functions
// allow a better, final, rendering context to be created.
int gs_get_initial_pixelformat(long shell)
{
    HDC hdc = LongToHandle(shell);
    int flags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
    PIXELFORMATDESCRIPTOR pfd =
    {
        sizeof(PIXELFORMATDESCRIPTOR),
        1,                 // version
        flags,             // see above
        PFD_TYPE_RGBA,     // type of framebuffer
        32,                // colour depth
        0,0,0,0,0,0,0,0,   // red, green, blue, alpha bits
        0,0,0,0,0,         // accum bits
        24,                // depth buffer bits.
        0,                 // stencil buffer bits.
        PFD_MAIN_PLANE,    // layer
        0,0,0,0,0          // unused
    };

    // create the temporary context using the proper pixel format.
    int pixelFormat = ChoosePixelFormat(hdc, &pfd);
    if (pixelFormat != 0)
    {
        SetPixelFormat(hdc, pixelFormat, &pfd);
        return pixelFormat;
    }
    return 0;
}
示例#11
0
文件: os_win_gl.c 项目: skyview059/vu
// The final pixel format created using the bound rendering functions.
int gs_get_pixelformat(long shell)
{
    const int attribList[] =
    {
        WGL_DRAW_TO_WINDOW_ARB, 1,
        WGL_SUPPORT_OPENGL_ARB, 1,
        WGL_DOUBLE_BUFFER_ARB, 1,
        WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB,
        WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB,
        WGL_COLOR_BITS_ARB, 32,
        WGL_DEPTH_BITS_ARB, 24,
        WGL_STENCIL_BITS_ARB, 8,
        0, // end
    };
    int pixelFormat;
    UINT numFormats;
    HDC hdc = LongToHandle(shell);
    gs_wglChoosePixelFormatARB(hdc, attribList, NULL, 1, &pixelFormat, &numFormats);
    if (pixelFormat != 0)
    {
        PIXELFORMATDESCRIPTOR pfd;
        DescribePixelFormat(hdc, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
        SetPixelFormat(hdc, pixelFormat, &pfd);
        return pixelFormat;
    }
    return 0;
}
示例#12
0
/*
 * @implemented
 */
LONG
WINAPI
_llseek(HFILE hFile, LONG lOffset, int iOrigin)
{
    return SetFilePointer(LongToHandle(hFile),
                          lOffset,
                          NULL,
                          (DWORD) iOrigin);
}
示例#13
0
/**
 * Retrieves current system statistics.
 */
VOID PhPluginGetSystemStatistics(
    _Out_ PPH_PLUGIN_SYSTEM_STATISTICS Statistics
    )
{
    Statistics->Performance = &PhPerfInformation;

    Statistics->NumberOfProcesses = PhTotalProcesses;
    Statistics->NumberOfThreads = PhTotalThreads;
    Statistics->NumberOfHandles = PhTotalHandles;

    Statistics->CpuKernelUsage = PhCpuKernelUsage;
    Statistics->CpuUserUsage = PhCpuUserUsage;

    Statistics->IoReadDelta = PhIoReadDelta;
    Statistics->IoWriteDelta = PhIoWriteDelta;
    Statistics->IoOtherDelta = PhIoOtherDelta;

    Statistics->CommitPages = PhGetItemCircularBuffer_ULONG(&PhCommitHistory, 0);
    Statistics->PhysicalPages = PhGetItemCircularBuffer_ULONG(&PhPhysicalHistory, 0);

    Statistics->MaxCpuProcessId = LongToHandle(PhGetItemCircularBuffer_ULONG(&PhMaxCpuHistory, 0));
    Statistics->MaxIoProcessId = LongToHandle(PhGetItemCircularBuffer_ULONG(&PhMaxIoHistory, 0));

    Statistics->CpuKernelHistory = &PhCpuKernelHistory;
    Statistics->CpuUserHistory = &PhCpuUserHistory;
    Statistics->CpusKernelHistory = &PhCpusKernelHistory;
    Statistics->CpusUserHistory = &PhCpusUserHistory;
    Statistics->IoReadHistory = &PhIoReadHistory;
    Statistics->IoWriteHistory = &PhIoWriteHistory;
    Statistics->IoOtherHistory = &PhIoOtherHistory;
    Statistics->CommitHistory = &PhCommitHistory;
    Statistics->PhysicalHistory = &PhPhysicalHistory;
    Statistics->MaxCpuHistory = &PhMaxCpuHistory;
    Statistics->MaxIoHistory = &PhMaxIoHistory;
#ifdef PH_RECORD_MAX_USAGE
    Statistics->MaxCpuUsageHistory = &PhMaxCpuUsageHistory;
    Statistics->MaxIoReadOtherHistory = &PhMaxIoReadOtherHistory;
    Statistics->MaxIoWriteHistory = &PhMaxIoWriteHistory;
#else
    Statistics->MaxCpuUsageHistory = NULL;
    Statistics->MaxIoReadOtherHistory = NULL;
    Statistics->MaxIoWriteHistory = NULL;
#endif
}
示例#14
0
文件: os_win_gl.c 项目: skyview059/vu
// Destroy the application window. Attempt to remove the rendering context and
// the device context as well.
void gs_display_dispose(long display)
{
    HWND hwnd = LongToHandle(display);
    HDC shell = GetDC(hwnd);
    HGLRC context = wglGetCurrentContext();
    wglMakeCurrent(NULL, NULL);
    wglDeleteContext(context);
    ReleaseDC(hwnd, shell);
    DestroyWindow(hwnd);
}
示例#15
0
文件: hsz.c 项目: conioh/os-design
HSZ InternalDdeCreateStringHandle(
DWORD idInst,
PVOID psz,
int iCodePage)
{
    PCL_INSTANCE_INFO pcii;
    HSZ hszRet = 0;
    int cb;
    WCHAR szw[256];

    EnterDDECrit;

    pcii = ValidateInstance((HANDLE)LongToHandle( idInst ));
    if (pcii == NULL) {
        BestSetLastDDEMLError(DMLERR_INVALIDPARAMETER);
        goto Exit;
    }

    switch (iCodePage) {
    case CP_WINANSI:
        if (*(LPSTR)psz == '\0') {
            goto Exit;
        }
        hszRet = NORMAL_HSZ_FROM_LATOM(AddAtomA((LPSTR)psz));
        break;

    default:

        /*
         * Convert psz to unicode and fall through.
         */
        cb = sizeof(szw) /  sizeof(WCHAR);
#ifdef LATER
        MultiByteToWideChar((UINT)iCodePage, MB_PRECOMPOSED,
                            (LPSTR)psz, -1, szw, cb);
#endif
        psz = &szw[0];


    case CP_WINUNICODE:
        if (*(LPWSTR)psz == L'\0') {
            goto Exit;
        }
        hszRet = NORMAL_HSZ_FROM_LATOM(AddAtomW((LPWSTR)psz));
        break;
    }
    MONHSZ(pcii, hszRet, MH_CREATE);

Exit:
    LeaveDDECrit;
    return (hszRet);
}
示例#16
0
文件: help.c 项目: conioh/os-design
BOOL _SetWindowContextHelpId(PWND pWnd, DWORD dwContextId)
{
    //If dwContextId is NULL, then this implies that the caller wants to
    // remove the dwContextId associated with this Window.
    if(dwContextId == 0) {
        InternalRemoveProp(pWnd, MAKEINTATOM(gpsi->atomContextHelpIdProp),
                PROPF_INTERNAL);
        return(TRUE);
      }

    return (InternalSetProp(pWnd, MAKEINTATOM(gpsi->atomContextHelpIdProp),
            (HANDLE)LongToHandle( dwContextId ), PROPF_INTERNAL | PROPF_NOPOOL));
}
示例#17
0
/***********************************************************************
 *           LZClose   (KERNEL32.@)
 */
void WINAPI LZClose( HFILE fd )
{
	struct lzstate *lzs;

	DPRINT("(%d)\n",fd);
        if (!(lzs = GET_LZ_STATE(fd))) _lclose(fd);
        else
        {
            if (lzs->get) RtlFreeHeap( GetProcessHeap(), 0, lzs->get );
            CloseHandle( LongToHandle(lzs->realfd) );
            lzstates[fd - LZ_MIN_HANDLE] = NULL;
            RtlFreeHeap( GetProcessHeap(), 0, lzs );
        }
}
示例#18
0
LRESULT CALLBACK
CDeskBand::WndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
{
  CDeskBand  *pThis = (CDeskBand*)GetWindowLongPtr(hWnd, GWLP_USERDATA);

  switch (uMessage)
    {
    case WM_NCCREATE:
      {
        LPCREATESTRUCT lpcs = (LPCREATESTRUCT)lParam;
        pThis = (CDeskBand *)( lpcs->lpCreateParams );
        SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)pThis);
        SetWindowPos(hWnd, NULL, 0, 0, 0, 0, 
                     SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);

        //set the window handle
        pThis->m_hWnd = hWnd;
        SetTimer(hWnd, 0xdeadf00d, 3000, NULL);
      }
      break;

    case WM_COMMAND:
      return pThis->OnCommand(wParam, lParam);

    case WM_TIMER:
      return pThis->OnTimer(wParam, lParam);

    case WM_COPYDATA:
      return pThis->OnCopyData((PCOPYDATASTRUCT) lParam);

    case WM_SETFOCUS:
      return pThis->OnSetFocus();

    case WM_KILLFOCUS:
      return pThis->OnKillFocus();

    case WM_SIZE:
      return pThis->OnSize(lParam);

    case WM_WINDOWPOSCHANGING:
      pThis->OnWindowPosChanging(wParam, lParam);
      break;

    case WM_LBUTTONUP:
      SendMessage((HWND)LongToHandle(pThis->m_AppletMenu.command_window),
                  WM_USER + 1, 0, NULL);
      break;
    }
  return DefWindowProc(hWnd, uMessage, wParam, lParam);
}
示例#19
0
/*
 * @implemented
 */
long
WINAPI
_hread(HFILE hFile, LPVOID lpBuffer, long lBytes)
{
    DWORD NumberOfBytesRead;

    if (!ReadFile(LongToHandle(hFile),
                  lpBuffer,
                  (DWORD) lBytes,
                  &NumberOfBytesRead,
                  NULL))
    {
        return HFILE_ERROR;
    }
    return NumberOfBytesRead;
}
示例#20
0
void GEUIDialog::GEResize()
{
      LogDebugMessage(_T("GE resize requested"));
      //while ( m_bbusy ) ;
      if ( m_bbusy )
      {
            LogDebugMessage(_T("GE resize request discarded, busy"));
            return;
      }
      m_bbusy = true;
      if(NULL != app && m_bgeisuseable) 
      {
            LogDebugMessage(_T("Resizing GE"));
            try
            {
                  this->Layout();
                  //Calculate the window extents
                  RECT rect;
                  GetWindowRect((HWND) LongToHandle(app->GetMainHwnd()), &rect);
                  int mwidth, mheight, mx, my;
                  mwidth = rect.right - rect.left - 1;
                  mheight = rect.bottom - rect.top - 1;
                  mx = rect.left;
                  my = rect.top;
                  GetWindowRect((HWND) LongToHandle(app->GetRenderHwnd()), &rect);
                  int rwidth, rheight, rx, ry;
                  rwidth = rect.right - rect.left - 1;
                  rheight = rect.bottom - rect.top - 1;
                  rx = rect.left;
                  ry = rect.top;
                  int deltawidth = mwidth - rwidth;
                  int deltaheight = mheight - rheight;
                  wxSize panelsize = this->m_panel1->GetSize();
                  //Resize
                  SendMessage((HWND) LongToHandle(app->GetMainHwnd()), WM_COMMAND, WM_PAINT, 0);
                  PostMessage((HWND) LongToHandle(app->GetMainHwnd()), WM_QT_PAINT, 0, 0);

                  SetWindowPos(
                        (HWND) LongToHandle(app->GetMainHwnd()),
                        HWND_TOP,
                        0,
                        0,
                        panelsize.GetX() + deltawidth,
                        panelsize.GetY() + deltaheight,
                        SWP_FRAMECHANGED);

                  SendMessage((HWND) LongToHandle(app->GetRenderHwnd()), WM_COMMAND, WM_SIZE, 0);
                  LogDebugMessage(_T("GE resized"));
            }
            catch(...) {
                  LogDebugMessage(_T("Error resizing GE window"));
            }
      }
      m_bbusy = false;
}
示例#21
0
//! Method exported to mIRC that can be invoked to subclass a specified 
//! window (by hwnd) and make its window frame blue.
extern "C" int __declspec(dllexport) __stdcall blue_window(
      HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause)
{
    DOUT(("mIRC callback for blue_window invoked\n"));

    if (data != NULL) {
		HWND hwnd = (HWND) LongToHandle(atoi(data));
        bool bResult = BlueWindow::SubclassNewWindow(hwnd);
        if (bResult) {
            DOUT(("blue_window successfully subclassed new window %p\n", (void*) hwnd));
        } else {
            DOUT(("blue_window failed to subclass new window.\n"));
        }
    }

    return 1;       // mIRC should just continue executing.
}
示例#22
0
// This retrieves the info from the requested sender and fails if the sender does not exist
// For external access to getSharedInfo - redundancy
bool spoutSenderNames::GetSenderInfo(const char* sendername, unsigned int &width, unsigned int &height, HANDLE &dxShareHandle, DWORD &dwFormat)
{
	SharedTextureInfo info;

	if(getSharedInfo(sendername, &info)) {
		width		  = (unsigned int)info.width;
		height		  = (unsigned int)info.height;
#ifdef _M_X64
		dxShareHandle = (HANDLE)(LongToHandle((long)info.shareHandle));
#else
		dxShareHandle = (HANDLE)info.shareHandle;
#endif
		// dxShareHandle = (HANDLE)info.shareHandle;
		dwFormat      = info.format;
		return true;
	}
	return false;
}
示例#23
0
/***************************************************************************\
* DdeGetLastError (DDEML API)
*
* Description:
* Returns last error code set for the instance given.
*
* History:
* 11-12-91 sanfords Created.
\***************************************************************************/
UINT DdeGetLastError(
DWORD idInst)
{
    UINT uiRet = 0;
    PCL_INSTANCE_INFO pcii;

    EnterDDECrit;

    pcii = ValidateInstance((HANDLE)LongToHandle( idInst ));
    if (pcii == NULL) {
        uiRet = DMLERR_INVALIDPARAMETER;
        goto Exit;
    }
    uiRet = pcii->LastError;
    pcii->LastError = DMLERR_NO_ERROR;

Exit:
    LeaveDDECrit;
    return (uiRet);
}
示例#24
0
HWND
CreatePushButton(const char* lpWindowName, DWORD xSize, DWORD id,DWORD Style)
    {

    HWND h = CreateWindow("BUTTON",
        lpWindowName,
        WS_CHILD | BS_PUSHBUTTON | Style,
        xButPos, /* x */
        yButPos, /* y */
        xSize,   /* nWidth */
        20,      /* nHeight */
        g_hwnd,
        LongToHandle(id),
        g_hInst,
        NULL
        );

    yButPos += 21;
    return h;
    }
示例#25
0
// この関数もMtlWin.hの中で浮いていたので隔離した
// もしかしたら作ったの自分かも
HWND _CreateSimpleReBarCtrl(HWND hWndParent, DWORD dwStyle, UINT nID)
{
	// Ensure style combinations for proper rebar painting
	if (dwStyle & CCS_NODIVIDER && dwStyle & WS_BORDER)
		dwStyle &= ~WS_BORDER;
	else if ( !(dwStyle & WS_BORDER) && !(dwStyle & CCS_NODIVIDER) )
		dwStyle |= CCS_NODIVIDER;

	// Create rebar window
	HWND	  hWndReBar = ::CreateWindowEx(
								0,
								REBARCLASSNAME,
								NULL,
								dwStyle,
								0,
								0,
								100,
								100,
								hWndParent,
								(HMENU) LongToHandle(nID),
								_Module.GetModuleInstance(),
								NULL );

	if (hWndReBar == NULL) {
		ATLTRACE2( atlTraceUI, 0, _T("Failed to create rebar.\n") );
		return NULL;
	}

	// Initialize and send the REBARINFO structure
	REBARINFO rbi;
	rbi.cbSize = sizeof (REBARINFO);
	rbi.fMask  = 0;

	if ( !::SendMessage(hWndReBar, RB_SETBARINFO, 0, (LPARAM) &rbi) ) {
		ATLTRACE2( atlTraceUI, 0, _T("Failed to initialize rebar.\n") );
		::DestroyWindow(hWndReBar);
		return NULL;
	}

	return hWndReBar;
}
示例#26
0
/* !checksrc! disable SPACEBEFOREPAREN 1 */
curl_thread_t Curl_thread_create(unsigned int (CURL_STDCALL *func) (void *),
                                 void *arg)
{
  curl_thread_t t;
#ifdef _WIN32_WCE
  t = CreateThread(NULL, 0, func, arg, 0, NULL);
#else
  uintptr_t thread_handle = _beginthreadex(NULL, 0, func, arg, 0, NULL);
  t = (curl_thread_t)thread_handle;
#endif
  if((t == 0) || (t == LongToHandle(-1L))) {
#ifdef _WIN32_WCE
    DWORD gle = GetLastError();
    errno = ((gle == ERROR_ACCESS_DENIED ||
              gle == ERROR_NOT_ENOUGH_MEMORY) ?
             EACCES : EINVAL);
#endif
    return curl_thread_t_null;
  }
  return t;
}
示例#27
0
HRESULT STDMETHODCALLTYPE CShellDispatch::BrowseForFolder(LONG Hwnd, BSTR Title, LONG Options, VARIANT RootFolder, Folder **ppsdf)
{
    TRACE("(%p, %lu, %ls, %lu, %s, %p)\n", this, Hwnd, Title, Options, debugstr_variant(&RootFolder), ppsdf);

    *ppsdf = NULL;

    if (!is_optional_argument(&RootFolder))
        FIXME("root folder is ignored\n");

    BROWSEINFOW bi = { 0 };
    bi.hwndOwner = reinterpret_cast<HWND>(LongToHandle(Hwnd));
    bi.lpszTitle = Title;
    bi.ulFlags = Options;

    CComHeapPtr<ITEMIDLIST> selection;
    selection.Attach(SHBrowseForFolderW(&bi));
    if (!selection)
        return S_FALSE;

    return ShellObjectCreatorInit<CFolder>(static_cast<LPITEMIDLIST>(selection), IID_PPV_ARG(Folder, ppsdf));
}
示例#28
0
// Find a sender and return the name, width and height, sharhandle and format
bool spoutSenderNames::FindSender(char *sendername, unsigned int &width, unsigned int &height, HANDLE &hSharehandle, DWORD &dwFormat)
{
	SharedTextureInfo info;

	// ---------------------------------------------------------
	//	For a receiver check the user entered Sender name, if one, to see if it exists
	if(sendername[0] == 0) {
		// Passed name was null, so find the active sender
		if(!GetActiveSender(sendername)) {
			return false;
		}
	}
	// now we have either an existing sender name or the active sender name

	// 01.08.15 - Is the given sender registered ?
	if(!FindSenderName(sendername))
		return false;

	// Sender is registered so try to get the sender information
	if(getSharedInfo(sendername, &info)) {
		width			= (unsigned int)info.width; // pass back sender size
		height			= (unsigned int)info.height;
#ifdef _M_X64
		hSharehandle = (HANDLE)(LongToHandle((long)info.shareHandle));
#else
		hSharehandle = (HANDLE)info.shareHandle;
#endif
		// hSharehandle	= (HANDLE)info.shareHandle;
		dwFormat		= (DWORD)info.format;
		return true;
	}

	// 01.08.15 - Registered sender is no longer there so release it
	ReleaseSenderName(sendername);

	return false;

} // end FindSender
示例#29
0
/*
 * @implemented
 */
long
WINAPI
_hwrite(HFILE hFile, LPCSTR lpBuffer, long lBytes)
{
    DWORD NumberOfBytesWritten;

    if (lBytes == 0)
    {
        if (!SetEndOfFile((HANDLE) hFile))
        {
            return HFILE_ERROR;
        }
        return 0;
    }
    if (!WriteFile(LongToHandle(hFile),
                   (LPVOID) lpBuffer,
                   (DWORD) lBytes,
                   &NumberOfBytesWritten,
                   NULL))
    {
        return HFILE_ERROR;
    }
    return NumberOfBytesWritten;
}
示例#30
0
//
// Retrieve the texture info of the active sender
// - redundancy 
bool spoutSenderNames::FindActiveSender(char sendername[SpoutMaxSenderNameLen], unsigned int &theWidth, unsigned int &theHeight, HANDLE &hSharehandle, DWORD &dwFormat)
{
    SharedTextureInfo TextureInfo;
	char sname[SpoutMaxSenderNameLen];

    if(GetActiveSender(sname)) { // there is an active sender
		if(getSharedInfo(sname, &TextureInfo)) {
			strcpy_s(sendername, SpoutMaxSenderNameLen, sname); // pass back sender name
			theWidth        = (unsigned int)TextureInfo.width;
			theHeight       = (unsigned int)TextureInfo.height;
#ifdef _M_X64
			hSharehandle = (HANDLE)(LongToHandle((long)TextureInfo.shareHandle));
#else
			hSharehandle = (HANDLE)TextureInfo.shareHandle;
#endif
			// hSharehandle	= (HANDLE)TextureInfo.shareHandle;
			dwFormat        = (DWORD)TextureInfo.format;
			return true;
		}
	}

    return false;

} // end FindActiveSender