本文整理汇总了C++中UpdateWindow函数的典型用法代码示例。如果您正苦于以下问题:C++ UpdateWindow函数的具体用法?C++ UpdateWindow怎么用?C++ UpdateWindow使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UpdateWindow函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WinMain
/* NOTES:
* For Win16, programmers generally use WINAPI WinMain(...) but WINAPI is defined in such a way
* that it always makes the function prolog return FAR. Unfortunately, when Watcom C's runtime
* calls this function in a memory model that's compact or small, the call is made as if NEAR,
* not FAR. To avoid a GPF or crash on return, we must simply declare it PASCAL instead. */
int PASCAL WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow) {
WNDCLASS wnd;
MSG msg;
myInstance = hInstance;
#if TARGET_MSDOS == 16 && TARGET_WINDOWS < 31 /* Windows 3.0 or older (any version capable of real-mode) */
/* our data segment is discardable.
* in Windows 3.0 real mode that means our data segment can disappear out from under us.
* unfortunately I don't know how to call the data segment back in.
* so we have to compensate by locking our data segment in place. */
LockData();
#endif
/* FIXME: Windows 3.0 Real Mode: Why are we unable to load our own Application Icon? */
AppIcon = LoadIcon(hInstance,MAKEINTRESOURCE(IDI_APPICON));
if (!AppIcon) MessageBox(NULL,"Unable to load app icon","Oops!",MB_OK);
#ifdef WIN16_NEEDS_MAKEPROCINSTANCE
WndProc_MPI = MakeProcInstance((FARPROC)WndProc,hInstance);
#endif
/* NTS: In the Windows 3.1 environment all handles are global. Registering a class window twice won't work.
* It's only under 95 and later (win32 environment) where Windows always sets hPrevInstance to 0
* and window classes are per-application.
*
* Windows 3.1 allows you to directly specify the FAR pointer. Windows 3.0 however demands you
* MakeProcInstance it to create a 'thunk' so that Windows can call you (ick). */
if (!hPrevInstance) {
wnd.style = CS_HREDRAW|CS_VREDRAW;
#ifdef WIN16_NEEDS_MAKEPROCINSTANCE
wnd.lpfnWndProc = (WNDPROC)WndProc_MPI;
#else
wnd.lpfnWndProc = WndProc;
#endif
wnd.cbClsExtra = 0;
wnd.cbWndExtra = 0;
wnd.hInstance = hInstance;
wnd.hIcon = AppIcon;
wnd.hCursor = NULL;
wnd.hbrBackground = NULL;
wnd.lpszMenuName = NULL;
wnd.lpszClassName = WndProcClass;
if (!RegisterClass(&wnd)) {
MessageBox(NULL,"Unable to register Window class","Oops!",MB_OK);
return 1;
}
}
HelloMsg();
hwndMain = CreateWindow(WndProcClass,"Hello!",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,CW_USEDEFAULT,
300,200,
NULL,NULL,
hInstance,NULL);
if (!hwndMain) {
MessageBox(NULL,"Unable to create window","Oops!",MB_OK);
return 1;
}
ShowWindow(hwndMain,nCmdShow);
UpdateWindow(hwndMain); /* FIXME: For some reason this only causes WM_PAINT to print gibberish and cause a GPF. Why? And apparently, Windows 3.0 repaints our window anyway! */
while (GetMessage(&msg,NULL,0,0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
#if TARGET_MSDOS == 16
/* Win16 only:
* If we are the owner (the first instance that registered the window class),
* then we must reside in memory until we are the last instance resident.
* If we do not do this, then if multiple instances are open and the user closes US
* before closing the others, the others will crash (having pulled the code segment
* behind the window class out from the other processes). */
if (!hPrevInstance) {
while (GetModuleUsage(hInstance) > 1) {
PeekMessage(&msg,NULL,0,0,PM_REMOVE);
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
#endif
return msg.wParam;
}
示例2: CreateThreadActiveX
DWORD __stdcall CreateThreadActiveX(IN void* pParam)
{
static TCHAR szAppName[] = TEXT ("HelloWin") ;
MSG msg ;
WNDCLASS wndclass ;
HWND hwnd ;
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = g_hInstance ;
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = szAppName ;
//HWND hq=FindWindow(TEXT("Chrome_WidgetWin_100"),NULL);
HWND hwndChrome=FindWindow(TEXT("Chrome_WidgetWin_1"),0);
hwndChrome=GetParent(hwndChrome); // ¸¸´°¿Ú
if (!RegisterClass (&wndclass))
{
MessageBox (NULL, TEXT ("This program requires Windows NT!"),
szAppName, MB_ICONERROR) ;
return 0 ;
}
hwnd = CreateWindow (szAppName, // window class name
TEXT ("The Hello Program"), // window caption
WS_CHILDWINDOW,//WS_POPUP|WS_EX_TOOLWINDOW,//WS_OVERLAPPEDWINDOW, // window style
200, // initial x position
200, // initial y position
400, // initial x size
40, // initial y size
//CW_USEDEFAULT, // initial x position
//CW_USEDEFAULT, // initial y position
hwndChrome, // parent window handle
NULL, // window menu handle
g_hInstance, // program instance handle
NULL) ; // creation parameters
AtlAxWinInit();
CoInitialize(NULL);
// The window is attached; act appropriately
if(hwnd)
{
CAxWindow wnd;
CLSID clsid;
LPUNKNOWN pUnkCtrl, pUnkCont;
IDispatch* pIDsp=NULL;
HRESULT hr =::CLSIDFromString(L"{ED75F074-4A89-40B3-844C-B28281C3FD8E}",&clsid);
hr = CoCreateInstance(clsid, NULL, CLSCTX_ALL, IID_IUnknown,
(void**)&pUnkCtrl);
CComQIPtr <IPersistStreamInit> spPerStm(pUnkCtrl);
spPerStm->InitNew();
wnd.Attach(hwnd);
wnd.AttachControl(pUnkCtrl, &pUnkCont);
wnd.QueryControl(IID_IDispatch, (void**)&pIDsp);
}
ShowWindow (hwnd, SW_SHOW) ;
UpdateWindow (hwnd) ;
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
::CoUninitialize();
return msg.wParam;
}
示例3: InitWindowsApp
bool InitWindowsApp(HINSTANCE instanceHandle, int show)
{
//ShowCursor(0);
// The first task to creating a window is to describe some of its
// characteristics by filling out a WNDCLASS structure.
WNDCLASS wc;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = instanceHandle;
wc.hIcon = LoadIcon(0, IDI_APPLICATION);
wc.hCursor = LoadCursor(0, IDC_CROSS);
wc.hbrBackground = (HBRUSH)GetStockObject(NULL_BRUSH);
wc.lpszMenuName = 0;
wc.lpszClassName = L"BasicWndClass";
// Next, we register this WNDCLASS instance with Windows so that we can
// create a window based on it.
if(!RegisterClass(&wc))
{
MessageBox(0, L"RegisterClass FAILED", 0, 0);
return false;
}
// With our WNDCLASS instance registered, we can create a window with the
// CreateWindow function. This function returns a handle to the window it
// creates (an HWND). If the creation failed, the handle will have the value
// of zero. A window handle is a way to refer to the window, which is internally
// managed by Windows. Many of the Win32 API functions that operate on windows
// require an HWND so that they know what window to act on.
RECT rc;
rc.left = 0;
rc.top = 0;
rc.right = SCREEN_WIDTH;
rc.bottom = SCREEN_HEIGHT;
AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, false);
g_Hwnd = CreateWindow(
L"BasicWndClass", // Registered WNDCLASS instance to use.
L"Gruppuppgift", // window title
WS_OVERLAPPEDWINDOW, // style flags
CW_USEDEFAULT, // x-coordinate
CW_USEDEFAULT, // y-coordinate
rc.right - rc.left, // width
rc.bottom - rc.top, // height
0, // parent window
0, // menu handle
instanceHandle, // app instance
0); // extra creation parameters
if(g_Hwnd == 0)
{
MessageBox(0, L"CreateWindow FAILED", 0, 0);
return false;
}
// Even though we just created a window, it is not initially shown.
// Therefore, the final step is to show and update the window we just
// created, which can be done with the following two function calls.
// Observe that we pass the handle to the window we want to show and
// update so that these functions know which window to show and update.
ShowWindow(g_Hwnd, show);
UpdateWindow(g_Hwnd);
//________________________________
// Fill out a DXGI_SWAP_CHAIN_DESC to describe our swap chain.
DXGI_SWAP_CHAIN_DESC sd;
sd.BufferDesc.Width = SCREEN_WIDTH;
sd.BufferDesc.Height = SCREEN_HEIGHT;
sd.BufferDesc.RefreshRate.Numerator = 60;
sd.BufferDesc.RefreshRate.Denominator = 1;
sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
// No multisampling.
sd.SampleDesc.Count = 1;
sd.SampleDesc.Quality = 0;
sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
sd.BufferCount = 1;
sd.OutputWindow = g_Hwnd;
sd.Windowed = true;
sd.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
sd.Flags = 0;
D3D10CreateDeviceAndSwapChain(
0, //default adapter
D3D10_DRIVER_TYPE_HARDWARE,
0, // no software device
0,
D3D10_SDK_VERSION,
&sd,
&mSwapChain,
&md3dDevice);
ID3D10Texture2D* backBuffer;
//.........这里部分代码省略.........
示例4: Invalidate
//背景消息
BOOL CDlgOptionItem::OnEraseBkgnd(CDC * pDC)
{
Invalidate(FALSE);
UpdateWindow();
return TRUE;
}
示例5: WinMain
// Main window program
int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprev, PSTR cmdline, int ishow)
{
HWND hwnd = NULL;
MSG msg = {0};
WNDCLASSEX wndclassex = {0};
// Init fields we care about
wndclassex.cbSize = sizeof(WNDCLASSEX); // Always set to size of WNDCLASSEX
wndclassex.style = CS_HREDRAW | CS_VREDRAW;
wndclassex.lpfnWndProc = WinProc;
wndclassex.hInstance = hinstance;
wndclassex.lpszClassName = kClassName;
wndclassex.hCursor = (HCURSOR)LoadImage(NULL, MAKEINTRESOURCE(IDC_ARROW),
IMAGE_CURSOR, 0, 0, LR_SHARED);
RegisterClassEx(&wndclassex); // Register the WNDCLASSEX
RECT rect = { 0, 0, kWinWid, kWinHgt }; // Desired window client rect
DWORD winStyleEx = WS_EX_CLIENTEDGE;
DWORD winStyle = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME |
WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
// Adjust window rect so it gives us our desired client rect when we
// create the window
AdjustWindowRectEx(&rect, winStyle, false, winStyleEx);
// Create the window
hwnd = CreateWindowEx(winStyleEx, // Window extended style
kClassName,
"www.GameTutorials.com -- D3D Fog",
winStyle, // Window style
CW_USEDEFAULT,
CW_USEDEFAULT,
rect.right - rect.left,
rect.bottom - rect.top,
NULL,
NULL,
hinstance,
NULL);
// Init our global 3D object
if(g3D->init(hwnd) == false)
return EXIT_FAILURE; // There's been an error, lets get out of this joint
// Get the client rect and make sure our client is the size we want
GetClientRect(hwnd, &rect);
assert(rect.right == kWinWid && rect.bottom == kWinHgt);
// We set up our projection matrix once because it will never change
g3D->setProjMatrix(DEG2RAD(60), (float)rect.right / (float)rect.bottom, 1.0f, 8192.0f);
// If we can initialize the fog, exit the application
if(!InitFog())
return EXIT_FAILURE;
ShowCursor(FALSE); // Hide cursor
ShowWindow(hwnd, ishow);
UpdateWindow(hwnd);
// Slam the cursor to the middle of the screen
SetCursorPos(GetSystemMetrics(SM_CXSCREEN) >> 1, GetSystemMetrics(SM_CYSCREEN) >> 1);
// While the app is running...
while(1)
{
if(PeekMessage(&msg,NULL,0,0,PM_REMOVE)) // Handle messages from the OS
{
if(msg.message == WM_QUIT)
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else if(LockFrameRate()) // Otherwise if it's time to draw
{
static float angle = 0; // Angle of rotation
D3DXMATRIX wMat; // World matrix
CameraMouseInput(); // Move camera via the mouse
// Set the world view to the current camera view
g3D->setViewMatrix(gCamera);
g3D->begin(); // Begin drawing
g3D->clear(kFogColor); // Clear the screen to the fog color
// Rotate around the Y-axis
g3D->setWorldMatrix(D3DXMatrixRotationY(&wMat, DEG2RAD(++angle)));
// Draw 4 cubes
DrawCube(CPos(2,0,0), 0.5f, D3DCOLOR_ARGB(255, 255, 0, 0));
DrawCube(CPos(-2,0,0), 0.5f, D3DCOLOR_ARGB(255, 255, 0, 0));
DrawCube(CPos(0,0,2), 0.5f, D3DCOLOR_ARGB(255, 255, 0, 0));
DrawCube(CPos(0,0,-2), 0.5f, D3DCOLOR_ARGB(255, 255, 0, 0));
// Draw the grid
g3D->setWorldMatrix(D3DXMatrixIdentity(&wMat));
DrawGrid(CPos(0,-2,0), 32, D3DCOLOR_ARGB(255, 0, 200, 0));
//.........这里部分代码省略.........
示例6: UpdateWindow
void RadialProgressBar::Reset()
{
progress = 0;
UpdateWindow();
}
示例7: WinMain
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
int result = prepare(lpCmdLine);
if (result == ERROR_ALREADY_EXISTS)
{
HWND handle = getInstanceWindow();
ShowWindow(handle, SW_SHOW);
SetForegroundWindow(handle);
closeLogFile();
return 2;
}
if (result != TRUE)
{
signalError();
return 1;
}
splash = loadBool(SHOW_SPLASH)
&& strstr(lpCmdLine, "--l4j-no-splash") == NULL;
restartOnCrash = loadBool(RESTART_ON_CRASH);
// if we should restart on crash, we must also stay alive to check for crashes
stayAlive = restartOnCrash ||
(loadBool(GUI_HEADER_STAYS_ALIVE)
&& strstr(lpCmdLine, "--l4j-dont-wait") == NULL);
if (splash || stayAlive)
{
hWnd = CreateWindowEx(WS_EX_TOOLWINDOW, "STATIC", "",
WS_POPUP | SS_BITMAP,
0, 0, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
if (splash)
{
char timeout[10] = {0};
if (loadString(SPLASH_TIMEOUT, timeout))
{
splashTimeout = atoi(timeout);
if (splashTimeout <= 0 || splashTimeout > MAX_SPLASH_TIMEOUT)
{
splashTimeout = DEFAULT_SPLASH_TIMEOUT;
}
}
splashTimeoutErr = loadBool(SPLASH_TIMEOUT_ERR)
&& strstr(lpCmdLine, "--l4j-no-splash-err") == NULL;
waitForWindow = loadBool(SPLASH_WAITS_FOR_WINDOW);
HANDLE hImage = LoadImage(hInstance, // handle of the instance containing the image
MAKEINTRESOURCE(SPLASH_BITMAP), // name or identifier of image
IMAGE_BITMAP, // type of image
0, // desired width
0, // desired height
LR_DEFAULTSIZE);
if (hImage == NULL)
{
signalError();
return 1;
}
SendMessage(hWnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM) hImage);
RECT rect;
GetWindowRect(hWnd, &rect);
int x = (GetSystemMetrics(SM_CXSCREEN) - (rect.right - rect.left)) / 2;
int y = (GetSystemMetrics(SM_CYSCREEN) - (rect.bottom - rect.top)) / 2;
SetWindowPos(hWnd, HWND_TOP, x, y, 0, 0, SWP_NOSIZE);
ShowWindow(hWnd, nCmdShow);
UpdateWindow (hWnd);
}
}
do
{
if (splash || stayAlive)
{
if (!SetTimer (hWnd, ID_TIMER, 1000 /* 1s */, TimerProc))
{
signalError();
return 1;
}
}
if (!execute(FALSE, &dwExitCode))
{
signalError();
return 1;
}
if (!(splash || stayAlive))
{
debug("Exit code:\t0\n");
closeProcessHandles();
closeLogFile();
return 0;
}
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
//.........这里部分代码省略.........
示例8: GetWindowRect
void CMenuButton::OnShowMenu()
{
m_bRealMenuIsActive = true;
// Begin CMFCMenuButton::OnShowMenu()
if (m_hMenu == NULL || m_bMenuIsActive)
{
return;
}
CRect rectWindow;
GetWindowRect(rectWindow);
int x, y;
if (m_bRightArrow)
{
x = rectWindow.right;
y = rectWindow.top;
}
else
{
x = rectWindow.left;
y = rectWindow.bottom;
}
if (m_bStayPressed)
{
m_bPushed = TRUE;
m_bHighlighted = TRUE;
}
m_bMenuIsActive = TRUE;
Invalidate();
TPMPARAMS params;
params.cbSize = sizeof(TPMPARAMS);
params.rcExclude = rectWindow;
m_nMenuResult = ::TrackPopupMenuEx(m_hMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_NONOTIFY | TPM_RETURNCMD | TPM_VERTICAL, x, y, GetSafeHwnd(), ¶ms);
CWnd* pParent = GetParent();
#ifdef _DEBUG
if ((pParent->IsKindOf(RUNTIME_CLASS(CDialog))) && (!pParent->IsKindOf(RUNTIME_CLASS(CDialogEx))))
{
TRACE(_T("CMFCMenuButton parent is CDialog, should be CDialogEx for popup menu handling to work correctly.\n"));
}
#endif
if (m_nMenuResult != 0)
{
//-------------------------------------------------------
// Trigger mouse up event(to button click notification):
//-------------------------------------------------------
if (pParent != NULL)
{
pParent->SendMessage(WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), BN_CLICKED), (LPARAM)m_hWnd);
}
}
m_bPushed = FALSE;
m_bHighlighted = FALSE;
m_bMenuIsActive = FALSE;
Invalidate();
UpdateWindow();
if (m_bCaptured)
{
ReleaseCapture();
m_bCaptured = FALSE;
}
// End CMFCMenuButton::OnShowMenu()
m_bRealMenuIsActive = false;
}
示例9: InitInstance
//.........这里部分代码省略.........
g_direct3D = Direct3DCreate9(D3D_SDK_VERSION);
g_params.Windowed = TRUE;
g_params.BackBufferWidth = window_width;
g_params.BackBufferHeight = window_height;
g_params.BackBufferFormat = D3DFMT_A8R8G8B8;
g_params.BackBufferCount = 0;
g_params.MultiSampleType = D3DMULTISAMPLE_NONE;
g_params.MultiSampleQuality = 0;
g_params.SwapEffect = D3DSWAPEFFECT_DISCARD;
g_params.hDeviceWindow = hWnd;
g_params.EnableAutoDepthStencil = FALSE;
g_params.AutoDepthStencilFormat = D3DFMT_D24S8;
g_params.Flags = 0; //D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL;
g_params.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
g_params.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
// Create device
DWORD Flags = D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE | D3DCREATE_FPU_PRESERVE;
if (FAILED(g_direct3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd,
Flags, &g_params, &g_device)))
{
return FALSE;
}
//---------------------------------------------------------------------
// Create render targets
if (!RecreateTargets(window_width, window_height))
return FALSE;
//---------------------------------------------------------------------
// Initialize Flash-to-DirectX
//---------------------------------------------------------------------
g_flashDX = GetFlashToDirectXInstance();
double flashVersion = g_flashDX->GetFlashVersion();
g_flashPlayer = g_flashDX->CreatePlayer(window_width, window_height);
if (!g_flashPlayer)
{
MessageBox(NULL, L"Flash Player failed to initialize.", L"Error", MB_OK);
return FALSE;
}
g_playerASI = new ASInterface(g_flashPlayer);
//---------------------------------------------------------------------
// Function callbacks example
//---------------------------------------------------------------------
{
struct TestCallbacks
{
static void test1(bool yes, ASValue::Array arr)
{
}
int test2()
{
return 0;
}
void command1(const wchar_t*)
{
}
static void fsCommandDef(const wchar_t*, const wchar_t*)
{
}
};
TestCallbacks s_testCallbacks;
g_playerASI->AddCallback(L"test1", &TestCallbacks::test1);
g_playerASI->AddCallback(L"test2", s_testCallbacks, &TestCallbacks::test2);
g_playerASI->AddFSCCallback(L"command1", s_testCallbacks, &TestCallbacks::command1);
g_playerASI->SetDefaultFSCCallback(&TestCallbacks::fsCommandDef);
}
//---------------------------------------------------------------------
// Load and play movie
//---------------------------------------------------------------------
g_flashPlayer->LoadMovie(movie_path);
g_flashPlayer->SetTransparencyMode(transparency_mode);
g_flashPlayer->SetBackgroundColor(RGB(0, 0, 0));
//---------------------------------------------------------------------
// Function call example
//---------------------------------------------------------------------
/*{
bool boolResult = g_playerASI->Call(L"test", true);
int numberResult = g_playerASI->Call(L"test1", 22);
std::wstring stringResult = g_playerASI->Call(L"test2", 123.456);
ASValue::Array arrayResult = g_playerASI->Call(L"test3", stringResult);
ASValue::Object objectResult = g_playerASI->Call(L"test4", arrayResult);
}*/
// Show window
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}
示例10: GLW_CreateWindow
//.........这里部分代码省略.........
s_classRegistered = qtrue;
ri.Printf( PRINT_ALL, "...registered window class\n" );
}
//
// create the HWND if one does not already exist
//
if ( !g_wv.hWnd )
{
//
// compute width and height
//
r.left = 0;
r.top = 0;
r.right = width;
r.bottom = height;
if ( cdsFullscreen )
{
exstyle = WS_EX_TOPMOST;
stylebits = WS_SYSMENU|WS_POPUP|WS_VISIBLE; //sysmenu gives you the icon
}
else
{
exstyle = 0;
stylebits = WS_SYSMENU|WINDOW_STYLE|WS_MINIMIZEBOX;
AdjustWindowRect (&r, stylebits, FALSE);
}
w = r.right - r.left;
h = r.bottom - r.top;
if ( cdsFullscreen )
{
x = 0;
y = 0;
}
else
{
vid_xpos = ri.Cvar_Get ("vid_xpos", "", 0);
vid_ypos = ri.Cvar_Get ("vid_ypos", "", 0);
x = vid_xpos->integer;
y = vid_ypos->integer;
// adjust window coordinates if necessary
// so that the window is completely on screen
if ( x < 0 )
x = 0;
if ( y < 0 )
y = 0;
if ( w < glw_state.desktopWidth &&
h < glw_state.desktopHeight )
{
if ( x + w > glw_state.desktopWidth )
x = ( glw_state.desktopWidth - w );
if ( y + h > glw_state.desktopHeight )
y = ( glw_state.desktopHeight - h );
}
}
g_wv.hWnd = CreateWindowEx (
exstyle,
WINDOW_CLASS_NAME,
WINDOW_CLASS_NAME,
stylebits,
x, y, w, h,
NULL,
NULL,
g_wv.hInstance,
NULL);
if ( !g_wv.hWnd )
{
ri.Error (ERR_FATAL, "GLW_CreateWindow() - Couldn't create window");
}
ShowWindow( g_wv.hWnd, SW_SHOW );
UpdateWindow( g_wv.hWnd );
ri.Printf( PRINT_ALL, "...created [email protected]%d,%d (%dx%d)\n", x, y, w, h );
}
else
{
ri.Printf( PRINT_ALL, "...window already present, CreateWindowEx skipped\n" );
}
if ( !GLW_InitDriver( colorbits ) )
{
ShowWindow( g_wv.hWnd, SW_HIDE );
DestroyWindow( g_wv.hWnd );
g_wv.hWnd = NULL;
return qfalse;
}
SetForegroundWindow( g_wv.hWnd );
SetFocus( g_wv.hWnd );
return qtrue;
}
示例11: WinMain
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
static TCHAR szAppName[] = TEXT("MetaFile");
HWND hwnd;
MSG msg;
WNDCLASS wndclass;
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = szAppName;
if (!RegisterClass(&wndclass))
{
MessageBox(NULL, TEXT("This program requires Windows NT!"),
szAppName, MB_ICONERROR);
return 0;
}
hwnd = CreateWindow(szAppName, TEXT("MetaFile Demonstration"),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hInstance, NULL);
ShowWindow(hwnd, iCmdShow);
UpdateWindow(hwnd);
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
示例12: WinMain
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
strExtensionFile.append(szCmdLine);
#ifdef _DEBUG
//strExtensionFile = "D:\\Source\\c++\\Programme\\sallyWork\\ext\\Applications\\eRadio.sallyapplication";
//strExtensionFile = "D:\\Source\\c++\\Programme\\sallyWork\\ext\\Keyboards\\fr.sallykeyboard";
//strExtensionFile = "D:\\Source\\c++\\Programme\\sallyWork\\ext\\Languages\\fr.sallylanguage";
//strExtensionFile = "C:\\Users\\christian.knobloch\\Downloads\\ScummVM_1.1.1.3.sallyapplication";
//strExtensionFile = "update";
//strExtensionFile = "applications\\de.der-knob.sally.app.eRadio";
#endif
if (SallyAPI::String::StringHelper::StringEndsWith(strExtensionFile, ".sallyplugin"))
extensionType = INSTALL_FILE_INSTALL;
else if (SallyAPI::String::StringHelper::StringEndsWith(strExtensionFile, ".sallyapplication"))
extensionType = INSTALL_FILE_INSTALL;
else if (SallyAPI::String::StringHelper::StringEndsWith(strExtensionFile, ".sallytheme"))
extensionType = INSTALL_FILE_INSTALL;
else if (SallyAPI::String::StringHelper::StringEndsWith(strExtensionFile, ".sallylanguage"))
extensionType = INSTALL_FILE_INSTALL;
else if (SallyAPI::String::StringHelper::StringEndsWith(strExtensionFile, ".sallykeyboard"))
extensionType = INSTALL_FILE_INSTALL;
else if (strExtensionFile.compare("update") == 0)
extensionType = INSTALL_UPDATE;
// get path and config files
searchUpdates = GetUpdateFolder();
// install ext or self update?
if (extensionType != INSTALL_NONE)
{
HWND hwndWait = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DIALOG_WAIT), NULL, NULL);
ShowWindow(hwndWait, SW_SHOW);
UpdateWindow(hwndWait);
bool running = true;
// go on and show the Dialog
HANDLE hSem = NULL;
while (running)
{
hSem = CreateSemaphore(NULL, 0, 1, "SallyProject");
if (hSem)
{
if (GetLastError() == ERROR_ALREADY_EXISTS)
{
running = true;
::CloseHandle(hSem);
}
else
running = false;
}
else
{
running = false;
}
Sleep(100);
}
// wait for all instances to end
HANDLE hSemSelfUpdat = NULL;
while (running)
{
hSemSelfUpdat = CreateSemaphore(NULL, 0, 1, "SallyProjectUpdater");
if (hSemSelfUpdat)
{
if (GetLastError() == ERROR_ALREADY_EXISTS)
{
running = true;
::CloseHandle(hSemSelfUpdat);
}
else
running = false;
}
else
{
running = false;
}
Sleep(100);
}
// close the window
DestroyWindow(hwndWait);
DialogBox (hInstance, MAKEINTRESOURCE(IDD_DIALOG_INSTALL), 0, DlgInstallerProc);
if ((extensionType == INSTALL_UPDATE) && (bInstallError))
{
if (MessageBox(0, GetLocalisation(IDS_DELETE_UPDATE_ERRORS, hInstance).c_str(),
GetLocalisation(IDS_DELETE_UPDATE_ERRORS_CAPTION, hInstance).c_str(), MB_YESNO | MB_ICONQUESTION) == IDYES)
{
DeleteDirectory(searchUpdates.c_str());
CreateDirectory(searchUpdates.c_str(), NULL);
}
}
::CloseHandle(hSem);
::CloseHandle(hSemSelfUpdat);
if (bSkipUpdate)
//.........这里部分代码省略.........
示例13: verbosemgr
//.........这里部分代码省略.........
if (!m_hWnd)
SystemFatalError (L"Cannot create Crystal Space window", GetLastError());
SetTitle (win_title);
// Subclass the window
if (IsWindowUnicode (m_hWnd))
{
m_OldWndProc = (WNDPROC)SetWindowLongPtrW (m_hWnd, GWLP_WNDPROC,
(LONG_PTR) WindowProc);
SetWindowLongPtrW (m_hWnd, GWLP_USERDATA, (LONG_PTR)this);
}
else
{
m_OldWndProc = (WNDPROC)SetWindowLongPtrA (m_hWnd, GWLP_WNDPROC,
(LONG_PTR) WindowProc);
SetWindowLongPtrA (m_hWnd, GWLP_USERDATA, (LONG_PTR)this);
}
hDC = GetDC (m_hWnd);
if (pixelFormat == -1)
{
picker.Reset();
pixelFormat = FindPixelFormatGDI (hDC, picker);
}
PIXELFORMATDESCRIPTOR pfd;
if (DescribePixelFormat (hDC, pixelFormat,
sizeof(PIXELFORMATDESCRIPTOR), &pfd) == 0)
SystemFatalError (L"DescribePixelFormat failed.", GetLastError());
if (SetPixelFormat (hDC, pixelFormat, &pfd) != TRUE)
{
HRESULT spfErr = (HRESULT)GetLastError();
SystemFatalError (L"SetPixelFormat failed.", spfErr);
}
currentFormat[glpfvColorBits] = pfd.cColorBits;
currentFormat[glpfvAlphaBits] = pfd.cAlphaBits;
currentFormat[glpfvDepthBits] = pfd.cDepthBits;
currentFormat[glpfvStencilBits] = pfd.cStencilBits;
currentFormat[glpfvAccumColorBits] = pfd.cAccumBits;
currentFormat[glpfvAccumAlphaBits] = pfd.cAccumAlphaBits;
Depth = pfd.cColorBits;
hardwareAccelerated = !(pfd.dwFlags & PFD_GENERIC_FORMAT) ||
(pfd.dwFlags & PFD_GENERIC_ACCELERATED);
hGLRC = wglCreateContext (hDC);
wglMakeCurrent (hDC, hGLRC);
UpdateWindow (m_hWnd);
ShowWindow (m_hWnd, m_nCmdShow);
SetForegroundWindow (m_hWnd);
SetFocus (m_hWnd);
/* Small hack to emit "no HW acceleration" message on both GDI Generic and
* sucky Direct3D default OpenGL */
hardwareAccelerated &=
(strncmp ((char*)glGetString (GL_VENDOR), "Microsoft", 9) != 0);
if (!hardwareAccelerated)
{
Report (CS_REPORTER_SEVERITY_WARNING,
"No hardware acceleration!");
}
detector.DoDetection (m_hWnd, hDC);
Report (CS_REPORTER_SEVERITY_NOTIFY,
"GL driver: %s %s", detector.GetDriverDLL(),
detector.GetDriverVersion() ? detector.GetDriverVersion() :
"<version unknown>");
if (FullScreen)
{
/*
* from the Windows Shell docs:
* "It is possible to cover the taskbar by explicitly setting the size
* of the window rectangle equal to the size of the screen with
* SetWindowPos."
*/
SetWindowPos (m_hWnd, CS_WINDOW_Z_ORDER, 0, 0, fbWidth, fbHeight, 0);
}
if (!csGraphics2DGLCommon::Open ())
return false;
ext.InitWGL_EXT_swap_control (hDC);
if (ext.CS_WGL_EXT_swap_control)
{
ext.wglSwapIntervalEXT (vsync ? 1 : 0);
vsync = (ext.wglGetSwapIntervalEXT() != 0);
Report (CS_REPORTER_SEVERITY_NOTIFY,
"VSync is %s.",
vsync ? "enabled" : "disabled");
}
return true;
}
示例14: SetDlgItemText
SIGPROCDLG_API void CSigProcDlg::SetEditVar(const char *strIn)
{
SetDlgItemText(IDC_VAR, strIn);
varstr = strIn;
UpdateWindow(hDlg);
}
示例15: WinMain
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCMLine, int iCmdShow){
static TCHAR szAppName[] = TEXT ("HelloApplication");
static TCHAR szAppName2[] = TEXT ("HelloApplicationagain");
HWND hwnd;
HWND hwnd2;
HWND hwnd3;
MSG msg;
WNDCLASS wndclass;
WNDCLASS wndclass2;
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = HelloWndProc;
wndclass.cbClsExtra = sizeof(int);
wndclass.cbWndExtra = sizeof(int);
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = szAppName;
wndclass2.style = CS_HREDRAW | CS_VREDRAW;
wndclass2.lpfnWndProc = SecondwindowProc;
wndclass2.cbClsExtra = 0;
wndclass2.cbWndExtra = 0;
wndclass2.hInstance = hInstance;
wndclass2.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wndclass2.hCursor = LoadCursor (NULL, IDC_ARROW);
wndclass2.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
wndclass2.lpszMenuName = NULL;
wndclass2.lpszClassName = szAppName2;
if (!RegisterClass (&wndclass)){
MessageBox (NULL, TEXT ("This program requires Windows 95/98/NT,from1"),
szAppName, MB_ICONERROR);
return 0;
}
if (!RegisterClass (&wndclass2)){
MessageBox (NULL, TEXT ("This program requires Windows 95/98/NT,from2"),
szAppName, MB_ICONERROR);
return 0;
}
hwnd = CreateWindow(szAppName,
TEXT("Hello World in Color."),
WS_OVERLAPPEDWINDOW,
100,
150,
400,
300,
NULL,
NULL,
hInstance,
NULL);
hwnd2 = CreateWindow(szAppName,
TEXT("Hello World in Color."),
WS_OVERLAPPEDWINDOW,
100 + 400,
150,
400,
300,
NULL,
NULL,
hInstance,
NULL);
hwnd3 = CreateWindow(szAppName2,
TEXT("Another widow from different class."),
WS_OVERLAPPEDWINDOW,
100,
150 + 300,
400,
300,
NULL,
NULL,
hInstance,
NULL);
SetClassLong(hwnd,0,(LONG)2);
SetClassLong(hwnd2,0,(LONG)2);
SetWindowLongPtr(hwnd,0,(LONG_PTR)0);
SetWindowLongPtr(hwnd2,0,(LONG_PTR)1);
ShowWindow(hwnd, iCmdShow);
UpdateWindow(hwnd);
ShowWindow(hwnd2, iCmdShow);
UpdateWindow(hwnd2);
ShowWindow(hwnd3, iCmdShow);
UpdateWindow(hwnd3);
while (GetMessage(&msg, NULL, 0, 0)){
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}