Is there no way that I can just open a console and use cout/cin? No forms are open at this point. It seems like quite a complex process just to write to a console.
kialmur
Posts
-
Opening a console window from a Windows form project -
Opening a console window from a Windows form projectIs there anyway to open a console window, where cout/cin can be used, from within a a Windows forms project? For example, I have a typical GUI interface and would like the option to use a command line interface instead. Using cout/cin does not work because there is no console window to output to or input from. How do I open this window without having to create a completely separate Win32 Console application? kialmur
-
Forms appearing/disappearing to slowlyI am implementing a basic GUI to interface an application. Whenever I return from a dialog form, if I perform any computations that are the least bit intensive, the form lingers on screen before finally passing the focus to the initial form. Similarly, when displaying a dialog form, if I again perform any intensive computations on load, the elements within the box do not complete loading until after the computations have diminished. Is there any way I can tell the GUI to ensure that the screen has been updated before performing any further operations, somewhat like a flush? kialmur
-
Custom Objects Accessible by Many FormsThanks. I cannot simply reinstantiate a new controller each time, but the Singleton design works for me. kialmur
-
Custom Objects Accessible by Many FormsI understand what you are saying about the controller. However, how do I access the controller functions from the forms. If I wrap them in a class, they become hard to access from the forms because I have to pass a pointer to the class object or use some other method. I can make the functions public, but I would prefer not to, naturally. How do I make my controller functions available to my forms in Visual Studio or any other software? kialmur
-
Custom Objects Accessible by Many FormsI basically used the standard Windows forms project to start off. The .cpp, with the main(), that Visual Studio automatically creates is used to run the thread that launches my main form. The main form allows me to modify and view the status of my object, which interacts with various hardware cards and other. From that form, I have one sub-layer of forms that allow me to modify specific aspects of the object. Each form, except the main one, typically modifies or views information about one portion of the object, such as a card it interacts with. So I need to both write and read from the object within both layers of forms. To answer the post of the next person, I have already separated my application based on the Model-View-Controller pattern. I simply do not know how to give access to the object to each form, since each form is a class. I hope this helps you in answering me. I am hoping you will be able to suggest one of the good ways to give access. Thanks in advance. kialmur
-
Custom Objects Accessible by Many FormsI am trying to create a GUI for a C++ application using Visual Studio 2005, which I am new to. The GUI has one main form and several minor forms that all need access to an object, not GUI related, that I created. What is the best way to make this object accessible to all forms? Should I pass a pointer to it in the constructor of each form? Should I create a global object that the forms can refer to? Or does Visual Studio have some built in mechanism to share that ressource? I would appreciate any suggestions and help. kialmur
-
Constructor vs. Initialization problemI have a somewhat obscure question about constructors, which I have not been able to find an appropriate answer for. I will preface my question by describing the situation: I have a class representing a board that requires initialization. I know that the constructor should deal with storing addresses and other information about the board. However, should it also perform the initialization? In other words, can the constructor do more than just initialize member variables and perform an action, or is this considered bad programming practice? If you can do initializations in the constructor, how do you return the result of that initialization? I need to know whether the physical board was actually located and configured. Can I pass a pointer (for example, initResultPtr) to the constructor such that it can update a variable that can be used to verify the result of the initialization? Or should my class have a constructor that initializes all the member variables and an init() function that performs the physical board initialization and returns the result of that operation? What it is the standard practice for this problem? If you have an opinion or can refer me to an accepted answer to this problem, I would be very grateful. Kiernan
-
Instantiating classes within classesThank you for the help. I guess I did skip that chapter. I am learning C++ after having learned Java, so this is a subtlety that escaped my attention since this problem doesn't really occure in Java due to its lack of definitions. You answer does however bring me to another question. Isn't that the same syntax used used for passing variables to an inherited version of a function? Did I miss the big picture, whereby that syntax basically allows me to pass values to any other valid function? Regards Kiernan
-
Instantiating classes within classesI am trying to figure out how to instantiate a class that contains another class. For example, if I have a class called TopClass that contains a class called InClass : class TopClass{ TopClass(); TopClass(int xIn); InClass x; } class InClass{ InClass(); InClass(int xIn); int xIn; } Even when I use non-default constructor in TopClass and called the equivalent one in InClass, it seems that the default construct in InClass has already been called to create a vanilla object. Is there any way I can automatically transfer the input variables to InClass when the non-default constructor is created? Or should I simply use pointers and initialize the pointer to a new InClass object the non-default constructor is called in TopClass? Thanks in advance for any info. Kiernan
-
Help with importing .dllThe error is: error LNK2001: unresolved external symbol "long __cdecl sendChipOffset(long,long,long)" (?sendChipOffset@@YAJJJJ@Z) For the linking portion, I went in the project settings, then to the Link tab. I added the path under Object/library modules. Is that correct?
-
Help with importing .dllI am not quite sure how. I tried adding it to the project and also added it in one of project settings under Linking. Is there some otherway?
-
Help with importing .dllI am a bit new at C++. I am trying to important various functions from a .dll file. I have both the .dll and the .lib files, and I know the function definition because they were previously imported in a Visual Basic project. How can I use the functions? For example, say I have the files x.dll and x.lib, which contain a function int z(int). What do I need to do use that function? The only method I found was using the __declspec(dllimport) int z(int);, and I am not even sure if that is correct since it gave me linking errors. Thanks in advance for your help. Kiernan