Alzri2 Posted August 15, 2015 Posted August 15, 2015 Hello, Anyone who has a (normal) question in C++, put it here.
Alzri2 Posted August 15, 2015 Author Posted August 15, 2015 I will start, What is the best VS version to create MFC executables for WinXP (especially one that works without the need for VS_Redist... I've seen many !) ? I've tried working in VS 2013 to create MFC that works on XP without VS_Redist but no luck
Kurapica Posted August 15, 2015 Posted August 15, 2015 Regarding the version question : I would recommend using Visual Studio 2008 with SP1. Make sure that you set your options like this : 1
atom0s Posted August 16, 2015 Posted August 16, 2015 I will start, What is the best VS version to create MFC executables for WinXP (especially one that works without the need for VS_Redist... I've seen many !) ? I've tried working in VS 2013 to create MFC that works on XP without VS_Redist but no luck All versions including Visual Studio 2015 offer Windows XP support when building C/C++ binaries. Just be sure to target the proper toolset like this: Keep in mind though that if you are using the Visual Studio CRT and not something else you are going to need the run time no matter how you compile. You can try static linking but in most cases you will run into needing the runtime installed either way. If you really need to avoid it entirely, look into using an alternative CRT library. 1
Alzri2 Posted August 16, 2015 Author Posted August 16, 2015 Thankx for replies Actually, before I installed VS 2008, I noticed it's VS 2015 that I had, not 2013 (sorry). Make sure that you set your options like this I've already set the options like that (in 2015, and now in 2008), but it creates other problems... u fix one, another one is waiting Some of the problems: "afxwin.h" include MTD unresolved @16_WinMain All versions including Visual Studio 2015 offer Windows XP support when building C/C++ binaries I know that, but I though there is an easier version to create XP supported apps if you are using the Visual Studio CRT Not using anything unusual (for me), just a dialog based MFC. ========== I guess I'll have to go through more theory stuff then come back again !
atom0s Posted August 16, 2015 Posted August 16, 2015 MFC made by Microsoft. So if you plan to use it you are going to need run times no matter what. No matter how you set options you are going to require them outside of static linking but still that will be hit or miss based on what you use.
Alzri2 Posted August 16, 2015 Author Posted August 16, 2015 I have seen many MFC apps that don't need runtime especially those made by crackers. You can check those exe(s) made by lena in dealing with stack or HWBP tutorial... it's tutorial #14 or #15 if my memory serves me right
mrexodia Posted August 17, 2015 Posted August 17, 2015 Could be they are not MFC. Pure WinAPI also works good for simple graphical interfaces. MFC is just a nice C++ wrapper with extra features around the plain WinAPI. You can do everything MFC does by hand (although I do not recommend trying it). 1
Kurapica Posted August 17, 2015 Posted August 17, 2015 (edited) you can learn the basics of Win API here : http://www.winprog.org/tutorial/start.html I think it's a useful website for new C/C++ learners. Edited August 17, 2015 by Kurapica 1
Alzri2 Posted August 19, 2015 Author Posted August 19, 2015 Could be they are not MFC What if you see the imports and there are mfc ?! I've checked and you can find it in lena tutorial #15, and it works in XP fine without the need for VS_Redist. you can learn the basics of Win API here : http://www.winprog.o...rial/start.html I know about this one, it's really good... on my to-do list. But guys, I just wanna smth easy, at least for now, to create keygens just like I do in Delphi (especially D7). Simply, I wanna just practice writing algos in C++ (it's the best way I know to start with a new lang).
kao Posted August 19, 2015 Posted August 19, 2015 I've checked and you can find it in lena tutorial #15, and it works in XP fine without the need for VS_Redist. That one is made in Visual Studio 6.0, and uses mfc42.dll which is part of any Windows distribution since... forever? VS 6.0 was last Visual Studio version that could do that. Starting from Visual Studio 2005, they introduced concept of redistributables. You can either have small EXE (~120kb for sample MFC app) and require users to install appropriate redistributable, or link with static libraries (same application is ~3MB in size) w/o requirements to install anything. 1
Alzri2 Posted August 30, 2015 Author Posted August 30, 2015 After having some time with MFC, I ended up stuck with manipulating CString type. I have a string and I simply want to change a specific character using "operator[ ]"... the weird part is that I can access the value, but I can't modify itI guess it can be fixed using pointers but how ?: CString test;test = "Just a try";test[2] = "w"; Found many answers in stackoverflow but for char type !
Kurapica Posted August 31, 2015 Posted August 31, 2015 (edited) you should use "GetBuffer" which returns to you a pointer to a buffer which is considered writable. then do your work and call "ReleaseBuffer" after you finish. you can also use "SetAt" to change a specific char in the array. anyway CString is a Microsoft invention so I really advise you to avoid using it. Edited August 31, 2015 by Kurapica 1
Alzri2 Posted August 31, 2015 Author Posted August 31, 2015 Thanx Kurapica and everyone anyway CString is a Microsoft invention so I really advise you to avoid using it. So, what are the alternatives that could/shall be used easily with MFC ?
simple Posted August 31, 2015 Posted August 31, 2015 Found many answers in stackoverflow but for char type ! Well because that's the best way to do it. If you're coding C, then use memcpy() or string.h functions (memcpy() is better because u need specify # of bytes and less likely to cause memory overflow, unlike string.h functions) to copy your CString to a char* or char[] For C++, do CString test = "string"; std::string CppString (test); Or CT2CA macro will work. All (ascii strings at least) at the end of the day are either char* or char[]. CString, despite it's name - is not a real C string. Even if u want use MFC (don't know why), char* or char[] should be interchangeable w/CStrings even w/out casting but definately w/a cast - so it makes no sense to use them. std::strings will probably be easiest to use from a C++ compiler, u don't have to worry about memory management so much , but char* or char[] are fine too. 1
Alzri2 Posted August 31, 2015 Author Posted August 31, 2015 (edited) Even if u want use MFC (don't know why) Because creating GUIs there is very easy char* I have read that this is an old school way, and "string" objects are much better and safer, is that so ? Edited August 31, 2015 by Alzri2
simple Posted August 31, 2015 Posted August 31, 2015 I wouldn't call them safer because u can still easily do overflows on C++ std::strings and it happens a lot. char*/char[] is original C standard, which as of June of this year is the #2 most popular programming language (Java #1). Old school, yes but still very much alive & in demand. std::string is probably the best option for c++. 2
Kurapica Posted August 31, 2015 Posted August 31, 2015 Old school is the best >https://www.youtube.com/watch?v=kTLQX1aavYw 1
xSRTsect Posted September 1, 2015 Posted September 1, 2015 I did a few tests my self and if you garantee that crt and mfc are getting statically linked you can go at least as far back as windows xp (assuming platform toolset has been properly configured) 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now