示例#1
0
LOCAL BOOL Bmulti_ComputeSize( HWND hControl, LPINT lpDX, LPINT lpDY )
/***********************************************************************/
{
	ITEMID idControl;
	LPBITMAPINFO lpDIB;
	HGLOBAL hResource;

	if ( !(idControl = GetWindowWord( hControl, GWW_ICONID )) )
		idControl = GET_WINDOW_ID( hControl );

	if ( !(hResource = (HGLOBAL)FindResource (GetWindowInstance(hControl), MAKEINTRESOURCE(idControl),
		RT_BITMAP) ) )
		return( NO );

	if ( !(hResource = LoadResource (GetWindowInstance(hControl), (HRSRC)hResource) ) )
		return( NO );

	if ( !(lpDIB = (LPBITMAPINFO)LockResource (hResource) ) )
		return( NO );

	// Make sure that the DIB is uncompressed
	if ( lpDX )
		*lpDX = (int)lpDIB->bmiHeader.biWidth;
	if ( lpDY )
		*lpDY = (int)abs(lpDIB->bmiHeader.biHeight);
	UnlockResource( hResource );
	FreeResource( hResource );
	return( YES );
}
示例#2
0
int CPuzzle::NextPuzzle()
/***********************************************************************/
{
	HWND hParent;
	FNAME szFileName;

	hParent = GetParent(m_hWnd);
	PlaySound(IDW_PUZZLENEXT);
	++m_idResource;
	if (m_pDib)
		delete m_pDib;
	if (GetDlgItem(hParent, GetDlgCtrlID(m_hWnd) + 1))
	{
		if (!GetDlgItem(hParent, m_idResource))
			m_idResource = GetDlgCtrlID(m_hWnd) + 1;
		GetWindowText(GetDlgItem(hParent, m_idResource), szFileName, sizeof(szFileName));
    	m_pDib = CDib::LoadDibFromFile( szFileName, m_hPal, FALSE, TRUE );
	}
	else
	{
    	m_pDib = CDib::LoadDibFromResource( GetWindowInstance(m_hWnd), MAKEINTRESOURCE(m_idResource), m_hPal, FALSE, TRUE );
		if (!m_pDib)
		{
			m_idResource = GetDlgCtrlID(m_hWnd) + 1;
    		m_pDib = CDib::LoadDibFromResource( GetWindowInstance(m_hWnd), MAKEINTRESOURCE(m_idResource), m_hPal, FALSE, TRUE );
		}
	}
	if (m_pDib)
	{
	 	Setup();
		return(m_idResource);
	}
	else
		return(0);
}
示例#3
0
//---------------------------------------------------------------------------------------
// メインダイアログ: WM_COMMAND メッセージ処理
//---------------------------------------------------------------------------------------
BOOL OnCommand(HWND hwnd, WPARAM wParam, LPARAM lParam) {
	WORD wID = LOWORD(wParam);

	if (wID == IDOK || wID == IDCANCEL) {
		EndDialog(hwnd, 0);
		return TRUE;
	} else if (wID == IDC_CHG1) {
		try {
			CHANGEDLG_PARAM param;
			param.pszCaption = TEXT("物理NetBIOS名の変更");
			param.strCurrent = kjm::util::getDlgItemText(hwnd, IDC_ComputerNamePhysicalNetBIOS);

			if (DialogBoxParam(GetWindowInstance(hwnd), MAKEINTRESOURCE(IDD_CHANGE), hwnd, ChangeDlg_DlgProc, (LPARAM)&param) == IDOK) {
				if (kjm::util::__SetComputerNameEx(ComputerNamePhysicalNetBIOS, param.strNext.c_str())) {
					MessageBox(hwnd, TEXT("再起動後、有効になります。"), TEXT("物理NetBIOS名の変更"), MB_OK | MB_ICONWARNING);
				} else {
					MessageBox(hwnd, kjm::util::formatMessageBySystem(GetLastError()).c_str(), TEXT("物理NetBIOS名の変更エラー"), MB_OK | MB_ICONERROR);
				}
			}
		} catch (DWORD ex) {
			MessageBox(hwnd, kjm::util::formatMessageBySystem(ex).c_str(), TEXT("物理NetBIOS名の変更エラー"), MB_OK | MB_ICONERROR);
		}
	} else if (wID == IDC_CHG2) {
		try {
			CHANGEDLG_PARAM param;
			param.pszCaption = TEXT("物理DNSホスト名");
			param.strCurrent = kjm::util::getDlgItemText(hwnd, IDC_ComputerNamePhysicalDnsHostname);

			if (DialogBoxParam(GetWindowInstance(hwnd), MAKEINTRESOURCE(IDD_CHANGE), hwnd, ChangeDlg_DlgProc, (LPARAM)&param) == IDOK) {
				if (kjm::util::__SetComputerNameEx(ComputerNamePhysicalDnsHostname, param.strNext.c_str())) {
					MessageBox(hwnd, TEXT("再起動後、有効になります。"), TEXT("物理DNSホスト名の変更"), MB_OK | MB_ICONWARNING);
				} else {
					MessageBox(hwnd, kjm::util::formatMessageBySystem(GetLastError()).c_str(), TEXT("物理DNSホスト名の変更エラー"), MB_OK | MB_ICONERROR);
				}
			}
		} catch (DWORD ex) {
			MessageBox(hwnd, kjm::util::formatMessageBySystem(ex).c_str(), TEXT("物理DNSホスト名の変更エラー"), MB_OK | MB_ICONERROR);
		}
	} else if (wID == IDC_CHG3) {
		try {
			CHANGEDLG_PARAM param;
			param.pszCaption = TEXT("物理DNSサフィックス");
			param.strCurrent = kjm::util::getDlgItemText(hwnd, IDC_ComputerNamePhysicalDnsDomain);

			if (DialogBoxParam(GetWindowInstance(hwnd), MAKEINTRESOURCE(IDD_CHANGE), hwnd, ChangeDlg_DlgProc, (LPARAM)&param) == IDOK) {
				if (kjm::util::__SetComputerNameEx(ComputerNamePhysicalDnsDomain, param.strNext.c_str())) {
					MessageBox(hwnd, TEXT("再起動後、有効になります。"), TEXT("物理DNSサフィックスの変更"), MB_OK | MB_ICONWARNING);
				} else {
					MessageBox(hwnd, kjm::util::formatMessageBySystem(GetLastError()).c_str(), TEXT("物理DNSサフィックスの変更エラー"), MB_OK | MB_ICONERROR);
				}
			}
		} catch (DWORD ex) {
			MessageBox(hwnd, kjm::util::formatMessageBySystem(ex).c_str(), TEXT("物理DNSサフィックスの変更エラー"), MB_OK | MB_ICONERROR);
		}
	}

	return FALSE;
}
示例#4
0
BOOL DlgOnInitDialog (HWND hwnd, HWND, LPARAM) 
{
	g_hWndListener  = GetDlgItem (hwnd, IDC_EDIT_LISTENER) ;
	g_hWndEdit      = GetDlgItem (hwnd, IDC_EDIT_MODULE_FILENAME);

	g_oldListenerWndPrc = (WNDPROC) 
		SetWindowLong (g_hWndListener, GWL_WNDPROC, (LONG)ListenerProc) ;

	RECT rc;
	
	//
	// Associate an icon with the dialog box.
	//
    SendMessage
	(
		hwnd, 
		WM_SETICON, 
		TRUE,  
		(LPARAM)LoadIcon
		(
			GetWindowInstance(hwnd), 
			MAKEINTRESOURCE(IDI_DLGHUSK)
		)
	); 
    
	SendMessage
	(
		hwnd, 
		WM_SETICON, 
		FALSE, 
		(LPARAM)LoadIcon
		(
			GetWindowInstance(hwnd), 
			MAKEINTRESOURCE(IDI_DLGHUSK)
		)
	); 
	
	//
	// The list box must be sized first because the system
	// doesn't send a WM_SIZE message to the dialog box when
	// it's first created.
	//
	GetClientRect(hwnd, &rc);

	DlgOnSize (hwnd, 0, rc.right, rc.bottom) ;

	CreateSiodThread () ;

	return(TRUE);
}
void OverlayElementEditor::CreateEditorWindow()
{
	m_Self = CreateDialogParam(GetWindowInstance(m_Parent), MAKEINTRESOURCE(m_ResourceId), m_Parent, 
		s_DialogProc, (LPARAM)this);

	if (m_Self)
	{
		RECT parentRc;
		GetWindowRect(m_Parent, &parentRc);

		RECT rc;
		GetWindowRect(m_Self, &rc);

		//	Position the editor depending on owner window position.
		RECT selfRect;
		selfRect.right = parentRc.right;
		selfRect.top = parentRc.top;
		selfRect.left = selfRect.right - RectWidth(rc);
		selfRect.bottom = selfRect.top + RectHeight(rc);
		MoveWindow(m_Self, selfRect.left, selfRect.top, RectWidth(rc), RectHeight(rc), FALSE);

		//	Make window semi-transparent.
		SetWindowLong(m_Self, GWL_EXSTYLE, GetWindowLong(m_Self, GWL_EXSTYLE) | WS_EX_LAYERED);
		SetLayeredWindowAttributes(m_Self, RGB(0, 0, 0), 220, LWA_ALPHA);
	}
}
示例#6
0
HWND mainframe_CreateStatusLine(
  HWND hwnd)
  {
   RECT r;
   HWND hwndStatus;
   TEXTMETRIC tm;
   HDC dc;
   int height;

   dc = GetDC(hwnd);
   GetTextMetrics(dc, &tm);
   height = tm.tmHeight + tm.tmExternalLeading;
   ReleaseDC(hwnd,dc);

   GetClientRect(hwnd, &r);

   hwndStatus = CreateWindow(_T("STATIC"), NULL,
     				SS_LEFT | WS_VISIBLE | WS_CHILD,
				r.left, r.bottom - height,
				r.right - r.left,
				height,
				hwnd,
				(HMENU)IDC_STATUS,
				GetWindowInstance(hwnd),
				(LPVOID)NULL);
				
   return hwndStatus;   				    
  }
示例#7
0
//---------------------------------------------------------------------
// WM_RBUTTONUPメッセージ処理
//---------------------------------------------------------------------
LRESULT OnRButtonUp(HWND hwnd, WPARAM wParam, LPARAM lParam) {
	POINT pt = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
	POINT ptScreen = pt;
	ClientToScreen(hwnd, &ptScreen);

	int x, y;

	// 候補数字を選択するメニューを表示する。
	if (g_view.PtInCells(pt, &x, &y)) {
		HMENU hmenu = LoadMenu(GetWindowInstance(hwnd), MAKEINTRESOURCE(IDR_POPUP));
		HMENU hmenuSub = GetSubMenu(hmenu, 0);

		g_xCell = x;
		g_yCell = y;
		for (int i = 0; i < 9; i++) {
			if (g_game.get_Value(y, x) != 0 || g_game.get_Candidate(y, x, i) == 0) {
				EnableMenuItem(hmenuSub, i, MF_BYPOSITION | MF_GRAYED);
			}
		}

		SetForegroundWindow(hwnd);
		TrackPopupMenu(hmenuSub, TPM_LEFTALIGN | TPM_TOPALIGN, ptScreen.x, ptScreen.y, 0, hwnd, NULL);
		SendMessage(hwnd, WM_NULL, 0, 0);
	}

	return 0;
}
示例#8
0
//---------------------------------------------------------------------
// WM_LBUTTONDOWNメッセージ処理
//---------------------------------------------------------------------
LRESULT OnLButtonDown(HWND hwnd, WPARAM wParam, LPARAM lParam) {
	POINT pt = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
	POINT ptScreen = pt;
	ClientToScreen(hwnd, &ptScreen);

	int x, y;

	// クリックしたセルの候補が、単一候補だったときは、確定させる。
	if (g_view.PtInCells(pt, &x, &y)) {
		int num;
		if (g_game.get_Value(y, x) == 0 && g_game.GetCandidateCount(y, x, &num) == 1) {
			g_game.FixCell(y, x, num);
			InvalidateRect(hwnd, NULL, FALSE);
		} else {
			HMENU hmenu = LoadMenu(GetWindowInstance(hwnd), MAKEINTRESOURCE(IDR_POPUP));
			HMENU hmenuSub = GetSubMenu(hmenu, 0);

			g_xCell = x;
			g_yCell = y;
			for (int i = 0; i < 9; i++) {
				if (g_game.get_Value(y, x) != 0 || g_game.get_Candidate(y, x, i) == 0) {
					EnableMenuItem(hmenuSub, i, MF_BYPOSITION | MF_GRAYED);
				}
			}

			SetForegroundWindow(hwnd);
			TrackPopupMenu(hmenuSub, TPM_CENTERALIGN | TPM_VCENTERALIGN, ptScreen.x, ptScreen.y, 0, hwnd, NULL);
			SendMessage(hwnd, WM_NULL, 0, 0);
		}
	}

	return 0;
}
示例#9
0
static void onContextMenu( HWND hwnd, HWND hwndContext, UINT xPos, UINT yPos ) {

    if ( GetCapture() == hwnd ) { // Not while dragging...? TODO -- abort dragging?
        return; //*** FUNCTION EXIT POINT
    }
    SetFocus( hwnd ); // Is this OK? NO! TODO!

    if ( contectMenuActivatedByKeyboard( xPos, yPos ) ) {
        getContextMenuPosition( hwnd, &xPos, &yPos );
    }

#if 0
#if 0   // TODO -- how to handle menu?
        // Store menu as such, or store strings, populate menu dynamically?
        // How to handle translations? Static/dynamic linking?
    HMENU hmenu = CreatePopupMenu();
    if ( 0 != hmenu ) {
        ; // Add items
    }
#else
    HMENU hmenu = LoadMenu( GetWindowInstance( hwnd ), MAKEINTRESOURCE( IDM_RANGESLIDER ) );
    TrackPopupMenu( GetSubMenu( hmenu, 0 ), 
        TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RIGHTBUTTON,
        xPos, yPos, 0,
        hwnd, 0 );
#endif
    DestroyMenu( hmenu );
#endif
}
示例#10
0
BOOL ExportImage( HWND hWnd, ITEMID idItem, ITEMID idIniSection )
{
	HINSTANCE hInstance;
	STRING szAppName, szIniSection;
	STRING szExportName;
	BOOL bSuccess = FALSE;

	// Get the name of export filter
	if ( !(GetMenuString( GetMenu(hWnd), idItem, szAppName, sizeof(szAppName),
   	MF_BYCOMMAND )) ) {
		return( FALSE );
	}

	// Get the name of the INI section to read
	hInstance = GetWindowInstance( hWnd );
	if ( !AstralStrEx( idIniSection, szIniSection, sizeof(szIniSection) )) {
		return( FALSE );
	}

	// Get the module file name for the application
	// Put it in a staic string so the callback has access to it
	if ( !(GetProfileString( szIniSection, szAppName, "", szExportName,
		sizeof(szExportName) )) ) {
		return( FALSE );
	}

	bSuccess = ExportImageDLL( (LPSTR)szExportName );

	return( bSuccess );
}
示例#11
0
//---------------------------------------------------------------------------
// [参照]ボタンを押した時の処理
//---------------------------------------------------------------------------
BOOL MainDlg_Button1_OnClick(HWND hwnd, HWND hwndCtl) {
	BOOL fResult = TRUE;

	TCHAR fileName[MAX_PATH];
	GetDlgItemText(hwnd, IDC_EDIT1, fileName, MAX_PATH);

	OPENFILENAME ofn;
	ZeroMemory(&ofn, sizeof(ofn));
	ofn.lStructSize = sizeof(ofn);
	ofn.hwndOwner = hwnd;
	ofn.hInstance = GetWindowInstance(hwnd);
	ofn.lpstrFilter = _T("すべてのファイル(*.*)\0*.*\0");
	ofn.lpstrFile = fileName;
	ofn.nMaxFile = MAX_PATH;
	ofn.lpstrTitle = _T("ロックするファイルの選択");
	ofn.Flags = OFN_HIDEREADONLY;

	if (GetOpenFileName(&ofn)) {
		SetDlgItemText(hwnd, IDC_EDIT1, fileName);
	} else {
		DWORD err = CommDlgExtendedError();
		if (err != 0) {
			TCHAR msg[256];
			wsprintf(msg, _T("システムエラー %d が、発生しました。"), err);
			MessageBox(hwnd, msg, _T("locker error."), MB_OK | MB_ICONSTOP);
		}
	}

	return fResult;
}
示例#12
0
文件: Status.c 项目: Viriana/SISE
static void status_OnCommand(
  HWND hwnd, 
  int id, 
  HWND hctl, 
  UINT codeNotify)
  {	 
   char buffer[255];
   struct statusWindowData *theData;
   theData = (struct statusWindowData *) GetWindowLongPtr(hwnd,GWLP_USERDATA);
   
   if (theData == NULL) 
     { return; }

   switch (id) 
	 {
      case ID_FILE_PRINT:
        sprintf(buffer,"%s Window",theData->baseName);
        PrintWindowDriver(GetWindowInstance(hMainFrame),hwnd,buffer);
	    return;

      case ID_FILE_SAVE:
      case ID_FILE_SAVE_AS:
        SaveStatusWindow(hwnd);
        return;
	 } 
   
   FORWARD_WM_COMMAND(hwnd,id,hctl,codeNotify,DefMDIChildProc);
  }
示例#13
0
void Toolbar_OnNeedText(
  HWND hwnd, 
  int idCtrl, 
  LPTOOLTIPTEXT pttt)
  {
   HINSTANCE hinst;
   TCHAR szPrompt [256] ;

   ASSERT (0 == (pttt->uFlags & TTF_IDISHWND)) ;

   /*===========================================*/
   /* Get instance handle for string resources. */
   /*===========================================*/
   
   hinst = GetWindowInstance (hwnd) ;

   // Load the string resource with the button ID
   LoadString (hinst, (UINT) pttt->hdr.idFrom, szPrompt, (int) sizeof (szPrompt)) ;

   // The tool tip is the part after the newline character
   pttt->lpszText = _tcschr (szPrompt, (TCHAR) '\n') ;

   // If tool tip text found, skip over the newline character
   if (pttt->lpszText)
     { pttt->lpszText++; }

   pttt->hinst = NULL;
  }
示例#14
0
static void OnActivate(HWND hwnd, UINT state, HWND /*hwndActDeact*/, BOOL /*fMinimized*/)
{
	if (state==WA_INACTIVE)
	{
		if (moved)
		{
			moved=0;
			config_write();
		}
		write_text();
		SetPriorityClass(GetWindowInstance(hwnd),IDLE_PRIORITY_CLASS);
	}
	else
	{
		SetPriorityClass(GetWindowInstance(hwnd),NORMAL_PRIORITY_CLASS);
	}
}
示例#15
0
文件: window.c 项目: luoxiaobing/tftp
/* ------------------------------------------------- */
HWND CreateBckgWindow (HWND hWnd, 
                       WORD wMessage, 
                       WNDPROC CbkProc, 
                       const char *szName, 
                       const char *szAppli)
{
HWND    hNW;
int      Rc;
WNDCLASS WndClass;
RECT     sParentRect;
    if ( ! GetClassInfo (GetWindowInstance (hWnd), szName, & WndClass) )
   {
      // Create a new class
        memset (& WndClass, 0, sizeof WndClass);
        WndClass.lpfnWndProc   = CbkProc;
        WndClass.hInstance     = GetWindowInstance (hWnd);
        WndClass.lpszClassName = szName;
        Rc = RegisterClass (& WndClass);
       if (Rc==0)
       {
            MessageBox (NULL, "Can not register class", szAppli, MB_OK | MB_ICONSTOP);
            return NULL;
       }
    }
    // Get parent's dimension and create the window with the same dimension
    GetWindowRect (hWnd, & sParentRect);
    hNW = CreateWindow (szName,
                        NULL,          // window name
                        WS_CHILD,        // dwStyle
                        sParentRect.left,
                        sParentRect.top,
                        sParentRect.right - sParentRect.left,
                        sParentRect.bottom - sParentRect.top,
                        hWnd,     // parent
                        NULL,         // Menu
                        GetWindowInstance(hWnd), // hInstance
                        NULL);            // creation param
    if (hNW == NULL)
    {
            MessageBox (NULL, "Error : Can't create temporary window", szAppli, MB_OK | MB_ICONSTOP);
            return NULL;
    }
    // start background task
    PostMessage (hNW, wMessage, 0, 0);
return hNW;
} //CreateBckgWindow
示例#16
0
static void SubClassMDIBegin (LPOLDGLOBALS lp)
{
 FARPROC  lpfnNewFarProc;
 HANDLE   hInst;
 hInst = GetWindowInstance(GetParent (lp->hWnd));
 lpfnNewFarProc = MakeProcInstance ((FARPROC) CallBack, hInst);
 lp->lpfnOldFarProc = (FARPROC) SetWindowLong (lp->hWnd,GWL_WNDPROC,(long) lpfnNewFarProc);
}
示例#17
0
//////////////////////////////////////////////////////////////////////////
// MSG Functions
BOOL OnCreate( HWND hwnd, LPCREATESTRUCT lpct )
{
	HINSTANCE hInstance = GetWindowInstance(hwnd);
	//load res
	//...

	return TRUE;
}
示例#18
0
CPuzzle::CPuzzle(HWND hWindow, HPALETTE hPal)
/***********************************************************************/
{
	STRING szString; 
	HWND hItem;

	m_hWnd = hWindow;
	m_pDib = NULL;
	m_iRows = 4;
	m_iCols = 4;
	m_iSelect = -1;
	m_szDibFile[0] = '\0';
	m_bTrack = FALSE;
	m_bInRect = FALSE;
	m_hPal = hPal;
	m_idResource = GetDlgCtrlID(m_hWnd) + 1;
	m_bHintMode = FALSE;

	GetWindowText(hWindow, szString, sizeof(szString));
	m_lpSwitches = ExtractSwitches(szString);

	#ifdef UNUSED
	GetModuleFileName(GetWindowInstance(hWindow), szFileName, sizeof(szFileName));
	StripFile(szFileName);

 	if (GetStringParm(szString, 0, ',', szFile))
 	{
 		lstrcpy(m_szDibFile, szFileName);
 		lstrcat(m_szDibFile, szFile);
 	}
	if (lstrlen(m_szDibFile))
	#endif

	HWND hParent = GetParent(m_hWnd);
	hItem = GetDlgItem(hParent, m_idResource);
	if (hItem)
	{
		GetWindowText(hItem, m_szDibFile, sizeof(m_szDibFile));
	    m_pDib = CDib::LoadDibFromFile( m_szDibFile, m_hPal, FALSE, TRUE );
	}
	else
	    m_pDib = CDib::LoadDibFromResource( GetWindowInstance(m_hWnd), MAKEINTRESOURCE(m_idResource), m_hPal, FALSE, TRUE );
	if (m_pDib)
		Setup();
}
示例#19
0
static void PASCAL FillListBox(HWND hDlg,HWND hMdi)
{
  FARPROC lpEnum;
  ENUMDATA data;
  data.hDlg = hDlg;
  data.hmdi = GetProp(hDlg,gsPropName);
  lpEnum=MakeProcInstance ((FARPROC)EnumMDIChild,GetWindowInstance(hDlg));
  EnumChildWindows(hMdi,lpEnum,(LPARAM)&data);
  FreeProcInstance (lpEnum);
}
示例#20
0
文件: Menucmds.c 项目: atrniv/CLIPS
BOOL DoCommandCompletion(
  HWND hwnd,
  char *buffer,
  int fromEditor)
  {
   unsigned int numberOfMatches = 0;
   int RtnValue = TRUE;
   unsigned int commonPrefixLength = 0;
   DLGPROC theDlgProc;
     
   //HorizScroll = 1; ???
   GlobalMatches = FindSymbolMatches(GetCurrentEnvironment(),buffer,&numberOfMatches,
                                            &commonPrefixLength);

   switch (numberOfMatches)
     {  
      case 0:
        CompleteString[0] = '\0';
        MessageBeep(0);
        RtnValue = FALSE;
        break;

      case 1:
        strncpy(CompleteString,(GlobalMatches->match->contents),255);
        break;

      default:
        /* Option from Preferences */
        if (fromEditor && (! Complete))
          {  
           MessageBeep(0);
           return (FALSE);
          }

        theDlgProc = MakeProcInstance((DLGPROC) CommandComplete,GetWindowInstance(hwnd));
        if (DialogBoxParam((HINSTANCE) GetWindowInstance(hwnd),"List_Manager", hwnd, theDlgProc,(LPARAM)buffer) == IDC_CANCEL)
          { RtnValue = FALSE; }
     }  

   ReturnSymbolMatches(GetCurrentEnvironment(),GlobalMatches);
   
   return (RtnValue);
  }
示例#21
0
LOCAL BOOL SetupMeterControlInfo(HWND hControl, LPINT lpDX, LPINT lpDY)
/***********************************************************************/
{
    ITEMID idControl;
    LPBITMAPINFO lpDIB;
    HGLOBAL hResource;

    LPMETERCONTINFO lpInfo;
    if (!(lpInfo = (LPMETERCONTINFO)GetWindowLong(hControl, GWL_DATAPTR) ) )
        return FALSE;

    if (!(idControl = GetWindowWord(hControl, GWW_ICONID)))
        idControl = GET_WINDOW_ID(hControl);

    if (!(hResource = (HGLOBAL)FindResource(GetWindowInstance(hControl),
                                            MAKEINTRESOURCE(idControl), RT_BITMAP) ) )
        return(FALSE);

    if (!(hResource = LoadResource(GetWindowInstance (hControl), (HRSRC)hResource) ) )
        return (FALSE);

    if (! (lpDIB = (LPBITMAPINFO)LockResource (hResource) ) )
        return (FALSE);

    // Make sure that the DIB is uncompressed
    if (lpDX)
        * lpDX = (int)lpDIB->bmiHeader.biWidth;
    if (lpDY)
        * lpDY = (int)abs (lpDIB->bmiHeader.biHeight);

    // Set up the DIB rectangle
    if (lpInfo)
    {
        lpInfo->rBitmap.top = 0;
        lpInfo->rBitmap.left = 0;
        lpInfo->rBitmap.right = lpInfo->rBitmap.left + (int)lpDIB->bmiHeader.biWidth;
        lpInfo->rBitmap.bottom = lpInfo->rBitmap.top + (int)abs(lpDIB->bmiHeader.biHeight);
    }

    UnlockResource (hResource);
    FreeResource (hResource);
    return (TRUE);
}
示例#22
0
BOOL gOnCreate(HWND hwnd, LPCREATESTRUCT lpcs)
{
  HINSTANCE hInstance = GetWindowInstance(hwnd);
  int i;
  for(i=0;i<7;i++)
    {
      hbm[i] = LoadBitmap(hInstance,MAKEINTRESOURCE(bmid[i]));
    }
  return TRUE;
}
示例#23
0
		static void guiOnSize(HWND hwnd, UINT state, int cx, int cy)
		{
			int cy_console, cy_edge, cx_edge, cy_frame, cy_status;

			if (state == SIZE_MINIMIZED) {
				NOTIFYICONDATA dta;

				dta.cbSize = sizeof(NOTIFYICONDATA);
				dta.hWnd = hwnd;
				dta.uID = IDI_TRAY;
				dta.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
				dta.uCallbackMessage = WM_SHELLNOTIFY;
				dta.hIcon = LoadIcon(GetWindowInstance(hwnd), MAKEINTRESOURCE(IDI_ICON1));
				strcpy(dta.szTip, "PvPGN");
				strcat(dta.szTip, " ");
				strcat(dta.szTip, PVPGN_VERSION);
				Shell_NotifyIcon(NIM_ADD, &dta);
				ShowWindow(hwnd, SW_HIDE);
				return;
			}

			if (state == SIZE_RESTORED) {
				NOTIFYICONDATA dta;

				dta.hWnd = hwnd;
				dta.uID = IDI_TRAY;
				Shell_NotifyIcon(NIM_DELETE, &dta);
			}

			cy_status = 0;
			cy_edge = GetSystemMetrics(SM_CYEDGE);
			cx_edge = GetSystemMetrics(SM_CXEDGE);
			cy_frame = (cy_edge << 1) + GetSystemMetrics(SM_CYBORDER) + 1;
			cy_console = ((cy - cy_status - cy_frame - cy_edge * 2)*gui.y_ratio) >> 10;
			gui.rectConsoleEdge.left = 0;
			gui.rectConsoleEdge.right = cx - 140;
			gui.rectConsoleEdge.top = 0;
			gui.rectConsoleEdge.bottom = cy - cy_status;
			gui.rectConsole.left = cx_edge;
			gui.rectConsole.right = cx - 140 - cx_edge;
			gui.rectConsole.top = cy_edge;
			gui.rectConsole.bottom = cy - cy_status;
			gui.rectUsersEdge.left = cx - 140;
			gui.rectUsersEdge.top = 18;
			gui.rectUsersEdge.right = cx;
			gui.rectUsersEdge.bottom = cy - cy_status - 10;
			gui.rectUsers.left = cx - 138;
			gui.rectUsers.right = cx;
			gui.rectUsers.top = 18 + cy_edge;
			gui.rectUsers.bottom = cy - cy_status - 20;
			guiMoveWindow(ghwndConsole, &gui.rectConsole);
			guiMoveWindow(gui.hwndUsers, &gui.rectUsers);
			MoveWindow(gui.hwndUserCount, cx - 140, 0, 140, 18, TRUE);
			MoveWindow(gui.hwndUserEditButton, cx - 140, cy - cy_status - 20, 140, 20, TRUE);
		}
示例#24
0
文件: Text.c 项目: atrniv/CLIPS
static BOOL PrintFile(
  HWND hWnd)
  {
   char title[128];

   GetWindowText(hWnd,title,127);

   PrintWindowDriver(GetWindowInstance(hMainFrame),hWnd,title);

   return(TRUE);
  }
示例#25
0
文件: httpmt.c 项目: Budskii/ulib-win
void LogWinSockError(HWND hwnd, LPCSTR lpText, int nErrorCode)
{
	char szBuf[256];

	szBuf[0] = '\0';
	LoadString(GetWindowInstance(hwnd),
			   nErrorCode,
			   szBuf,
			   sizeof(szBuf));
	LogEvent(hwnd, "%s : %s", lpText, szBuf);
}
示例#26
0
文件: Text.c 项目: atrniv/CLIPS
/****************************************************************************
*                               text_QueryClose
* Inputs:
*       HWND hwnd: Window handle
* Result: BOOL
*       TRUE if window can close
*	FALSE if it can't
* Effect: 
*       If there is a change in the edit control, pops up a message box
*	asking for confirmation.
****************************************************************************/
int text_QueryClose(
  HWND hwnd)
  {
   BOOL modified = Edit_GetModify(GetDlgItem(hwnd,ID_EDIT_CONTROL));
   TCHAR caption[256];
   TCHAR changed[256];

   if (! modified)
	 { return IDNO; }
	 
   VERIFY(LoadString(GetWindowInstance(hwnd), IDS_SAVE_CHANGES_CAPTION,
     				caption, DIM(caption)));
   VERIFY(LoadString(GetWindowInstance(hwnd), IDS_SAVE_CHANGES,
     				changed, DIM(changed)));

   // We use a more general structure here so that in the future, we
   // could issue a box that said "Save changes [Yes][No][Cancel]" and
   // do a multiway branch based on the three possible return values.

   return (MessageBox(hwnd, changed, caption, MB_ICONSTOP | MB_YESNOCANCEL));
  }
示例#27
0
文件: window.c 项目: luoxiaobing/tftp
/* ------------------------------------------------- */
int  OpenNewDialogBox ( HWND        hParentWnd,
                        DWORD       dwDlgBox,
                        DLGPROC     lpProc,
                        LPARAM      lParam,
                        HINSTANCE   hInstance)
{
int       Rc;
  if (hInstance == NULL)  hInstance = GetWindowInstance (hParentWnd);
     Rc = (int) DialogBoxParam (hInstance,
								MAKEINTRESOURCE (dwDlgBox),
								hParentWnd,
								lpProc,
								lParam);
return Rc;
} /* OpenNewDialogBox */
示例#28
0
//////////////////////////////////////////////////
// manage drop down menu
int DhcpServerListPopup (HWND hListV)
{
POINT pt;
HMENU hMenu;
int iSelected;

    // retrieve selected item
    iSelected = ListView_GetNextItem (hListV, -1, LVNI_FOCUSED);
    if (iSelected == -1) return TRUE;

    hMenu = LoadMenu(GetWindowInstance (hListV), MAKEINTRESOURCE (IDM_DHCP_LIST));
    GetCursorPos (&pt);
    TrackPopupMenu (GetSubMenu (hMenu, 0), TPM_LEFTALIGN | TPM_LEFTBUTTON,
                    pt.x, pt.y, 0, GetParent (hListV), NULL);
    DestroyMenu (hMenu);
return TRUE;
} // DhcpServerListPopup
示例#29
0
文件: xtapi.c 项目: btb/d2x
int xtapi_init(char *appname, int *numdevs)
{
	LONG retval;
	BOOL reinit;

	if (TapiObj.hObj) return XTAPI_SUCCESS;
	
	TapiObj.hWnd = GetLibraryWindow();

	reinit = TRUE;								// Allow for reinitialization

	while (1)
	{
		retval = lineInitialize(&TapiObj.hObj, 
						GetWindowInstance(TapiObj.hWnd),
						tapi_callback, 
						appname, 
						&TapiObj.num_devs);
		
		if (!retval) {
			break;
		}
		else if (retval == LINEERR_REINIT) {
			if (reinit)  {
				timer_delay(0x50000);		// delay 5 seconds 
				reinit = FALSE;
			}
			else {
				return XTAPI_APPCONFLICT;	// another app is using tapi resources we need
			}
		}
		else if (retval == LINEERR_NODEVICE) {
			return XTAPI_NODEVICES;			// should tell user to install a modem
		}
		else return XTAPI_GENERAL_ERR;
	}

	*numdevs = (int)TapiObj.num_devs;
	
	TapiDev.valid = FALSE;

	return XTAPI_SUCCESS;
}
示例#30
0
		static void OnSize(HWND hwnd, UINT state, int cx, int cy)
		{
			if (state == SIZE_MINIMIZED)
			{
				NOTIFYICONDATAW dta = {};
				dta.cbSize = sizeof(NOTIFYICONDATAW);
				dta.hWnd = hwnd;
				dta.uID = ID_TRAY;
				dta.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
				dta.uCallbackMessage = WM_SHELLNOTIFY;
				dta.hIcon = LoadIconW(GetWindowInstance(hwnd), MAKEINTRESOURCEW(ID_ICON1));
				std::swprintf(dta.szTip, sizeof dta.szTip / sizeof *dta.szTip, L"D2CS Version " D2CS_VERSION_STRING);

				Shell_NotifyIconW(NIM_ADD, &dta);
				ShowWindow(hwnd, SW_HIDE);
				return;
			}

			MoveWindow(ghwndConsole, 0, 0, cx, cy, TRUE);
		}