当前位置: 首页>>代码示例>>C++>>正文


C++ DefWindowProcA函数代码示例

本文整理汇总了C++中DefWindowProcA函数的典型用法代码示例。如果您正苦于以下问题:C++ DefWindowProcA函数的具体用法?C++ DefWindowProcA怎么用?C++ DefWindowProcA使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DefWindowProcA函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Win32MainWindowCallback

internal LRESULT CALLBACK Win32MainWindowCallback(HWND Window, UINT Message, WPARAM WParam, LPARAM LParam) {
	LRESULT Result = 0;

	switch (Message) {
	case WM_DESTROY: {
		// TODO: handle this as an error - recreate window?
		GlobalRunning = false;
	} break;

	case WM_CLOSE: {
		// TODO: handle this with a message to the user?
		GlobalRunning = false;
	} break;

	case WM_SETCURSOR: {
		if (DEBUGGlobalShowCursor) {
			Result = DefWindowProcA(Window, Message, WParam, LParam);
		}
		else {
			SetCursor(0);
		}
	} break;

	case WM_ACTIVATEAPP: {
#if 0
		if (WParam) {
			SetLayeredWindowAttributes(Window, RGB(0, 0, 0), 255, LWA_ALPHA);
		}
		else {
			SetLayeredWindowAttributes(Window, RGB(0, 0, 0), 64, LWA_ALPHA);
		}
#endif
	} break;

	case WM_PAINT: {
		PAINTSTRUCT Paint;
		HDC DeviceContext = BeginPaint(Window, &Paint);
		win32_window_dimension Dimension = Win32GetWindowDimension(Window);
		Win32DisplayBufferInWindow(&GlobalBackbuffer, DeviceContext, Dimension.Width, Dimension.Height);
		EndPaint(Window, &Paint);
	} break;

	case WM_SYSKEYDOWN:
	case WM_SYSKEYUP:
	case WM_KEYDOWN:
	case WM_KEYUP: {
		Assert(!"Keyboard input came in through a non-dispatch message!");
	} break;

	default: {
		// OutputDebugStringA("default\n");
		Result = DefWindowProcA(Window, Message, WParam, LParam);
	} break;
	}

	return(Result);
}
开发者ID:matthewrees,项目名称:handmade-hero,代码行数:57,代码来源:win32_handmade.cpp

示例2: ImeWndProc_common

LRESULT WINAPI ImeWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode ) // ReactOS
{
    PWND pWnd;
    PIMEUI pimeui;

    pWnd = ValidateHwnd(hwnd);
    if (pWnd)
    {
       if (!pWnd->fnid)
       {
          if (msg != WM_NCCREATE)
          {
             if (unicode)
                return DefWindowProcW(hwnd, msg, wParam, lParam);
             return DefWindowProcA(hwnd, msg, wParam, lParam);
          }
          NtUserSetWindowFNID(hwnd, FNID_IME);
          pimeui = HeapAlloc( GetProcessHeap(), 0, sizeof(IMEUI) );
          SetWindowLongPtrW(hwnd, 0, (LONG_PTR)pimeui);
       }
       else
       {
          if (pWnd->fnid != FNID_IME)
          {
             ERR("Wrong window class for Ime! fnId 0x%x\n",pWnd->fnid);
             return 0;
          }
          pimeui = ((PIMEWND)pWnd)->pimeui;
          if (pimeui == NULL)
          {
             ERR("Window is not set to IME!\n");
             return 0;
          }
       }
    }

    if (msg==WM_CREATE || msg==WM_NCCREATE)
        return TRUE;

    if (msg==WM_NCDESTROY)
    {
        HeapFree( GetProcessHeap(), 0, pimeui );
        SetWindowLongPtrW(hwnd, 0, 0);
        NtUserSetWindowFNID(hwnd, FNID_DESTROY);
    }

    if (unicode)
       return DefWindowProcW(hwnd, msg, wParam, lParam);
    return DefWindowProcA(hwnd, msg, wParam, lParam);
}
开发者ID:Moteesh,项目名称:reactos,代码行数:50,代码来源:imm.c

示例3: GlobalOnEvent

////////////////////////////////////////////////////////////
/// Function called whenever one of our windows receives a message
////////////////////////////////////////////////////////////
static LRESULT CALLBACK GlobalOnEvent(HWND Handle, UINT Message, WPARAM WParam, LPARAM LParam)
{
    // Associate handle and Window instance when the creation message is received
    if (Message == WM_CREATE)
    {
        // Get instance (it was passed as the last argument of CreateWindow)
        LONG Instance = (LONG)((CREATESTRUCT *)LParam)->lpCreateParams;

        // Set as the "user data" parameter of the window
        SetWindowLongPtr(Handle, GWLP_USERDATA, Instance);
    }

    // Forward the event to the appropriate function
	if (WindowhWnd)
	{
		ProcessEvent(Message, WParam, LParam);
		
		if (WindowCallback)
			return CallWindowProc((WNDPROC)(WindowCallback), Handle, Message, WParam, LParam);
	}

    // We don't forward the WM_CLOSE message to prevent the OS from automatically destroying the window
    if (Message == WM_CLOSE)
        return 0;

    return HasUnicodeSupport() ? DefWindowProcW(Handle, Message, WParam, LParam) :
								 DefWindowProcA(Handle, Message, WParam, LParam);
}
开发者ID:jordanfin,项目名称:aoc,代码行数:31,代码来源:Window.c

示例4: parent_wnd_proc

static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
    static LONG defwndproc_counter = 0;
    LRESULT ret;
    struct message msg;

    /* log system messages, except for painting */
    if (message < WM_USER &&
        message != WM_PAINT &&
        message != WM_ERASEBKGND &&
        message != WM_NCPAINT &&
        message != WM_NCHITTEST &&
        message != WM_GETTEXT &&
        message != WM_GETICON &&
        message != WM_DEVICECHANGE)
    {
        trace("parent: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam);

        msg.message = message;
        msg.flags = sent|wparam|lparam;
        if (defwndproc_counter) msg.flags |= defwinproc;
        msg.wParam = wParam;
        msg.lParam = lParam;
        msg.id = 0;
        add_message(sequences, PARENT_SEQ_INDEX, &msg);
    }

    defwndproc_counter++;
    ret = DefWindowProcA(hwnd, message, wParam, lParam);
    defwndproc_counter--;

    return ret;
}
开发者ID:acousticpants,项目名称:wine,代码行数:32,代码来源:trackbar.c

示例5: child_proc

static LRESULT WINAPI child_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    static LONG defwndproc_counter;
    struct message msg = { 0 };
    LRESULT ret;

    msg.message = message;
    msg.flags = sent | wparam | lparam;
    if (defwndproc_counter)
        msg.flags |= defwinproc;
    msg.wParam = wParam;
    msg.lParam = lParam;

    if (hwnd == child1_wnd)
        msg.id = CHILD1_ID;
    else if (hwnd == child2_wnd)
        msg.id = CHILD2_ID;
    else
        msg.id = 0;

    add_message(sequences, PAGER_SEQ_INDEX, &msg);

    defwndproc_counter++;
    ret = DefWindowProcA(hwnd, message, wParam, lParam);
    defwndproc_counter--;

    return ret;
}
开发者ID:AndreRH,项目名称:wine,代码行数:28,代码来源:pager.c

示例6: WndProc

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
	if (message == WM_CLOSE) {
		mAppRunning = false;
	}
	
	return DefWindowProcA(hWnd, message, wParam, lParam);
}
开发者ID:smsquare,项目名称:VGP363-CGProgrammingModeling,代码行数:7,代码来源:Main.cpp

示例7: SetWindowLongPtr

////////////////////////////////////////////////////////////
/// Function called whenever one of our windows receives a message
////////////////////////////////////////////////////////////
LRESULT CALLBACK WindowImplWin32::GlobalOnEvent(HWND Handle, UINT Message, WPARAM WParam, LPARAM LParam)
{
    // Associate handle and Window instance when the creation message is received
    if (Message == WM_CREATE)
    {
        // Get WindowImplWin32 instance (it was passed as the last argument of CreateWindow)
        long This = reinterpret_cast<long>(reinterpret_cast<CREATESTRUCT*>(LParam)->lpCreateParams);

        // Set as the "user data" parameter of the window
        SetWindowLongPtr(Handle, GWLP_USERDATA, This);
    }

    // Get the WindowImpl instance corresponding to the window handle
    WindowImplWin32* Window = reinterpret_cast<WindowImplWin32*>(GetWindowLongPtr(Handle, GWLP_USERDATA));

    // Forward the event to the appropriate function
    if (Window)
    {
        Window->ProcessEvent(Message, WParam, LParam);

        if (Window->myCallback)
            return CallWindowProc(reinterpret_cast<WNDPROC>(Window->myCallback), Handle, Message, WParam, LParam);
    }

    // We don't forward the WM_CLOSE message to prevent the OS from automatically destroying the window
    if (Message == WM_CLOSE)
        return 0;

    static const bool HasUnicode = HasUnicodeSupport();
    return HasUnicode ? DefWindowProcW(Handle, Message, WParam, LParam) :
                        DefWindowProcA(Handle, Message, WParam, LParam);
}
开发者ID:Aiscky,项目名称:Zappy,代码行数:35,代码来源:WindowImplWin32.cpp

示例8: MCIWndProc

static LRESULT WINAPI	MCIWndProc(HWND hWnd, UINT wMsg, WPARAM lParam1, LPARAM lParam2)
{
   MCIWndInfo*	mwi = (MCIWndInfo*)GetWindowLongA(hWnd, 0);

   if (mwi || wMsg == WM_CREATE) {
      switch (wMsg) {
      case WM_CREATE:
	 MCIWND_Create(hWnd, (CREATESTRUCTA*)lParam2);
	 return 0;
      case WM_DESTROY:
	 MCIWND_Close(mwi);
	 HeapFree(GetProcessHeap(), 0, mwi->lpName);
	 HeapFree(GetProcessHeap(), 0, mwi);
	 break;
      case WM_PAINT:
	 MCIWND_Paint(mwi, lParam1);
	 break;
      case WM_COMMAND:
	 return MCIWND_Command(mwi, lParam1, lParam2);
      case WM_TIMER:
	 MCIWND_Timer(mwi, lParam1, lParam2);
	 return TRUE;
      }
   }

   return DefWindowProcA(hWnd, wMsg, lParam1, lParam2);
}
开发者ID:NVIDIA,项目名称:winex_lgpl,代码行数:27,代码来源:mciwnd.c

示例9: parentWindowProcess

static LRESULT WINAPI parentWindowProcess(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    static LONG defwndproc_counter = 0;
    LRESULT ret;
    struct message msg;

    /* do not log painting messages */
    if (message != WM_PAINT &&
        message != WM_ERASEBKGND &&
        message != WM_NCPAINT &&
        message != WM_NCHITTEST &&
        message != WM_GETTEXT &&
        message != WM_GETICON &&
        message != WM_DEVICECHANGE)
    {
        trace("parent: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam);

        msg.message = message;
        msg.flags = sent|wparam|lparam;
        if (defwndproc_counter) msg.flags |= defwinproc;
        msg.wParam = wParam;
        msg.lParam = lParam;
        add_message(sequences, PARENT_SEQ_INDEX, &msg);
    }

    /* dump sent structure data */
    if (message == WM_DRAWITEM)
        g_drawitem = *(DRAWITEMSTRUCT*)lParam;

    defwndproc_counter++;
    ret = DefWindowProcA(hwnd, message, wParam, lParam);
    defwndproc_counter--;

    return ret;
}
开发者ID:carlosbislip,项目名称:wine,代码行数:35,代码来源:tab.c

示例10: MainWindowCallback

internal LRESULT CALLBACK
MainWindowCallback(HWND Window,
                   UINT Message,
                   WPARAM wParam,
                   LPARAM lParam)
{
    LRESULT Result = 0;

    switch(Message)
    {
    case WM_CLOSE:
    case WM_DESTROY:
    {
        GlobalRunning = false;
    }
    break;
    default:
    {
        Result = DefWindowProcA(Window, Message, wParam, lParam);
    }
    break;
    }

    return Result;
}
开发者ID:sggrissom,项目名称:SimpleOpenGL,代码行数:25,代码来源:win32.cpp

示例11: WndProc

static LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
    if(msg == WM_MOUSEMOVE)
        results[test_no].mouse_move_called++;

    return DefWindowProcA( hWnd, msg, wParam, lParam );
}
开发者ID:mutoso-mirrors,项目名称:reactos,代码行数:7,代码来源:SetCursorPos.c

示例12: win32_window_callback

static LRESULT CALLBACK
win32_window_callback(HWND window, UINT message, WPARAM wp, LPARAM lp)
{
    switch (message) {
        case WM_KEYDOWN: {
            CORE->key_modifiers = win32_app_key_mods();
            if (wp < KEYS_MAX) {
                CORE->key_states[wp] = 1;
                CORE->key_deltas[wp] = 1;
                // printf("key pressed: %d\n", wp);
            }
            return 0;
        }
            break;

        case WM_KEYUP: {
            CORE->key_modifiers = win32_app_key_mods();
            if (wp < KEYS_MAX) {
                CORE->key_states[wp] = 0;
                CORE->key_deltas[wp] = 1;
                // printf("key released: %d\n", wp);
            }
            return 0;
        }
            break;

        case WM_CLOSE: {
            PostQuitMessage(0);
            CORE->running = 0;
        }
            break;
    }

    return DefWindowProcA(window, message, wp, lp);
}
开发者ID:gingerBill,项目名称:LD35,代码行数:35,代码来源:punity.c

示例13: test_notify_parent_proc

static LRESULT WINAPI test_notify_parent_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
   switch(msg)
   {
       case WM_NOTIFY:
       {
           NMHDR *hdr = ((LPNMHDR)lParam);
           switch(hdr->code)
           {
               case NM_DBLCLK: g_got_dblclk = TRUE; break;
               case NM_CLICK: g_got_click = TRUE; break;
               case NM_RDBLCLK: g_got_rdblclk = TRUE; break;
               case NM_RCLICK: g_got_rclick = TRUE; break;
           }

           /* Return zero to indicate default processing */
           return 0;
       }

       case WM_CONTEXTMENU: g_got_contextmenu = TRUE; return 0;

       default:
            return( DefWindowProcA(hwnd, msg, wParam, lParam));
   }

   return 0;
}
开发者ID:MichaelMcDonnell,项目名称:wine,代码行数:27,代码来源:status.c

示例14: OwnerWndProc

static LRESULT CALLBACK OwnerWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    if(msg == ID_FINDMSGSTRING) {
        return handle_findmsg((FINDREPLACEA*)lParam);
    }
    return DefWindowProcA(hwnd, msg, wParam, lParam);
}
开发者ID:GYGit,项目名称:reactos,代码行数:7,代码来源:finddlg.c

示例15: main_window_procA

static LRESULT CALLBACK main_window_procA (HWND hwnd, UINT uiMsg, WPARAM wParam,
        LPARAM lParam)
{
    switch (uiMsg)
    {
        /* Add blank case statements for these to ensure we don't use them
         * by mistake.
         */
        case DM_GETDEFID: break;
        case DM_SETDEFID: break;

        case WM_CREATE:
            return (OnMainWindowCreate (hwnd,
                    (LPCREATESTRUCTA) lParam) ? 0 : (LRESULT) -1);
        case WM_COMMAND:
            if (wParam == IDCANCEL)
            {
                g_terminated = TRUE;
                return 0;
            }
            break;
    }

    return DefWindowProcA (hwnd, uiMsg, wParam, lParam);
}
开发者ID:MichaelMcDonnell,项目名称:wine,代码行数:25,代码来源:dialog.c


注:本文中的DefWindowProcA函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。