Click here to Skip to main content
15,897,187 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionError in OpenFileMapping function. Pin
cathy_d'souza21-Sep-06 19:33
cathy_d'souza21-Sep-06 19:33 
AnswerRe: Error in OpenFileMapping function. Pin
Hamid_RT21-Sep-06 20:00
Hamid_RT21-Sep-06 20:00 
QuestionRe: Error in OpenFileMapping function. Pin
prasad_som21-Sep-06 20:04
prasad_som21-Sep-06 20:04 
QuestionPro grammatically importing digital certificate which only contains a public key Pin
Sudhir Mangla21-Sep-06 18:19
professionalSudhir Mangla21-Sep-06 18:19 
QuestionHow to detect full-screen window? Pin
jipai21-Sep-06 17:06
jipai21-Sep-06 17:06 
AnswerRe: How to detect full-screen window? Pin
Steve Echols21-Sep-06 17:59
Steve Echols21-Sep-06 17:59 
GeneralRe: How to detect full-screen window? Pin
jipai21-Sep-06 22:13
jipai21-Sep-06 22:13 
QuestionKeeping window within boundry, win32 sdk [modified] Pin
beeejay21-Sep-06 16:19
beeejay21-Sep-06 16:19 
Hi,
I am trying to handle the wm_move or wm_moving message to keep a window within a bounding box, I am not able to stop the message from propagating once I'm done with it.

What do I need to do??

I have been messing around with this code.
Code no good, don't use :P

LRESULT CALLBACK WndProcedure(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
int xMin = 30, xMax = 400;
int yMin = 20, yMax = 400;

int charCount = 0;
int posX=0, posY=0;
int ret = 0;
RECT trect= { 0, 0, 0, 0 };
LPRECT rect =& trect;


switch(Msg)
{

case WM_PAINT:
ret = 0;

case WM_MOVING:
SetWindowPos(hWnd, HWND_TOP, 0, 0, 200, 200, SWP_NOSIZE | SWP_NOMOVE );

GetWindowRect( hWnd, rect );
if ( rect != NULL )
{
if ( rect->left > xMax )
posX = xMax;
if ( rect->left < xMin )
posX = xMin;
if ( rect->top > yMax )
posY = yMax;
if ( rect->top < yMin )
posY = yMin;

if ( posX > 0 || posY > 0 )
SetWindowPos( hWnd, HWND_TOP, 10, 10, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE );
}

break;

case WM_MOVE:

ret = WM_MOVE;
counter ++;
char buffer2[200];
sprintf( buffer2, "%d MOVE MESSAGES SO FAR.", counter );
charCount = SetWindowText( hWnd, buffer2 );
break;
case WM_DESTROY:
PostQuitMessage(WM_QUIT);
break;
default:
return DefWindowProc(hWnd, Msg, wParam, lParam);
}

return ret;
}




-- modified at 22:39 Thursday 21st September, 2006
AnswerRe: Keeping window within boundry, win32 sdk Pin
Nibu babu thomas21-Sep-06 17:24
Nibu babu thomas21-Sep-06 17:24 
GeneralRe: Keeping window within boundry, win32 sdk Pin
beeejay21-Sep-06 17:34
beeejay21-Sep-06 17:34 
GeneralRe: Keeping window within boundry, win32 sdk Pin
Nibu babu thomas21-Sep-06 17:43
Nibu babu thomas21-Sep-06 17:43 
GeneralRe: Keeping window within boundry, win32 sdk Pin
beeejay21-Sep-06 17:56
beeejay21-Sep-06 17:56 
GeneralRe: Keeping window within boundry, win32 sdk Pin
Nibu babu thomas21-Sep-06 18:23
Nibu babu thomas21-Sep-06 18:23 
GeneralRe: Keeping window within boundry, win32 sdk Pin
beeejay21-Sep-06 18:34
beeejay21-Sep-06 18:34 
GeneralRe: Keeping window within boundry, win32 sdk Pin
Nibu babu thomas21-Sep-06 18:36
Nibu babu thomas21-Sep-06 18:36 
GeneralRe: Keeping window within boundry, win32 sdk Pin
beeejay21-Sep-06 18:47
beeejay21-Sep-06 18:47 
GeneralRe: Keeping window within boundry, win32 sdk Pin
Nibu babu thomas21-Sep-06 19:03
Nibu babu thomas21-Sep-06 19:03 
QuestionComposite Control Info Pin
Demian Panello21-Sep-06 16:14
Demian Panello21-Sep-06 16:14 
AnswerRe: Composite Control Info Pin
Rick York21-Sep-06 16:45
mveRick York21-Sep-06 16:45 
AnswerRe: Composite Control Info Pin
Hamid_RT21-Sep-06 18:41
Hamid_RT21-Sep-06 18:41 
QuestionWarning messages Pin
dacky21-Sep-06 15:36
dacky21-Sep-06 15:36 
AnswerRe: Warning messages Pin
Stephen Hewitt21-Sep-06 16:03
Stephen Hewitt21-Sep-06 16:03 
GeneralRe: Warning messages Pin
dacky21-Sep-06 16:13
dacky21-Sep-06 16:13 
QuestionMoving VC7 app to VC8 Pin
paulb21-Sep-06 12:46
paulb21-Sep-06 12:46 
AnswerRe: Moving VC7 app to VC8 Pin
Christian Graus21-Sep-06 12:52
protectorChristian Graus21-Sep-06 12:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.