what are the functions for disable the resize and put the window in center of screen?
what are the functions for disable the resize and put the window in center of screen?
what are the functions for disable the resize and put the window in center of screen?
what are the functions for disable the resize and put the window in center of screen?
what are the functions for disable the resize and put the window in center of screen?
what are the functions for disable the resize and put the window in center of screen? what are the functions for disable the resize and put the window in center of screen? what are the functions for disable the resize and put the window in center of screen? what are the functions for disable the resize and put the window in center of screen? what are the functions for disable the resize and put the window in center of screen? what are the functions for disable the resize and put the window in center of screen? what are the functions for disable the resize and put the window in center of screen? what are the functions for disable the resize and put the window in center of screen?
what are the functions for disable the resize and put the window in center of screen? what are the functions for disable the resize and put the window in center of screen?
what are the functions for disable the resize and put the window in center of screen?
Go Back  Xtreme Visual Basic Talk > > > what are the functions for disable the resize and put the window in center of screen?


Reply
 
Thread Tools Display Modes
  #1  
Old 03-07-2013, 09:37 AM
Cambalinho_83's Avatar
Cambalinho_83 Cambalinho_83 is offline
Senior Contributor
 
Join Date: Feb 2008
Location: somewhere in space
Posts: 1,296
Default what are the functions for disable the resize and put the window in center of screen?


the SetWindowLong() can disable the size of window?
(what i want is the user don't resize the window)


can i see the position of center of screen?
(i need put the window in center)
Reply With Quote
  #2  
Old 03-07-2013, 09:48 AM
Flyguy's Avatar
Flyguywhat are the functions for disable the resize and put the window in center of screen? Flyguy is offline
Lost Soul

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Vorlon
Posts: 19,154
Default

Set the .BorderStyle of the Form to 1: Fixed Single
Set the .StartupPosition to 2: Center Screen

No API required
Reply With Quote
  #3  
Old 03-07-2013, 09:52 AM
Cambalinho_83's Avatar
Cambalinho_83 Cambalinho_83 is offline
Senior Contributor
 
Join Date: Feb 2008
Location: somewhere in space
Posts: 1,296
Default

Quote:
Originally Posted by Flyguy View Post
Set the .BorderStyle of the Form to 1: Fixed Single
Set the .StartupPosition to 2: Center Screen

No API required
sorry..i'm not using VB6. that's why i need to know that right API functions.
(i'm using C\C++, but if you tell me the functions, i can do the job)
Reply With Quote
  #4  
Old 03-07-2013, 02:32 PM
Cerian Knight's Avatar
Cerian Knightwhat are the functions for disable the resize and put the window in center of screen? Cerian Knight is offline
Polymath (in disciplina)

Super Moderator
* Expert *
 
Join Date: May 2004
Location: Michigan
Posts: 4,185
Default

Just a guess, but you might use GetWindowRectangle rectangle on the client, pass those to AdjustWindowRect and use those values to construct the positions to send to SetWindowPos with SWP_NOACTIVATE Or SWP_FRAMECHANGED flags set.

I see that method used here, but am not sure if it still applies to a modern OS:
http://www.oehive.org/book/export/html/403

I've used the API (VB6 syntax... desktop is a RECT UDT): SystemParametersInfo SPI_GETWORKAREA, 0&, desktop, 0&
... which might take the place of the first two API calls.
__________________
I got all the answers wrong on the GLAT, apparently even #9 (where I put a period in the middle of the box and labeled it 'singularity ripe for rapid inflation').

Last edited by Cerian Knight; 03-07-2013 at 02:55 PM.
Reply With Quote
  #5  
Old 03-07-2013, 02:46 PM
Cambalinho_83's Avatar
Cambalinho_83 Cambalinho_83 is offline
Senior Contributor
 
Join Date: Feb 2008
Location: somewhere in space
Posts: 1,296
Default

Quote:
Originally Posted by Cerian Knight View Post
Just a guess, but you might use GetWindowRectangle rectangle on the client, pass those to AdjustWindowRect and use those values to construct the positions to send to SetWindowPos with SWP_NOACTIVATE Or SWP_FRAMECHANGED flags set.

I see that method used here, but am not sure if it still applies to a modern OS:
http://www.oehive.org/book/export/html/403

I've used the API (VB6 syntax): SystemParametersInfo SPI_GETWORKAREA, 0&, desktop, 0&
... which might take the place of the first two API calls.
the code is confused, but i will try
anotherthing how can get the screen size?(seems that i can't put the window on center of screen directly)
thanks
Reply With Quote
  #6  
Old 03-07-2013, 03:04 PM
Cerian Knight's Avatar
Cerian Knightwhat are the functions for disable the resize and put the window in center of screen? Cerian Knight is offline
Polymath (in disciplina)

Super Moderator
* Expert *
 
Join Date: May 2004
Location: Michigan
Posts: 4,185
Default

Passing the return of GetDesktopWindow to GetWindowRect passes the screen size to the UDT (again, in VB6 code):
GetWindowRect GetDesktopWindow, desktop 'desktop is a RECT UDT
Whereas:
SystemParametersInfo SPI_GETWORKAREA, 0&, desktop, 0&
considers the taskbar (no matter what its size or position) so you can know the exact center of the work area (the area used by applications, which is normally above the taskbar).
__________________
I got all the answers wrong on the GLAT, apparently even #9 (where I put a period in the middle of the box and labeled it 'singularity ripe for rapid inflation').

Last edited by Cerian Knight; 03-07-2013 at 03:13 PM.
Reply With Quote
  #7  
Old 03-07-2013, 03:11 PM
Flyguy's Avatar
Flyguywhat are the functions for disable the resize and put the window in center of screen? Flyguy is offline
Lost Soul

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Vorlon
Posts: 19,154
Default

Moved to the correct forum, hence my incorrect answer.
Reply With Quote
  #8  
Old 03-07-2013, 03:15 PM
Cerian Knight's Avatar
Cerian Knightwhat are the functions for disable the resize and put the window in center of screen? Cerian Knight is offline
Polymath (in disciplina)

Super Moderator
* Expert *
 
Join Date: May 2004
Location: Michigan
Posts: 4,185
Default

Quote:
Originally Posted by Flyguy View Post
Moved to the correct forum, hence my incorrect answer.
Yeah, not sure if there is a better way to do this in C/C++... but if API calls are what is asked for, then API calls I will give.
__________________
I got all the answers wrong on the GLAT, apparently even #9 (where I put a period in the middle of the box and labeled it 'singularity ripe for rapid inflation').
Reply With Quote
  #9  
Old 03-07-2013, 03:31 PM
Cerian Knight's Avatar
Cerian Knightwhat are the functions for disable the resize and put the window in center of screen? Cerian Knight is offline
Polymath (in disciplina)

Super Moderator
* Expert *
 
Join Date: May 2004
Location: Michigan
Posts: 4,185
Default

As far as disable resize goes, here is some off-site discussion on the topic:
http://forums.codeguru.com/showthrea...aximize-resize
I've only used those calls (with CreateWindow/Ex) from MASM (years ago).
__________________
I got all the answers wrong on the GLAT, apparently even #9 (where I put a period in the middle of the box and labeled it 'singularity ripe for rapid inflation').

Last edited by Cerian Knight; 03-07-2013 at 03:38 PM.
Reply With Quote
  #10  
Old 03-07-2013, 03:37 PM
Cambalinho_83's Avatar
Cambalinho_83 Cambalinho_83 is offline
Senior Contributor
 
Join Date: Feb 2008
Location: somewhere in space
Posts: 1,296
Default

Quote:
Originally Posted by Flyguy View Post
Moved to the correct forum, hence my incorrect answer.
at least thanks for try help me my friend
Reply With Quote
  #11  
Old 03-07-2013, 03:50 PM
Cambalinho_83's Avatar
Cambalinho_83 Cambalinho_83 is offline
Senior Contributor
 
Join Date: Feb 2008
Location: somewhere in space
Posts: 1,296
Default

Quote:
Originally Posted by Cerian Knight View Post
As far as disable resize goes, here is some off-site discussion on the topic:
http://forums.codeguru.com/showthrea...aximize-resize
I've only used those calls (with CreateWindow/Ex) from MASM (years ago).
thanks my friend. i did it
with some work i can do the fullscreen and hide the vertical scrool bar
now i will test the center of screen
thanks for all
Reply With Quote
  #12  
Old 03-07-2013, 04:05 PM
Cambalinho_83's Avatar
Cambalinho_83 Cambalinho_83 is offline
Senior Contributor
 
Join Date: Feb 2008
Location: somewhere in space
Posts: 1,296
Default

i try these code:

Code:
HWND hwndScreen;
	RECT rectScreen;
	hwndScreen=GetDesktopWindow ();
	GetWindowRect(hwndScreen,rectScreen); 
	
	SetWindowPos(Console.WindowHandle,NULL,(rectScreen.right\2)-(consolewidth\2),(rectScreen.bottom\2)-(consoleheight\2),500,500,SWP_NOOWNERZORDER);
but i recive these errors and i don't know why:
"Deleting intermediate files and output files for project 'test - Win32 Debug'.
--------------------Configuration: test - Win32 Debug--------------------
Compiling...
test.cpp
c:\test\test\test.cpp(43) : error C2664: 'GetWindowRect' : cannot convert parameter 2 from 'struct tagRECT' to 'struct tagRECT *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
c:\test\test\test.cpp(45) : error C2017: illegal escape sequence
c:\test\test\test.cpp(45) : error C2143: syntax error : missing ')' before 'constant'
c:\test\test\test.cpp(45) : error C2017: illegal escape sequence
c:\test\test\test.cpp(45) : error C2017: illegal escape sequence
c:\test\test\test.cpp(45) : error C2017: illegal escape sequence
c:\test\test\test.cpp(45) : error C2059: syntax error : ')'
Error executing cl.exe.

test.exe - 7 error(s), 0 warning(s)"
can anyone advice me?
Reply With Quote
  #13  
Old 03-07-2013, 04:11 PM
PlausiblyDamp's Avatar
PlausiblyDampwhat are the functions for disable the resize and put the window in center of screen? PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

http://msdn.microsoft.com/en-gb/libr...(v=vs.85).aspx - documentation can be a wonderful thing.

GetWindowRect takes two parameters - the second one being a pointer to a RECT structure. You are passing in a RECT not a pointer to a RECT.
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #14  
Old 03-07-2013, 04:13 PM
Cerian Knight's Avatar
Cerian Knightwhat are the functions for disable the resize and put the window in center of screen? Cerian Knight is offline
Polymath (in disciplina)

Super Moderator
* Expert *
 
Join Date: May 2004
Location: Michigan
Posts: 4,185
Default

I agree.
GetWindowRect(hwndScreen, &rectScreen);
?
__________________
I got all the answers wrong on the GLAT, apparently even #9 (where I put a period in the middle of the box and labeled it 'singularity ripe for rapid inflation').
Reply With Quote
  #15  
Old 03-07-2013, 04:14 PM
Cambalinho_83's Avatar
Cambalinho_83 Cambalinho_83 is offline
Senior Contributor
 
Join Date: Feb 2008
Location: somewhere in space
Posts: 1,296
Default

Quote:
Originally Posted by Cerian Knight View Post
GetWindowRect(hwndScreen, &rectScreen);
?
yes.. i did that now. but SetWindowPos() is give me the other errors
Reply With Quote
  #16  
Old 03-07-2013, 04:21 PM
PlausiblyDamp's Avatar
PlausiblyDampwhat are the functions for disable the resize and put the window in center of screen? PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #17  
Old 03-07-2013, 04:28 PM
Cambalinho_83's Avatar
Cambalinho_83 Cambalinho_83 is offline
Senior Contributor
 
Join Date: Feb 2008
Location: somewhere in space
Posts: 1,296
Default

Quote:
Originally Posted by PlausiblyDamp View Post
strange:
Code:
HWND hwndScreen;
	RECT rectScreen;
	hwndScreen=GetDesktopWindow ();
	GetWindowRect(hwndScreen,&rectScreen); 
	int ConsolePosX= rectScreen.right\2 - consolewidth\2;
	int ConsolePosY= rectScreen.bottom\2 - consoleheight\2;
	SetWindowPos(Console.WindowHandle,HWND_NOTOPMOST,ConsolePosX,ConsolePosY,500,500,SWP_NOOWNERZORDER);
errors:
"Deleting intermediate files and output files for project 'test - Win32 Debug'.
--------------------Configuration: test - Win32 Debug--------------------
Compiling...
test.cpp
c:\test\test\test.cpp(45) : error C2017: illegal escape sequence
c:\test\test\test.cpp(45) : error C2143: syntax error : missing ';' before 'constant'
c:\test\test\test.cpp(45) : error C2017: illegal escape sequence
c:\test\test\test.cpp(45) : error C2113: pointer can only be subtracted from another pointer
c:\test\test\test.cpp(45) : error C2143: syntax error : missing ';' before 'constant'
c:\test\test\test.cpp(46) : error C2017: illegal escape sequence
c:\test\test\test.cpp(46) : error C2143: syntax error : missing ';' before 'constant'
c:\test\test\test.cpp(46) : error C2017: illegal escape sequence
c:\test\test\test.cpp(46) : error C2113: pointer can only be subtracted from another pointer
c:\test\test\test.cpp(46) : error C2143: syntax error : missing ';' before 'constant'
Error executing cl.exe.

test.exe - 10 error(s), 0 warning(s)"
i don't understand
Reply With Quote
  #18  
Old 03-07-2013, 04:30 PM
PlausiblyDamp's Avatar
PlausiblyDampwhat are the functions for disable the resize and put the window in center of screen? PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

So which character is used as the divide operator and which character are you using to divide?
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #19  
Old 03-07-2013, 04:34 PM
Cambalinho_83's Avatar
Cambalinho_83 Cambalinho_83 is offline
Senior Contributor
 
Join Date: Feb 2008
Location: somewhere in space
Posts: 1,296
Default

Quote:
Originally Posted by PlausiblyDamp View Post
So which character is used as the divide operator and which character are you using to divide?
lol you have right lol
now i change to '/'.. heres the errors:
"Deleting intermediate files and output files for project 'test - Win32 Debug'.
--------------------Configuration: test - Win32 Debug--------------------
Compiling...
test.cpp
c:\test\test\test.cpp(45) : error C2296: '/' : illegal, left operand has type 'int (__cdecl *)(void)'
c:\test\test\test.cpp(46) : error C2296: '/' : illegal, left operand has type 'int (__cdecl *)(void)'
Error executing cl.exe.

test.exe - 2 error(s), 0 warning(s)"
Reply With Quote
  #20  
Old 03-10-2013, 11:11 AM
PlausiblyDamp's Avatar
PlausiblyDampwhat are the functions for disable the resize and put the window in center of screen? PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

Those errors look like it is trying to assign the result of the division to a function that returns an int rather than to a variable of type int.

Do you have the names ConsolePosX and ConsolePosY used anywhere else in your code?
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
what are the functions for disable the resize and put the window in center of screen?
what are the functions for disable the resize and put the window in center of screen?
what are the functions for disable the resize and put the window in center of screen? what are the functions for disable the resize and put the window in center of screen?
what are the functions for disable the resize and put the window in center of screen?
what are the functions for disable the resize and put the window in center of screen?
what are the functions for disable the resize and put the window in center of screen? what are the functions for disable the resize and put the window in center of screen? what are the functions for disable the resize and put the window in center of screen? what are the functions for disable the resize and put the window in center of screen? what are the functions for disable the resize and put the window in center of screen? what are the functions for disable the resize and put the window in center of screen? what are the functions for disable the resize and put the window in center of screen?
what are the functions for disable the resize and put the window in center of screen?
what are the functions for disable the resize and put the window in center of screen?
 
what are the functions for disable the resize and put the window in center of screen?
what are the functions for disable the resize and put the window in center of screen?
 
-->