C
C#2y 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
Rotaerk2y ago
what's IsZoomed
krazycay
krazycayOP2y ago
it checks if the console is maximized, i just dont know how to call it
Rotaerk
Rotaerk2y ago
but where's it defined
krazycay
krazycayOP2y ago
krazycay
krazycayOP2y ago
Rotaerk
Rotaerk2y ago
what API is this? do you know how to call a method in general?
krazycay
krazycayOP2y ago
wdym?
Rotaerk
Rotaerk2y ago
what's the URL to that documentation in your first screenshot?
Rotaerk
Rotaerk2y 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
krazycayOP2y ago
i'm using c#, but uh i sort of do and don't ig
Rotaerk
Rotaerk2y 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
krazycayOP2y ago
no.
Rotaerk
Rotaerk2y 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
krazycayOP2y 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
Rotaerk2y 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
krazycayOP2y 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
Rotaerk2y 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
krazycayOP2y 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
Rotaerk2y 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
krazycayOP2y 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
Rotaerk2y 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
krazycayOP2y 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
Rotaerk2y ago
if you are going to be like this, please leave the server...
krazycay
krazycayOP2y ago
I don't appreciate what your doing and if you continue, it's just a waste of your own time.
Axiss
Axiss2y ago
That api you showed needs a window handle and console apps, by definition, don't have window handles.
krazycay
krazycayOP2y ago
problem is, i've seen it done before. i just don't know how.
sibber
sibber2y ago
this may not be as simple as you may think why do you need this?
Aurumaker72
Aurumaker722y ago
You need to get the console host's HWND first
Aurumaker72
Aurumaker722y 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
Aurumaker722y ago
Then you call IsZoomed Alternatively, you can call GetWindowPlacement and compare the returned WINDOWPLACEMENT's showCmd field against SW_MAXIMIZE
Accord
Accord2y 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.
Want results from more Discord servers?
Add your server