C
C#15mo ago
krazycay

❔ how to detect if console app is maximized (IsZoomed)

i don't know how to correctly call IsZoomed in this case, so if anyones willing to help out it'd be really appreciated.
// example
while (true)
{
if (IsZoomed)
{
// do code
}
}
// example
while (true)
{
if (IsZoomed)
{
// do code
}
}
32 Replies
Rotaerk
Rotaerk15mo ago
what's IsZoomed
krazycay
krazycay15mo ago
it checks if the console is maximized, i just dont know how to call it
Rotaerk
Rotaerk15mo ago
but where's it defined
krazycay
krazycay15mo ago
krazycay
krazycay15mo ago
Rotaerk
Rotaerk15mo ago
what API is this? do you know how to call a method in general?
krazycay
krazycay15mo ago
wdym?
Rotaerk
Rotaerk15mo ago
what's the URL to that documentation in your first screenshot?
Rotaerk
Rotaerk15mo ago
so you're using the Win32 API this page is documentation for C++, not for C# do you know how to call a method in C#?
krazycay
krazycay15mo ago
i'm using c#, but uh i sort of do and don't ig
Rotaerk
Rotaerk15mo ago
if I give you this class:
static class Foo
{
public static int Add(int a, int b) { return a + b; }
}
static class Foo
{
public static int Add(int a, int b) { return a + b; }
}
can you write code that calls Add?
krazycay
krazycay15mo ago
no.
Rotaerk
Rotaerk15mo ago
sounds like you need to learn the basics. you don't even have a foundation in C#, and you're trying to do Win32 API coding 😛 go read a book or go through learning materials like https://dotnet.microsoft.com/en-us/learn/csharp also, any particular reason you picked Win32 API?
krazycay
krazycay15mo ago
it's the only way i can do what i'm looking to do, anyway can you just answer my question? i'm not asking for a full on book or whatever, or advice, just how i can do what im wanting to do not to sound rude at all but i do need to know how to do what i asked
Rotaerk
Rotaerk15mo ago
problem is, if you are asking about something so fundamental as how to call a method, then you're probably going to have dozens of other fundamental questions. and it would be a bit troublesome to for the server to have to answer every fundamental question you have when they could all be covered by just taking the time to actually read/watch some learning materials but to answer this specific question, I will demonstrate it in terms of the Foo class above to call add you would do Foo.Add(5, 6); that is for static methods only
krazycay
krazycay15mo ago
one of the only reasons i joined this server is for this, and a few other things. i don't plan to bug anyone after i fix what i need to fix it's just the core to what i need to do
Rotaerk
Rotaerk15mo ago
the server is all for helping but it needs to be reasonable like there needs to be some amount of reasonable effort on your part
krazycay
krazycay15mo ago
listen. i don't need advice, i did not ask for anything of this sorts. i just need an answer of how i can do what i need to do.
Rotaerk
Rotaerk15mo ago
I did not ask for your question, but you asked it anyway not-asking for something doesn't mean you won't get it though and this isn't advice, this is push-back criticism
krazycay
krazycay15mo ago
true but i wasn't asking specifically you to help me, i did not ask for YOUR specific help And to comeback your statement, by you NOT helping me I'll just ask plenty others. @Rotaerk Which is going against you not wanting me to ask people for help constantly
Rotaerk
Rotaerk15mo ago
asking for help is fine. but when the answer is "read this", refusing is not reasonable on your part you are asking to be spoonfed
krazycay
krazycay15mo ago
Listen, I don't want to be rude, but if you aren't willing to help with what i asked for, please leave the thread.
Rotaerk
Rotaerk15mo ago
if you are going to be like this, please leave the server...
krazycay
krazycay15mo ago
I don't appreciate what your doing and if you continue, it's just a waste of your own time.
Axiss
Axiss15mo ago
That api you showed needs a window handle and console apps, by definition, don't have window handles.
krazycay
krazycay15mo ago
problem is, i've seen it done before. i just don't know how.
sibber
sibber15mo ago
this may not be as simple as you may think why do you need this?
Aurumaker72
Aurumaker7215mo ago
You need to get the console host's HWND first
Aurumaker72
Aurumaker7215mo ago
Stack Overflow
How do I get the handle of a console application's window
Can someone tell me how to get the handle of a Windows console application in C#? In a Windows Forms application, I would normally try this.Handle.
Aurumaker72
Aurumaker7215mo ago
Then you call IsZoomed Alternatively, you can call GetWindowPlacement and compare the returned WINDOWPLACEMENT's showCmd field against SW_MAXIMIZE
Accord
Accord15mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.