Page 1 of 6 1234 ... LastLast
Results 1 to 40 of 230

Thread: Should i learn VB6?

  1. #1

    Thread Starter
    New Member Gourav Das's Avatar
    Join Date
    Oct 2017
    Posts
    1

    Unhappy Should i learn VB6?

    I have installed VB6 on my windows 10 laptop without ADO and RDS option. .I am not sure whether i will be able to harness and use most parts of the software in windows 10. Can anyone share some light.

    I like visual basic very much its easy and understandable , i am just scared that once i jump in it and half-way of my learning journey , i dont want to quit because of some part becoming obsolete and not running on windows 10 (latest version).

    Please share some light

  2. #2
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,531

    Re: Should i learn VB6?

    Like a lot of things in development: It depends. Honestly, if you're just starting out, and want to build a future, I wouldn't bother with VB6. Instead, I'd focus on something like C# or, JAva, or something else like Web Development, something with a bit more staying power. If you plan for it to just be a hobby and just dabble in it, then there's probably no harm, but you might want to also look at Vb.NET and install VS 2019 and work with some of the latest version - albiet, it's really different, but the same. But really, it just depends on what you expect to get out of it and what you plan to do with it.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Should i learn VB6?

    I couldn't say it better, techgnome is on point.

    if I would start out today I would look for a cross-platform language, so I can aim at windows, linux, mac and if possible androids and other phones.

    if I just want to play around in windows, I don't have any need to distribute my programs to anything else and I don't care about phones, I would still look for something else, since VB6 is outdated I will need more work if I want to create modern applications.
    BUT, theres tons of sources available for VB6, that alone is a good motivator to use VB6.

  4. #4
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,834

    Re: Should i learn VB6?

    As mentioned if you just want to knock around on your own go with VB .Net. Something to consider about starting with VB 6.0 is it is no longer supported and I don't think it is going to be around after Windows 10 goes by the wayside (I'm not positive about that).
    Please remember next time...elections matter!

  5. #5
    Addicted Member habenero's Avatar
    Join Date
    Aug 2015
    Posts
    224

    Re: Should i learn VB6?

    just my 2 cents (maybe even lower than that)

    I purchased VB6 learning edition in '97 (?) Still using it for my own purposes will never post code to the world. I am sure that you can get higher versions of VB6 for really cheap $$. That being said - if everyone were to jettison VB6 I think this site would be the crickets sound But to the credit of all the veterans in VB6 that are willing to help newbies/hobbyists like me VB6 will live on a bit longer. For me I wouldnt change ships. If you are really new and want to learn programming its a toss up. Yes Java and any development lang for android would get into the fast track of fame - so to speak. I even fool around with C++

    Jeff

  6. #6
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,531

    Re: Should i learn VB6?

    Yeah, it jsut really depends on what you want to do. Don't get me wrong, VB6 is a phenomenal language, and works just fine under Win10. And there's a number of people here that have done a fantastic job extending it even further. If all you plan is some tinkering, experimenting, or maybe some small utilities for yourself, then by all means, have at it... but anything beyond that... anything further... well... the posts above pretty much cover it.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  7. #7
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Should i learn VB6?

    Quote Originally Posted by Gourav Das View Post
    I have installed VB6 on my windows 10 laptop without ADO and RDS option. .I am not sure whether i will be able to harness and use most parts of the software in windows 10. Can anyone share some light.

    I like visual basic very much its easy and understandable , i am just scared that once i jump in it and half-way of my learning journey , i dont want to quit because of some part becoming obsolete and not running on windows 10 (latest version).

    Please share some light
    I'm just gonna out and say it. Don't. VB6's main thing is developing desktop applications for Windows. If that is what you want to learn VB6 for, I suggest you learn VB.Net instead. And if you're really serious about getting the best bang for your buck, you should probably skip VB entirely and go with C# + .Net for Windows Desktop development.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  8. #8
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Should i learn VB6?

    If your real focus is Windows Desktop applications, C# with .Net Core is the bleeding edge right now. You can still opt to use VB.Net with .Net Core but VB is in maintenance mode. MS is no longer going to be developing the Visual Basic language. C# on the other hand, is still constantly evolving with no signs of slowing down. C# has also has the extra benefit of being the language of choice for all kinds of non-Desktop development, even outside of the Windows platform. Visual Studio 2019 is free to download. You can jump right in now if you wanted to.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  9. #9
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,418

    Re: Should i learn VB6?

    I'm with Baka on this one: If just starting out, don't learn VB6.
    Look for cross-platform (everything baka said).

    For that purpose i go with FreePascal/Lazarus: Open Source, Free, Cross-Platform, good Support/Community
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  10. #10
    Addicted Member
    Join Date
    Aug 2013
    Posts
    236

    Re: Should i learn VB6?

    If I were beginning right now with no particular project in mind I'd choose python as my starting point.
    You can do loads with it as a hobbyist (see here, for example) but also tons of well paid jobs, I believe.
    VB6 is great but it's a complete dead end career-wise.
    It never looked good on a resume but now it would make you look odd if you said you took it up in 2021
    Last edited by vbrad; Jan 13th, 2021 at 06:56 AM.

  11. #11
    Junior Member
    Join Date
    Jan 2017
    Posts
    30

    Re: Should i learn VB6?

    I'm with Niya, C# you can use Xamarin and target android, ios, and desktop at the same time (not sure if desktop part of that is out of preview yet but its workable)
    Only learn vb6 if you really have to.
    If you want to go low level to learn more about memory management go for C or C++

  12. #12
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Should i learn VB6?

    Learning C/C++ is ALWAYS a good bet. Despite all the different stuff we have out here now to create applications, the world still runs on C.

    I wouldn't use it to write Windows desktop applications but it has great value in soooo many domains outside of the Windows desktop.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  13. #13
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Should i learn VB6?

    I just stumbled on another valid reason beside having to maintain old VB6 code that one could want to use VB6, obfuscation. I trying to find some information on the internals of VB6 as I was recently involved in a discussion here on this and I stumbled on this. Long story short, it seems that there is no official documentation on VB6's p-code and the virtual machine that executes it which makes it extremely difficult for cyber security specialists to deal with. VB6 is perfect for writing malicious code because even for the best experts, it would be hard to figure out what a p-code compiled VB6 binary actually does. It all comes down laborious guess work because of the lack of official documentation on VB6's non-native execution engine.

    This may also make legitimate software harder to crack as well. Native code and .Net's MSIL is well understood and well document so the level of difficulty in hacking or understanding their binaries is far lower.

    However, note this doesn't mean it's impossible. If someone one's to crack your software badly enough, they will, no matter what it's written in so this should never be a metric to help you decide what language to write software in.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  14. #14
    PowerPoster
    Join Date
    Feb 2015
    Posts
    2,671

    Re: Should i learn VB6?

    P-code is the quite interesting thing i've researched this for years. For example if you want to do some codegeneration thing you could use the VB6-VM to run your own code. As far as i know there are 2 p-code in VB6. The first one is the usual p-code which runs in the vba6/msvbvm60 virtual machine. The second one is IL-code for compiler. Such code you can see in the modern Visual Studios as well. VB6 translates usual p-code to compiler IL-code when you compile a project to native code. C2.exe is nothing more than C2.dll from Visual Studio with the additional/other options:

  15. #15
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Should i learn VB6?

    Quote Originally Posted by The trick View Post
    P-code is the quite interesting thing i've researched this for years. For example if you want to do some codegeneration thing you could use the VB6-VM to run your own code. As far as i know there are 2 p-code in VB6. The first one is the usual p-code which runs in the vba6/msvbvm60 virtual machine. The second one is IL-code for compiler. Such code you can see in the modern Visual Studios as well. VB6 translates usual p-code to compiler IL-code when you compile a project to native code. C2.exe is nothing more than C2.dll from Visual Studio with the additional/other options:
    Wait, are you saying that modern versions of Visual Studio still ships VB6's p-code compiler?
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  16. #16
    PowerPoster
    Join Date
    Feb 2015
    Posts
    2,671

    Re: Should i learn VB6?

    Quote Originally Posted by Niya View Post
    Wait, are you saying that modern versions of Visual Studio still ships VB6's p-code compiler?
    No-no. I meant the IL-code is similar. IL-code is the code which is used by the MS-compiler. VB6 translates P-code to IL-code during compile time.
    Moreover you can compile a VB6 code using Visual Studio 2010 compiler and it'll compiled successfully! Note that it compiles very limited code because the key "-basic" is not supported. This is all to show that theoretically you can use a compiler from newer studios for a hypothetical VB7.

    Just the proof:


  17. #17
    Frenzied Member
    Join Date
    Feb 2003
    Posts
    1,807

    Re: Should i learn VB6?

    Vb6 is a decent language for its time and is decent enough for 32-bit applications. Proper usage of API's and extensions will compensate for the language's age. Having said that, C# is a much more up to date language still supported by Microsoft. I believe it is also fairly popular for professional development but don't hold me to it. A lot depends on what you want to do. If you want to learn about programming in general you might want to try a few languages with different paradigisms to gain experience about how to do accomplish the same task using different approaches.
    Last edited by Peter Swinkels; Jan 19th, 2021 at 06:23 AM. Reason: typo

  18. #18
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Should i learn VB6?

    I use VB6 but without using the components (except for pictureboxes) my latest project that compiles around 1MB uses 3 pictureboxes and only 1 is visible when running.
    so for me it doesnt matter if the activex gets old or not working, it doesnt matter about dpi awareness issues, since Im using direct2d.
    people could tell me, why the hell are you using VB6 when you are not using the rad functionality of it.
    but for me, it would not matter much, if using another language where I need to do exactly the same. why not keep using VB6 as I found the language easy to use and I love the debug functionality.
    even without using component I still need to run it, and check for errors. the IDE is perfect, nicely created, not too many options and not too few.

    so, VB6. if u want RAD and modern, it will require you to use activex or lots of alternatives to make it look modern. and that will slow things down.
    there will be bugs, issues and so on, to make use of all the improvement.
    there is the dilemma, to keep using VB6 and replace the old or skip VB6 and find a modern language where u dont need the hassle to replace stuff.

    for me, I really dont have this issue since Im not using it at all. I just use the language and the debugger. and for me I really enjoy doing that and is enough.
    but sure, if I could get a 64bit compiler that would improve, and if someone smart can make a new compiler that is "smarter" and makes the code optimized I couldnt ask for more.

  19. #19
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,235

    Re: Should i learn VB6?

    My experience is that there is still no better combination for learning to program than the VB6 language and the VB6 IDE. BASIC is an amazing language that stands the test of time, introducing the beginner to simple coding methods then leading from this to some advanced programming concepts. BASIC can do it.

    The VB6 IDE is more fluid and easy to get to grips with than VS with all its bloat and options. VB6 runs so quickly.

    A overlooked benefit to VB6 is that almost every problem tht the new user encounters has a solution already documented and coded, that is the result of the language existing for decades.

    My suggestion for the beginner is to learn VB6 to learn a compileable language that uses forms and controls and then also attempt a similar foray into a scripting language such as javascript. This will allow you to learn the syntax and methods of two different languages. I honed my skills on attractive desktop widgets using YWE/javascript and BASIC for my larger projects. Combined the two gave me a perspective on two different approaches to creating desktop applications. Neither environment is currently supported but they are still elegant solutions in themselves and better still - good learning tools.

    VB6 may well have a future yet (we will see) and I believe javascript or a derivative of it will be there for years to come.

    My answer then is yes, VB6 is still a good place for a beginner and it leads to other, better things.

  20. #20
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Should i learn VB6?

    Quote Originally Posted by yereverluvinuncleber View Post
    My experience is that there is still no better combination for learning to program than the VB6 language and the VB6 IDE. BASIC is an amazing language that stands the test of time, introducing the beginner to simple coding methods then leading from this to some advanced programming concepts. BASIC can do it.

    The VB6 IDE is more fluid and easy to get to grips with than VS with all its bloat and options. VB6 runs so quickly.

    A overlooked benefit to VB6 is that almost every problem tht the new user encounters has a solution already documented and coded, that is the result of the language existing for decades.

    My suggestion for the beginner is to learn VB6 to learn a compileable language that uses forms and controls and then also attempt a similar foray into a scripting language such as javascript. This will allow you to learn the syntax and methods of two different languages. I honed my skills on attractive desktop widgets using YWE/javascript and BASIC for my larger projects. Combined the two gave me a perspective on two different approaches to creating desktop applications. Neither environment is currently supported but they are still elegant solutions in themselves and better still - good learning tools.

    VB6 may well have a future yet (we will see) and I believe javascript or a derivative of it will be there for years to come.

    My answer then is yes, VB6 is still a good place for a beginner and it leads to other, better things.
    I absolutely do not recommend VB6 even as a choice to just learn, just the opposite in fact. Firstly, VB6 isn't free so unless you're willing to pirate it, it's unlikely you will get a copy easily. Secondly, it is a tremendous pain to get working on modern Windows versions. I mean just look at this complicated set of steps you need to take to get it to work on Windows 10. I recently installed VB6 for the first time in something like 6 years when I was participating in that thread about Any parameters and it was a bit hellish. I ultimately didn't have to do anything as complicated as described in that link but it took quite a bit a effort to get it to actually install. Finally, and this is huge, no documentation. It is literally impossible to find comprehensive documentation on VB6 on the internet anymore. All of my recent participations in VB6 threads on these boards have been 90% from memory and 10% actually testing stuff myself. I cannot find even the simplest piece of information on writing VB6 applications outside of these boards and a few sites here and there. For example, just before writing this very post, I was trying to find out whether a Double in VB6 is 32 bits or 64 bits. I couldn't even find something that simple within Microsoft's own documentation. This utter lack of official documentation is my biggest reason for avoiding VB6 as means to learn. You're going to have an extremely difficult time learning VB6 without the official documentation. You might be able to get by on the odd article here and there but official documentation is a huge help in filling the gaps left by un-official documents.

    VB.Net is every bit as easy as VB6 for a beginner. The latest version of Visual Studio is 100% free, very easy to find, download and install. Officual documentation on VB.Net is extremely easy to find. VB6 has no advantage here.
    Last edited by Niya; Jan 19th, 2021 at 09:58 PM.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  21. #21
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Should i learn VB6?

    There isn't much to discuss. Just use what you want, choosing a tool that supports your target environment easily.

  22. #22
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,995

    Re: Should i learn VB6?

    Quote Originally Posted by Niya View Post
    Finally, and this is huge, no documentation. It is literally impossible to find comprehensive documentation on VB6 on the internet anymore. All of my recent participations in VB6 threads on these boards have been 90% from memory and 10% actually testing stuff myself. I cannot find even the simplest piece of information on writing VB6 applications outside of these boards and a few sites here and there. For example, just before writing this very post, I was trying to find out whether a Double in VB6 is 32 bits or 64 bits. I couldn't even find something that simple within Microsoft's own documentation. This utter lack of official documentation is my biggest reason for avoiding VB6 as means to learn. You're going to have an extremely difficult time learning VB6 without the official documentation. You might be able to get by on the odd article here and there but official documentation is a huge help in filling the gaps left by un-official documents.
    Well, official documentation is not online because MS did all kind of efforts to bury VB6, and the only official documentation can be from them, but they do not publish it anymore.

    My experience is the opposite: every time I want to research something, I find the information published on internet. Although the sites are decreasing over the time.

    Anyway, MS is lucky to have people like you, helping them to bury VB6, and for free.

    Quote Originally Posted by Niya View Post
    VB.Net is every bit as easy as VB6 for a beginner. The latest version of Visual Studio is 100% free, very easy to find, download and install. Officual documentation on VB.Net is extremely easy to find. VB6 has no advantage here.
    VB.NET easy compared to VB6?
    I mean, VB6 as is was originally, not with all the problems that MS caused.

    (.NET) System.Drawing.Whatever.Another.Whaterver2
    (VB6) Object:PaintPicture

    (.NET) Sender as Object, Argument As System.Arguments.Positions.Horizontal
    (VB6) X As Single

    VB6 is much more intelligent, it figures out what you are talking about without having to explain everything to it.

    The above are not real neither remotely accurate, mostly because I have no idea of .NET, but I saw things like that.

    I believe that most people here do not respond to you because they are tired, they did it too many times with too many converts (the ones that saw the light in .NET) already.

    For the OP: I would not recoment to learn VB6 to a beginner, it is perhaps the best programming language that ever existed, but MS fought against it and... only in the case that appears a replacement I would start recomending learning it again for new programmers.

    PS: Have you already studied the advantages of using twips?

  23. #23
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: Should i learn VB6?

    Quote Originally Posted by Niya View Post
    ... just before writing this very post,
    I was trying to find out whether a Double in VB6 is 32 bits or 64 bits.
    Hint for your google-fu:
    - when you search info for VB6
    - put a [... -.NET] to the end of your search-input

    This will route you more directly to "the good bits"...

    Olaf

  24. #24
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,235

    Re: Should i learn VB6?

    Niya, it is quite true that VB6 is hard to get hold of for beginners in general and I confirm it is a good reason to put off a newbie - but the OP has it already and as he is asking the question so for him that's not really relevant.

    Documentation? BASIC is BASIC and it is documented everywhere, BASIC is still real. With regard to VB6 specific documentation, it is not essential as I have found all the documentation I have ever needed is available in code examples on youtube and websites/forums such as this.

    In addition there is the amazing and useful VB forum. The VB crowd can be an argumentative crowd on occasion but at a push they are also friendly and helpful.

  25. #25
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Should i learn VB6?

    Quote Originally Posted by Eduardo- View Post
    Anyway, MS is lucky to have people like you, helping them to bury VB6, and for free.
    Quote Originally Posted by Eduardo- View Post
    I believe that most people here do not respond to you because they are tired, they did it too many times with too many converts (the ones that saw the light in .NET) already.
    I stopped taking you seriously when you made these statements. You're clearly not being objective and anything you say is tainted with personal bias. You have too much emotion invested in this. VB6 is a tool. VB.Net is a tool. Do you care this much about a lawnmower being better than a hoe?

    Quote Originally Posted by Schmidt View Post
    Hint for your google-fu:
    - when you search info for VB6
    - put a [... -.NET] to the end of your search-input

    This will route you more directly to "the good bits"...

    Olaf
    Oh I did get the information but not from an official source. I got it on some blog. It's not that I don't trust unofficially sources but MS documentation is usually very thorough which is why I prefer to find certain types of information in the MSDN docs. Blogs and forums don't typically cover everything there is to know about a particular data type, class, interface etc.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  26. #26
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,421

    Re: Should i learn VB6?

    After using more than a dozen programming languages and writing millions of lines of code, I decided to make Basic and JavaScript language my future research direction and the focus of my work.

  27. #27
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,995

    Re: Should i learn VB6?

    Quote Originally Posted by Niya View Post
    I stopped taking you seriously when you made these statements. You're clearly not being objective and anything you say is tainted with personal bias. You have too much emotion invested in this. VB6 is a tool. VB.Net is a tool. Do you care this much about a lawnmower being better than a hoe?
    You are a .NET evangelist, you do not waste opportunity to talk against VB6. Personal or not personal, that's the thuth.

    What you are after is to demoralize people here.

    Emotional? Maybe. Yes, I don't like what you do.

  28. #28
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Should i learn VB6?

    I agree with Eduardo- here. its one thing to give a constructive criticism, cons and pros of using VB6, but most of the time its like you are against VB6.
    but VB6 is great, old, but great. outdated, but great.
    that is why most of us are waiting for the next thing, a VB7, or a new tool that we can use alongside VB6.
    migration to another language, we only do because we are "forced" to do it, not because "we want".

  29. #29
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,531

    Re: Should i learn VB6?

    It's been 8 days since the OP has posted... anything. They are either gone, or simply reading through the replies and watching, or somehting... either way, they haven't weighed in since. LEt's not turn this into another holy war. There's plenty of other threads around here for that. Stick to the question at hand and try to be objective about it. If you can, go start your own thread and flan the flames of your evangelism somewhere else.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  30. #30
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Should i learn VB6?

    Quote Originally Posted by Eduardo- View Post
    You are a .NET evangelist, you do not waste opportunity to talk against VB6. Personal or not personal, that's the thuth.
    I have zero problems with anyone who loves VB6 but objectively speaking, VB.Net is much better. That's the truth.

    I have been getting into these debates on this forum since I got here and in all those years I have not heard a single thing that would convince me that VB6 is a better choice than VB.Net for anything.

    The only thing I can think of that VB6 has that is better is it's native code compiler which Olaf proved to me many years ago has the ability to produce very high performance code comparable to the best C compilers. But this is just one thing and it's too small a thing to justify any argument that VB6 is better. Most people who use VB6 are writing business applications. No one is thinking about squeezing every ounce of performance out of the CPU for a pay roll application. They just want to knock it together quickly and get paid. VB.Net is better at this.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  31. #31
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,995

    Re: Should i learn VB6?

    Quote Originally Posted by Niya View Post
    I have been getting into these debates on this forum since I got here and in all those years I have not heard a single thing that would convince me that VB6 is a better choice than VB.Net for anything.
    There are probably many things, but let's talk about one:
    Using scales in twips is much more convenient than pixels for making applications DPI aware.
    Anyway I have no idea how .NET deals with DPI awareness. Perhaps it has something totally automatic, transparent and ready to go (it is what I would expect from a new language)

  32. #32
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Should i learn VB6?

    Quote Originally Posted by Eduardo- View Post
    Anyway I have no idea how .NET deals with DPI awareness. Perhaps it has something totally automatic, transparent and ready to go (it is what I would expect from a new language)
    Quote Originally Posted by Eduardo- View Post
    PS: Have you already studied the advantages of using twips?
    DPI and screen resolutions are very involved topics. There is no one size fits all in this arena. Narrow it down a bit and give me an example of a problem in that space you've had to solve using Twips and I'll look into how .Net does it.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  33. #33
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,995

    Re: Should i learn VB6?

    Quote Originally Posted by Niya View Post
    DPI and screen resolutions are very involved topics. There is no one size fits all in this arena. Narrow it down a bit and give me an example of a problem in that space you've had to solve using Twips and I'll look into how .Net does it.
    Being DPI aware is actually a quite narrow topic.
    I realize you don't know about it, so I suggest reading this tutorial.
    At least read a bit, until you get the main concepts (the tutorial goes into many details for VB6).
    And if you have (specific) questions, just ask.

  34. #34
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Should i learn VB6?

    Quote Originally Posted by Eduardo- View Post
    Being DPI aware is actually a quite narrow topic.
    I realize you don't know about it, so I suggest reading this tutorial.
    At least read a bit, until you get the main concepts (the tutorial goes into many details for VB6).
    And if you have (specific) questions, just ask.
    That doesn't answer my question.

    See, I remember you mentioning it in the other thread where I said I hated this TwipsPerPixel concept VB6 uses. That day I actually did spent at least 2 hours looking into it. I even went so far as to experiment with it a bit. Because despite what you might believe, I do listen to other people's points to try and see where they are coming from. I spent a fair amount of time that day trying to figure out how what you gained by using Twips in VB6.

    Ultimately, I wasn't able to find a problem. The only problem I've discovered in all this is that when you change the scale and layout settings in Windows 10, your apps can get a little blurry but nothing I or any of our clients wouldn't be able to live with.

    So I am asking....what in particular does using Twips do for you? Give me an example of how Twips helped you solve a problem. Because as far as I can tell, Windows applications in general, regardless of what they were written in, seem to have no problem dealing with different size monitors, resolutions or DPI settings. I have never had a reason to consider DPI when writing any program.

    The biggest challenge I've ever had when it comes to dealing with DPI or different resolutions and whatnot is making my Forms look reasonable on multiple resolutions and I have found ways to deal with these issues before that never involved me having to dip into DPI awareness or using Twips. I remember even back when I was using VB6, I had to solve quite a few layout issues mostly with writing custom controls. I certainly didn't need Twips to solve them it, in fact it, I remember that got in the way quite a bit. Towards the end of my tenure with VB6, I had gotten into the habit of setting the ScaleMode on everything to vbPixels. I just didn't want to deal with Twips anymore. They were just getting in the way when I had to do complicated layout calculations, especially when the Win32 API was involved. The Win32 API deals only in pixels. GetWindowRect is the most prominent example I recall from my own experience.

    These days I'm using WPF to write Windows Desktop applications now and it has very powerful layout capabilities that lend themselves quite naturally to creating Forms that present themselves decently on any resolution so this problem is largely a thing of the past for me.

    Now, I am 100% sure that I wasn't using Twips correctly but my point is I was able to get along just fine pretending it didn't exist. This is why I am asking you about it because I just can't see it why it's as important as you make it out to be. Help me to understand why.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  35. #35
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Should i learn VB6?

    Also, if the blurriness itself is the problem you're talking about. You just have make a couple of very minor changes to a .Net project and that blurriness goes away. It would look crisp and properly laid out no matter what DPI setting you use.

    And assuming that this is the problem you're referring to, how can Twips be used to solve this? As far as I understand and feel free to correct me if I'm wrong, the blurriness comes from the fact that an application is not DPI aware so Windows just takes a Bitmap snapshot of the Windows and scales it up so it loses quality. All my research into this point to application manifests being a solution to this. Where does Twips come into play?
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  36. #36
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,995

    Re: Should i learn VB6?

    Ok, you have to understand that I'm willing to spend much time explaining how to do things in VB6 to someone that does not use VB6 and "hates" it.

    But if you spent two hours trying to understand this topic and you didn't do it, I think I'll spend at least ten minutes trying to explain it.

    The other reason I didn't explain it to you before is because I already explained it in the forum several times, but now I do not feel like it to try to find those posts (that in general were answers to people and do not remember their thread titles).

    But it seems that you already grasped the main idea: the problem is the blurriness.
    You say that you don't mind, and your user either. OK, that's one position. It is valid. I have some (old) programs I left like that. The other is a bit more "perfectionist" if you want.

    OK. One thing is the screen resolution and another thing is the DPI setting.

    Some background (that surely you already know):
    The monitors have a native, physical resolution. For example the monitor I'm using now has 1920x1080 physical pixels.
    Apart from that, Windows let you specify the resolution, you can use the one that match the physical or another one.
    So, there is a physical resolution, and a logical resolution.
    It is recommended, specially with LCD monitors to use the logical resolution that matches the physical one (Windows says "recommended").
    When you are using a logical resolution that does not match the physical one, the video driver scales everything.
    But you already know all that. I'm just explaining it to set the ground.

    There is something else in monitors and also printers and other devices that are the dots-per-inch. How many dots there are in a physical inch. The printer normally have 300, 600, 1200 dots-per-inch.
    Monitors also has dots-per-inch, but the dots are pixels, so they are pixels-per-inch. Physically. How many pixels there are in a inch.
    But Windows does not care much about the real DPI of monitors, that is the same to say that it does not take into account the monitors physical dimensions. Instead, it works with logical DPIs.

    Windows let you set the logical DPI setting that you want: 100%, 125%, 150%, 200%, custom setting.
    100% is 96 DPI
    125% is 120 DPI
    150% is 144 DPI
    200% is 192 DPI

    So, if you have a monitor that has 1920 pixels horizontal, 100% DPI is 20 inches wide: 1920/96 = 20.
    That's logical, not physical. To know the physical size you need to use a ruler.
    If you set the same monitor to 125%, that's 16 inches wide logically.
    And so on, 200% is 10 inches.

    Of course the monitor does not change its physical size when you change that Windows setting, then when you set it to 200%, you are basically saying that your monitor is smaller but with more pixels per inch.

    For many programs that would mean nothing, because the screen still have the same 1920x1080 pixels, so if you work in pixels it means that you don't care what the final user sets there (the DPI setting).
    But the user is trying to say something, or that the monitor is physically smaller, or that he is not comfortable with the size of the elements in the screen and wants everything bigger. If you ignore that, you are ignoring a setting by the user.

    OK, if the issue stops there, the program would be rendered in the same size you developed it (if you developed the sizes in pixels with a DPI unaware tool, - I think C++ worked like that, but not sure currently-), not matter the DPI setting the user has set. That was the case of Windows XP.

    So, what would be expected from the apps? That if the user set a higher DPI setting, the program should make every UI element a bit bigger, because or the user has a small sized monitor (but not low resolution) or the user wants to see every element bigger (that is the normal case).

    The OS itself responded well to the setting change, they prepared it for that, but not most apps.
    Developers mostly developed like everybody has 96 DPI.

    But it seems to me that with LCD monitors, and the tech generation getting old, setting more than 96 DPI started being more common and MS acknowledged the issue. When people changed setting the OS UI elements looked bigger but not most of the programs windows.

    Then, with Windows Vista this thing changed.
    Now the OS will help to make app bigger.
    How? Stretching the windows. Something like a StretchBLT for every window that is not prepared to scale (properly) itself by own code.
    The result: blurriness.

    But wait, some developers worked to add code to adapt the program to the DPI, not everyone was ignoring the issue.
    OK, if you had your program ready to handle it itself, you need to say it. The default is that you don't.
    There is where the manifest file comes into play. You need to declare in the manifest file that your program is "DPI aware" that means that whether you are handling it yourself, or that you prefer to show everything smaller but crisp (normally the first option). Then the OS does not scale the windows of your program.

    But, but... VB6 (unlike other languages) was already quite ready for DPI aware.
    When it loads the forms and controls in a different DPI, it automatically scales everything (regarding to pixels).
    And here is were twips appear.

    What are twips?
    Remember the monitor of 1920 pixels that at 100% (96 DPI) was of 20 logical inches and at 200% (192 DPI) was 10 logical inches?
    OK, twips is an unit that measures things in that logical measurement. Not in pixels, but in "logical inches".
    In fact 1 twip = 1 inch/1440.

    So, with VB6, if you work in twips, you are already close to declare your program as DPI aware in the manifest file,a dn have a crisp program, enlarging all according to the DPI setting the user chooses.

    Well, no so fast, there are still some issues, mostly images that are in pixels by their very nature, and also the fonts are scaled automatically by VB6 but in steps, and sometimes they might be a bit bigger or smaller than exact scale so you will need to leave some little room around labels and use the proper alignment.
    But that's what it takes, VB6 using twips is almost DPI aware.

    PS: I guess I spent more than 10 minutes. But I think it is the best explanation of this issue that I wrote.
    I think I should post it somewhere, but it is not a project for the Codebank, so I don't know where.

  37. #37
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Should i learn VB6?

    Ok, after reading what you wrote, I spent the better part of my night exploring DPI awareness in .Net and based on your explanation I can now answer your question. How does .Net deal with DPI awareness?

    The answer is different based on which .Net technology you use. There are two technologies that are used to develop desktop applications in .Net, WinForms and WPF. WinForms is a much older technology and it more closely resembles the VB6 way of doing things. Now I've experimented with both technologies as thoroughly as I could last couple hours and here's what I've found.

    WinForms

    WinForm applications by default are not DPI aware. However, you can enable DPI awareness through a combination of the application manifest, a setting in app.config and finally setting the Form's AutoScaleMode property to Dpi. This resulted in what I considered to be acceptable DPI awareness behavior. The Form automatically resized it's child controls and adjusted the layout accordingly. It wasn't perfect as there were a couple things misaligned here and there and a couple of artifacts with the fonts but for the most part, it preserved the layout. Objectively speaking it was acceptable but personally, those little artifacts bother me a lot.

    WPF

    Now WPF is another beast entirely. WPF applications are DPI aware right out the gate. WPF applications have no problem whatsoever with different DPI settings. I threw everything I could at it and it always preserved the layout perfectly no matter what combinations of DPIs and resolutions I used. There were no misalignments or any other oddities. I think it's safe to say that DPI awareness is a non-issue if you're writing a front-end in WPF.

    Final thoughts

    Now as you can see, I went to great lengths just to understand your point of view. I don't just spew things out of emotion. I'm willing to listen and try to assess things objectively. That said, with regards to VB6 being better at producing DPI aware applications, specifically because of it's natural inclination to measure everything in twips is not true. I would say in that regard it's equal to WinForms and vastly inferior to WPF.

    To address one final point and this applies to WinForm applications mainly. If for some reason you need something like Twips in .Net to perform DPI aware layout calculations manually, you can easily obtain the current DPI from the Graphics object and use it to scale pixel calculations. That's a very minor amount of extra work.

    As for WPF, you will almost never need something like a Twip because WPF by design strongly discourages using absolute co-ordinates and sizes. Everything is measured relative to something else and WPF provides some very powerful layout panels that are very good eliminating to need to ever think about writing layout code yourself. Internally, WPF uses a device independent units to measure it's visual elements which is why it was so damned effective at preserving its layouts no matter DPI setting you used.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  38. #38
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Should i learn VB6?

    Now I realize that I'm not as experience as you when it comes to DPI awareness so maybe I missed something. Maybe I did something wrong in testing. I've attached the two .Net applications I wrote to experiment. You can look at them yourself and see if I've missed something. You will need Visual Studio 2019 to open them.

    Note:

    Both applications have a restart button so you can see how they look after changing the DPI. The WPF application doesn't respond to DPI changes while it's running, it needs to be restarted. And the WinForms app can be a bit wonky under some combinations of DPI and resolution so it's best to restart that one too.
    Attached Files Attached Files
    Last edited by Niya; Jan 21st, 2021 at 05:29 AM.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  39. #39
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,995

    Re: Should i learn VB6?

    OK, then Winforms with AutoScaleMode set to Dpi seems to be working similar to VB6 all in twips.

    Quote Originally Posted by Niya View Post
    It wasn't perfect as there were a couple things misaligned here and there and a couple of artifacts with the fonts but for the most part, it preserved the layout. Objectively speaking it was acceptable but personally, those little artifacts bother me a lot.
    Yes, these are exactly the problems we have in VB6. We also need to take care to fix these things, I wrote about that in my previous post:

    Quote Originally Posted by Eduardo- View Post
    Well, no so fast, there are still some issues, mostly images that are in pixels by their very nature, and also the fonts are scaled automatically by VB6 but in steps, and sometimes they might be a bit bigger or smaller than exact scale so you will need to leave some little room around labels and use the proper alignment.
    But that's what it takes, VB6 using twips is almost DPI aware.
    About WPF, the key why it avoids the problem, is surely what you said: it positions everything relative to another element.

    But, but... in both cases, Winforms and WPF there must be still a problem: images (icons, etc).
    If they want to fix it, they must scale the images (producing blur), or to avoid blur then leave the images in their orignal size, showing them smaller (as not DPI aware).

    The right way to deal with this problem is: 1) to use vector images, like WMF or SVG. or 2) To show different images for each DPI setting.
    The no so right way is to scale the images (for big images it will work, but not for small icons).

    Quote Originally Posted by Niya View Post
    You will need Visual Studio 2019 to open them.
    Sorry, I don't have it. But thanks anyway. I see that other members downloaded the file so maybe it helped someone.

    Quote Originally Posted by Niya View Post
    Note:

    Both applications have a restart button so you can see how they look after changing the DPI. The WPF application doesn't respond to DPI changes while it's running, it needs to be restarted. And the WinForms app can be a bit wonky under some combinations of DPI and resolution so it's best to restart that one too.
    You need to declare in the manifest file as "PerMonitorV2", it is a newer setting and is more than just DPI aware. It means that the app is ready to handle the DPI changes dynamically, including moving windows from one monitor to another with different DPI setting.

    Code:
      <asmv3:application>
        <asmv3:windowsSettings>
          <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
          <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
        </asmv3:windowsSettings>
      </asmv3:application>
    WinForms and WPF are probably ready to handle that (the DPI changes on the fly), but that setting in the manifest file is also needed.

  40. #40
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Should i learn VB6?

    Quote Originally Posted by Eduardo- View Post
    About WPF, the key why it avoids the problem, is surely what you said: it positions everything relative to another element.
    That's one of the main reasons but it's goes a lot deeper than that. While a WPF application by default will look exactly like any other Windows application, underneath the hood, they are completely different. Firstly, the back-end renderer is not GDI or GDI+. It is DirectX. Secondly, all visual elements are painted directly onto the Forms as vector graphics. As the one writing the application, you will be dealing with Control classes and Control events as you would expect to do when writing a Windows application in any language but as far as Windows is concerned, only the Form actually exists in a WPF application. WPF Controls actually have no Window handle because they don't exist from the OS's point of view. All common controls in WPF are built from scratch so they inherit none of the historical baggage of the Windows Common Controls. Microsoft did a great job of perfectly replicating the behaviors and visuals of the Windows Common Controls when they built WPF's common controls. Their choice of using this approach probably has to do with the implementation of WPF's powerful templating abilities. Good DPI aware behavior of individual Controls just happens to be a nice side benefit of this approach.

    Also, as I've mentioned before, WPF measures everything internally in device independent units, not pixels. I'd wager this is the main technical reason for a WPF application's good DPI aware behavior. When you combine a device independent co-ordinate system with a system of relative positioning, you end up with a very powerful layout system that's extremely tolerant of different resolutions.

    Quote Originally Posted by Eduardo- View Post
    But, but... in both cases, Winforms and WPF there must be still a problem: images (icons, etc).
    I deliberately avoided tests that involved images. In the case of images, I felt that it was more about the images themselves than it is about DPI awareness. This problem can be avoided entirely by using scaled down high resolution images or as you have suggested, vector graphics image formats.

    Quote Originally Posted by Eduardo- View Post
    You need to declare in the manifest file as "PerMonitorV2", it is a newer setting and is more than just DPI aware. It means that the app is ready to handle the DPI changes dynamically, including moving windows from one monitor to another with different DPI setting.
    Oh wow. I didn't know that but it makes sense. The WinForms application I wrote is per-monitor DPI aware and it does respond to DPI changes on the run. The WPF application, on the other hand is only system DPI-aware and must be restarted to adjust to the new DPI. When I was researching this, I found that making a WPF application per-monitor DPI aware is a bit more involved and I had already spent hours on this. I didn't want to go down that rabbit hole so I settled for system DPI awareness since it was enough for me to perform my tests. Making a WinForms application per-monitor DPI aware is rather trivial.

    Quote Originally Posted by Eduardo- View Post
    WinForms and WPF are probably ready to handle that (the DPI changes on the fly), but that setting in the manifest file is also needed.
    It worked. I don't know why they didn't suggest doing it that way. What I found was a bunch of stuff that involved using the API and whatnot. I really didn't want to go down that road at the time.

    Anyways, the manifest entry is a little different for .Net applications. This is how you enable per-monitor DPI awareness for WPF applications:-
    Code:
    '
      <application xmlns="urn:schemas-microsoft-com:asm.v3">
        <windowsSettings>
              <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
    	  <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor</dpiAwareness>
    	</windowsSettings>
      </application>
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

Page 1 of 6 1234 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width