API Windows problème (C + +, VS08)
- Bozebo
- Expert


- Inscription: Fév 15, 2006
- Messages: 709
- Loc: 404
- Status: Offline
Salut, je travaille sur mes travaux universitaires et j'ai besoin pour produire un jeu 2D de base en utilisant l'API de Windows (pas de dx / OpenGL nécessaire encore). Il est globalement très simple, mais il est une question stupide avec l'API Windows qui m'embête.
Tout d'abord, je benne mon code:
REMARQUE: l'éditeur de liens d'entrée: winmm.lib
Maintenant, permettez-moi d'expliquer le problème. Quand je définis SCREEN_HEIGHT en 640, je serais certainement s'attendre à la surface utilisable de la fenêtre à 640px de haut, non? Eh bien, Windows semble penser que ce serait amusant de prendre la barre de titre et de la frontière de cette valeur (avec aussi SCREEN_WIDTH). Alors, quand je programmer divers morceaux de code que j'ai à coder en dur dans la valeur de décalage par rapport à la frontière, pour mettre fin à ce qui se passe lorsque l'utilisateur se déplace vers le bas pendant trop longtemps:

Maintenant, je peux résoudre ceci (en fixant la valeur codée en dur parce que je ne fixait pas / le supprimer dans l'exemple de capture d'écran). Mais, ce sera différent pour les différentes versions de Windows et également si l'utilisateur a changé leur thème. Alors, est-il un moyen au sein de l'API Windows pour savoir quelle est l'épaisseur de cette frontière est si je peux le réparer? Curieusement, le Y = 0 position est au bon endroit, mais le fond du travail sont de la fenêtre est compensée par l'épaisseur de la barre de titre.
Cela peut-il être corrigé? Ou ai-je fait quelque chose de terriblement mal?
Tout d'abord, je benne mon code:
CPP Code: [ Select ]
//Windows Example Code
//Matthew Bett 2005
#include <windows.h>
#include <stdio.h>
#include <mmsystem.h>
#include <math.h>
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
/* not using any mouse input
typedef struct Mouse{
int x,y;
} Mouse;
*/
typedef struct Sprite{
int x, y, width, height;
HBITMAP bitmap;
} Sprite;
int xpos, ypos;
int ticker = 0;
HBITMAP theOldFrontBitMap, theOldBackBitMap;
HWND ghwnd;
RECT screenRect;
HDC backHDC, frontHDC, bitmapHDC; //Hardware device contexts for the Buffers
bool keys[256];
Sprite TestSprite;
BOOL waitFor(unsigned long delay);
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
void RegisterMyWindow(HINSTANCE hInstance){
WNDCLASSEX wcex;
wcex.cbSize = sizeof(wcex);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = 0;
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = L" FirstWindowClass";
wcex.hIconSm = 0;
RegisterClassEx(&wcex);
}
BOOL InitialiseMyWindow(HINSTANCE hInstance, int nCmdShow){
HWND hwnd;
hwnd = CreateWindow(L" FirstWindowClass", L" Double Buffering", WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU,
CW_USEDEFAULT, CW_USEDEFAULT, SCREEN_WIDTH, SCREEN_HEIGHT, NULL, NULL, hInstance,
NULL);
if(!hwnd) return FALSE;
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
ghwnd = hwnd;
return TRUE;
}
BOOL WaitFor(unsigned long delay){
static unsigned long clockStart = 0;
unsigned long timePassed;
unsigned long now = timeGetTime();
timePassed = now - clockStart;
if(timePassed > delay){
clockStart = now;
return TRUE;
} //why was there an else here? <!-- s;) --><img src=\"{SMILIES_PATH}/icon_wink.gif\" alt=\";)\" title=\"Wink\"><!-- s;) -->
return FALSE;
}
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
switch(message){
case WM_CREATE:
break;
case WM_SIZE:
break;
case WM_KEYDOWN:
keys[wParam]=true;
break;
case WM_KEYUP:
keys[wParam]=false;
break;
/*
case WM_MOUSEMOVE:
MousePos.x = LOWORD (lParam);
MousePos.y = HIWORD (lParam);
break;
*/
case WM_PAINT:
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
HBITMAP LoadABitmap(LPCWSTR szFileName){
return (HBITMAP)LoadImage(NULL, szFileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
}
void drawSprite(Sprite theSprite){
HBITMAP originalBitMap;
originalBitMap = (HBITMAP)SelectObject(bitmapHDC,theSprite.bitmap);
BitBlt(backHDC,theSprite.x,theSprite.y,theSprite.x+theSprite.width,theSprite.y+theSprite.height,bitmapHDC,0,0,SRCCOPY);
SelectObject(bitmapHDC,originalBitMap);
}
void setBuffers(){
GetClientRect(ghwnd, &screenRect); //creates rect based on window client area
frontHDC = GetDC(ghwnd); // Initialises front buffer device context (window)
backHDC = CreateCompatibleDC(frontHDC); // sets up Back DC to be compatible with the front
bitmapHDC=CreateCompatibleDC(backHDC);
theOldFrontBitMap = CreateCompatibleBitmap(frontHDC, screenRect.right,
screenRect.bottom); //creates bitmap compatible with the front buffer
theOldBackBitMap = (HBITMAP)SelectObject(backHDC, theOldFrontBitMap);
//creates bitmap compatible with the back buffer
FillRect(backHDC, &screenRect, (HBRUSH)GetStockObject(0));
}
void displayFrame(){
BitBlt(frontHDC, screenRect.left,screenRect.top, screenRect.right,
screenRect.bottom, backHDC, 0, 0, SRCCOPY);
FillRect(backHDC, &screenRect, (HBRUSH)GetStockObject(0));
}
void releaseResources(){
SelectObject(backHDC,theOldBackBitMap);
DeleteDC(backHDC);
DeleteDC(bitmapHDC);
ReleaseDC(ghwnd,frontHDC);
}
/*
classes
*/
//player ship
class Player{
public:
int x,y,height,width;
float vSpeed,maxVSpeed,acceleration,friction;
bool visible;
Sprite sprite;
//constructor
Player(int setX, int setY, LPCWSTR bmp, int w, int h){
sprite.bitmap = LoadABitmap(bmp);
sprite.x = setX;
sprite.y = setY;
sprite.width = w;
sprite.height = h;
x = setX;
y = setY;
visible = true;
vSpeed = 0;
maxVSpeed = 14;
acceleration = 1.3;
friction = 0.7;
}
//every frame
void step(){
/*
basic movement physics
*/
//up
if(keys[87]){
//if not moving too fast upwards
if(vSpeed > -maxVSpeed){
//accelerate up
vSpeed -= acceleration;
//cap speed
if(vSpeed < -maxVSpeed) vSpeed = -maxVSpeed;
}
}
//down
if(keys[83]){
//if not moving too fast downwards
if(vSpeed < maxVSpeed){
//accelerate down
vSpeed += acceleration;
//cap speed
if(vSpeed > maxVSpeed) vSpeed = maxVSpeed;
}
}
//friction
if(vSpeed > 0){
vSpeed -= friction;
if(vSpeed < 0) vSpeed = 0;
} else if(vSpeed < 0){
vSpeed += friction;
if(vSpeed > 0) vSpeed = 0;
}
//apply motion
y += vSpeed;
//don't go out of the screen
if(y < 0){
vSpeed = 0;
y = 0;
} else if(y > 428){
vSpeed = 0;
y = 428;
}
}
void draw(){
if(!visible)
return;
sprite.x = x;
sprite.y = y;
drawSprite(sprite);
}
};
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int nCmdShow){
MSG msg;
HDC hdcWindow;
//create the player
Player player(50,SCREEN_HEIGHT/2,L" icon.bmp",32,32);
RegisterMyWindow(hInstance);
if(!InitialiseMyWindow(hInstance, nCmdShow))
return FALSE;
setBuffers();
while(TRUE){
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)){
if(msg.message==WM_QUIT)
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
} else if(WaitFor(10)){
//step the player
player.step();
//draw the player
player.draw();
displayFrame();
}
}
releaseResources();
return msg.wParam;
}
//Matthew Bett 2005
#include <windows.h>
#include <stdio.h>
#include <mmsystem.h>
#include <math.h>
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
/* not using any mouse input
typedef struct Mouse{
int x,y;
} Mouse;
*/
typedef struct Sprite{
int x, y, width, height;
HBITMAP bitmap;
} Sprite;
int xpos, ypos;
int ticker = 0;
HBITMAP theOldFrontBitMap, theOldBackBitMap;
HWND ghwnd;
RECT screenRect;
HDC backHDC, frontHDC, bitmapHDC; //Hardware device contexts for the Buffers
bool keys[256];
Sprite TestSprite;
BOOL waitFor(unsigned long delay);
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
void RegisterMyWindow(HINSTANCE hInstance){
WNDCLASSEX wcex;
wcex.cbSize = sizeof(wcex);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = 0;
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = L" FirstWindowClass";
wcex.hIconSm = 0;
RegisterClassEx(&wcex);
}
BOOL InitialiseMyWindow(HINSTANCE hInstance, int nCmdShow){
HWND hwnd;
hwnd = CreateWindow(L" FirstWindowClass", L" Double Buffering", WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU,
CW_USEDEFAULT, CW_USEDEFAULT, SCREEN_WIDTH, SCREEN_HEIGHT, NULL, NULL, hInstance,
NULL);
if(!hwnd) return FALSE;
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
ghwnd = hwnd;
return TRUE;
}
BOOL WaitFor(unsigned long delay){
static unsigned long clockStart = 0;
unsigned long timePassed;
unsigned long now = timeGetTime();
timePassed = now - clockStart;
if(timePassed > delay){
clockStart = now;
return TRUE;
} //why was there an else here? <!-- s;) --><img src=\"{SMILIES_PATH}/icon_wink.gif\" alt=\";)\" title=\"Wink\"><!-- s;) -->
return FALSE;
}
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
switch(message){
case WM_CREATE:
break;
case WM_SIZE:
break;
case WM_KEYDOWN:
keys[wParam]=true;
break;
case WM_KEYUP:
keys[wParam]=false;
break;
/*
case WM_MOUSEMOVE:
MousePos.x = LOWORD (lParam);
MousePos.y = HIWORD (lParam);
break;
*/
case WM_PAINT:
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
HBITMAP LoadABitmap(LPCWSTR szFileName){
return (HBITMAP)LoadImage(NULL, szFileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
}
void drawSprite(Sprite theSprite){
HBITMAP originalBitMap;
originalBitMap = (HBITMAP)SelectObject(bitmapHDC,theSprite.bitmap);
BitBlt(backHDC,theSprite.x,theSprite.y,theSprite.x+theSprite.width,theSprite.y+theSprite.height,bitmapHDC,0,0,SRCCOPY);
SelectObject(bitmapHDC,originalBitMap);
}
void setBuffers(){
GetClientRect(ghwnd, &screenRect); //creates rect based on window client area
frontHDC = GetDC(ghwnd); // Initialises front buffer device context (window)
backHDC = CreateCompatibleDC(frontHDC); // sets up Back DC to be compatible with the front
bitmapHDC=CreateCompatibleDC(backHDC);
theOldFrontBitMap = CreateCompatibleBitmap(frontHDC, screenRect.right,
screenRect.bottom); //creates bitmap compatible with the front buffer
theOldBackBitMap = (HBITMAP)SelectObject(backHDC, theOldFrontBitMap);
//creates bitmap compatible with the back buffer
FillRect(backHDC, &screenRect, (HBRUSH)GetStockObject(0));
}
void displayFrame(){
BitBlt(frontHDC, screenRect.left,screenRect.top, screenRect.right,
screenRect.bottom, backHDC, 0, 0, SRCCOPY);
FillRect(backHDC, &screenRect, (HBRUSH)GetStockObject(0));
}
void releaseResources(){
SelectObject(backHDC,theOldBackBitMap);
DeleteDC(backHDC);
DeleteDC(bitmapHDC);
ReleaseDC(ghwnd,frontHDC);
}
/*
classes
*/
//player ship
class Player{
public:
int x,y,height,width;
float vSpeed,maxVSpeed,acceleration,friction;
bool visible;
Sprite sprite;
//constructor
Player(int setX, int setY, LPCWSTR bmp, int w, int h){
sprite.bitmap = LoadABitmap(bmp);
sprite.x = setX;
sprite.y = setY;
sprite.width = w;
sprite.height = h;
x = setX;
y = setY;
visible = true;
vSpeed = 0;
maxVSpeed = 14;
acceleration = 1.3;
friction = 0.7;
}
//every frame
void step(){
/*
basic movement physics
*/
//up
if(keys[87]){
//if not moving too fast upwards
if(vSpeed > -maxVSpeed){
//accelerate up
vSpeed -= acceleration;
//cap speed
if(vSpeed < -maxVSpeed) vSpeed = -maxVSpeed;
}
}
//down
if(keys[83]){
//if not moving too fast downwards
if(vSpeed < maxVSpeed){
//accelerate down
vSpeed += acceleration;
//cap speed
if(vSpeed > maxVSpeed) vSpeed = maxVSpeed;
}
}
//friction
if(vSpeed > 0){
vSpeed -= friction;
if(vSpeed < 0) vSpeed = 0;
} else if(vSpeed < 0){
vSpeed += friction;
if(vSpeed > 0) vSpeed = 0;
}
//apply motion
y += vSpeed;
//don't go out of the screen
if(y < 0){
vSpeed = 0;
y = 0;
} else if(y > 428){
vSpeed = 0;
y = 428;
}
}
void draw(){
if(!visible)
return;
sprite.x = x;
sprite.y = y;
drawSprite(sprite);
}
};
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int nCmdShow){
MSG msg;
HDC hdcWindow;
//create the player
Player player(50,SCREEN_HEIGHT/2,L" icon.bmp",32,32);
RegisterMyWindow(hInstance);
if(!InitialiseMyWindow(hInstance, nCmdShow))
return FALSE;
setBuffers();
while(TRUE){
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)){
if(msg.message==WM_QUIT)
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
} else if(WaitFor(10)){
//step the player
player.step();
//draw the player
player.draw();
displayFrame();
}
}
releaseResources();
return msg.wParam;
}
- //Windows Example Code
- //Matthew Bett 2005
- #include <windows.h>
- #include <stdio.h>
- #include <mmsystem.h>
- #include <math.h>
- #define SCREEN_WIDTH 640
- #define SCREEN_HEIGHT 480
- /* not using any mouse input
- typedef struct Mouse{
- int x,y;
- } Mouse;
- */
- typedef struct Sprite{
- int x, y, width, height;
- HBITMAP bitmap;
- } Sprite;
- int xpos, ypos;
- int ticker = 0;
- HBITMAP theOldFrontBitMap, theOldBackBitMap;
- HWND ghwnd;
- RECT screenRect;
- HDC backHDC, frontHDC, bitmapHDC; //Hardware device contexts for the Buffers
- bool keys[256];
- Sprite TestSprite;
- BOOL waitFor(unsigned long delay);
- LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
- void RegisterMyWindow(HINSTANCE hInstance){
- WNDCLASSEX wcex;
- wcex.cbSize = sizeof(wcex);
- wcex.style = CS_HREDRAW | CS_VREDRAW;
- wcex.lpfnWndProc = WndProc;
- wcex.cbClsExtra = 0;
- wcex.cbWndExtra = 0;
- wcex.hInstance = hInstance;
- wcex.hIcon = 0;
- wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
- wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
- wcex.lpszMenuName = NULL;
- wcex.lpszClassName = L" FirstWindowClass";
- wcex.hIconSm = 0;
- RegisterClassEx(&wcex);
- }
- BOOL InitialiseMyWindow(HINSTANCE hInstance, int nCmdShow){
- HWND hwnd;
- hwnd = CreateWindow(L" FirstWindowClass", L" Double Buffering", WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU,
- CW_USEDEFAULT, CW_USEDEFAULT, SCREEN_WIDTH, SCREEN_HEIGHT, NULL, NULL, hInstance,
- NULL);
- if(!hwnd) return FALSE;
- ShowWindow(hwnd, nCmdShow);
- UpdateWindow(hwnd);
- ghwnd = hwnd;
- return TRUE;
- }
- BOOL WaitFor(unsigned long delay){
- static unsigned long clockStart = 0;
- unsigned long timePassed;
- unsigned long now = timeGetTime();
- timePassed = now - clockStart;
- if(timePassed > delay){
- clockStart = now;
- return TRUE;
- } //why was there an else here? <!-- s;) --><img src=\"{SMILIES_PATH}/icon_wink.gif\" alt=\";)\" title=\"Wink\"><!-- s;) -->
- return FALSE;
- }
- LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
- switch(message){
- case WM_CREATE:
- break;
- case WM_SIZE:
- break;
- case WM_KEYDOWN:
- keys[wParam]=true;
- break;
- case WM_KEYUP:
- keys[wParam]=false;
- break;
- /*
- case WM_MOUSEMOVE:
- MousePos.x = LOWORD (lParam);
- MousePos.y = HIWORD (lParam);
- break;
- */
- case WM_PAINT:
- break;
- case WM_DESTROY:
- PostQuitMessage(0);
- break;
- }
- return DefWindowProc(hwnd, message, wParam, lParam);
- }
- HBITMAP LoadABitmap(LPCWSTR szFileName){
- return (HBITMAP)LoadImage(NULL, szFileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
- }
- void drawSprite(Sprite theSprite){
- HBITMAP originalBitMap;
- originalBitMap = (HBITMAP)SelectObject(bitmapHDC,theSprite.bitmap);
- BitBlt(backHDC,theSprite.x,theSprite.y,theSprite.x+theSprite.width,theSprite.y+theSprite.height,bitmapHDC,0,0,SRCCOPY);
- SelectObject(bitmapHDC,originalBitMap);
- }
- void setBuffers(){
- GetClientRect(ghwnd, &screenRect); //creates rect based on window client area
- frontHDC = GetDC(ghwnd); // Initialises front buffer device context (window)
- backHDC = CreateCompatibleDC(frontHDC); // sets up Back DC to be compatible with the front
- bitmapHDC=CreateCompatibleDC(backHDC);
- theOldFrontBitMap = CreateCompatibleBitmap(frontHDC, screenRect.right,
- screenRect.bottom); //creates bitmap compatible with the front buffer
- theOldBackBitMap = (HBITMAP)SelectObject(backHDC, theOldFrontBitMap);
- //creates bitmap compatible with the back buffer
- FillRect(backHDC, &screenRect, (HBRUSH)GetStockObject(0));
- }
- void displayFrame(){
- BitBlt(frontHDC, screenRect.left,screenRect.top, screenRect.right,
- screenRect.bottom, backHDC, 0, 0, SRCCOPY);
- FillRect(backHDC, &screenRect, (HBRUSH)GetStockObject(0));
- }
- void releaseResources(){
- SelectObject(backHDC,theOldBackBitMap);
- DeleteDC(backHDC);
- DeleteDC(bitmapHDC);
- ReleaseDC(ghwnd,frontHDC);
- }
- /*
- classes
- */
- //player ship
- class Player{
- public:
- int x,y,height,width;
- float vSpeed,maxVSpeed,acceleration,friction;
- bool visible;
- Sprite sprite;
- //constructor
- Player(int setX, int setY, LPCWSTR bmp, int w, int h){
- sprite.bitmap = LoadABitmap(bmp);
- sprite.x = setX;
- sprite.y = setY;
- sprite.width = w;
- sprite.height = h;
- x = setX;
- y = setY;
- visible = true;
- vSpeed = 0;
- maxVSpeed = 14;
- acceleration = 1.3;
- friction = 0.7;
- }
- //every frame
- void step(){
- /*
- basic movement physics
- */
- //up
- if(keys[87]){
- //if not moving too fast upwards
- if(vSpeed > -maxVSpeed){
- //accelerate up
- vSpeed -= acceleration;
- //cap speed
- if(vSpeed < -maxVSpeed) vSpeed = -maxVSpeed;
- }
- }
- //down
- if(keys[83]){
- //if not moving too fast downwards
- if(vSpeed < maxVSpeed){
- //accelerate down
- vSpeed += acceleration;
- //cap speed
- if(vSpeed > maxVSpeed) vSpeed = maxVSpeed;
- }
- }
- //friction
- if(vSpeed > 0){
- vSpeed -= friction;
- if(vSpeed < 0) vSpeed = 0;
- } else if(vSpeed < 0){
- vSpeed += friction;
- if(vSpeed > 0) vSpeed = 0;
- }
- //apply motion
- y += vSpeed;
- //don't go out of the screen
- if(y < 0){
- vSpeed = 0;
- y = 0;
- } else if(y > 428){
- vSpeed = 0;
- y = 428;
- }
- }
- void draw(){
- if(!visible)
- return;
- sprite.x = x;
- sprite.y = y;
- drawSprite(sprite);
- }
- };
- int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
- PSTR szCmdLine, int nCmdShow){
- MSG msg;
- HDC hdcWindow;
- //create the player
- Player player(50,SCREEN_HEIGHT/2,L" icon.bmp",32,32);
- RegisterMyWindow(hInstance);
- if(!InitialiseMyWindow(hInstance, nCmdShow))
- return FALSE;
- setBuffers();
- while(TRUE){
- if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)){
- if(msg.message==WM_QUIT)
- break;
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- } else if(WaitFor(10)){
- //step the player
- player.step();
- //draw the player
- player.draw();
- displayFrame();
- }
- }
- releaseResources();
- return msg.wParam;
- }
REMARQUE: l'éditeur de liens d'entrée: winmm.lib
Maintenant, permettez-moi d'expliquer le problème. Quand je définis SCREEN_HEIGHT en 640, je serais certainement s'attendre à la surface utilisable de la fenêtre à 640px de haut, non? Eh bien, Windows semble penser que ce serait amusant de prendre la barre de titre et de la frontière de cette valeur (avec aussi SCREEN_WIDTH). Alors, quand je programmer divers morceaux de code que j'ai à coder en dur dans la valeur de décalage par rapport à la frontière, pour mettre fin à ce qui se passe lorsque l'utilisateur se déplace vers le bas pendant trop longtemps:

Maintenant, je peux résoudre ceci (en fixant la valeur codée en dur parce que je ne fixait pas / le supprimer dans l'exemple de capture d'écran). Mais, ce sera différent pour les différentes versions de Windows et également si l'utilisateur a changé leur thème. Alors, est-il un moyen au sein de l'API Windows pour savoir quelle est l'épaisseur de cette frontière est si je peux le réparer? Curieusement, le Y = 0 position est au bon endroit, mais le fond du travail sont de la fenêtre est compensée par l'épaisseur de la barre de titre.
Cela peut-il être corrigé? Ou ai-je fait quelque chose de terriblement mal?
- Anonymous
- Bot


- Inscription: 25 Feb 2008
- Messages: ?
- Loc: Ozzuland
- Status: Online
Novembre 13th, 2009, 8:56 am
Page 1 sur 1
Pour répondre à ce sujet, vous devez vous connecter ou vous enregistrer. Il est gratuit.
Afficher de l'information
- Total des messages de ce sujet: 1 message
- Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 153 invités
- Vous ne pouvez pas poster de nouveaux sujets
- Vous ne pouvez pas répondre aux sujets
- Vous ne pouvez pas éditer vos messages
- Vous ne pouvez pas supprimer vos messages
- Vous ne pouvez pas joindre des fichiers
