Importing a GUI

Thread Starter

Eric007

Joined Aug 5, 2011
1,158
Hi everybody,

I would like to know how to import a GUI from a project to another in Visual Studio?

Say you have developed a Windows Form Application in VB.net and you want to do the same thing but in C++ and you don't want to re-design the UI all over again.

Thanks in advance!
 

shteii01

Joined Feb 19, 2010
4,644
Normally GUI is handled by the API. I think the whole point of API was to let people do creative stuff and not bother them with writting GUI every time.
 

Thread Starter

Eric007

Joined Aug 5, 2011
1,158
Normally GUI is handled by the API. I think the whole point of API was to let people do creative stuff and not bother them with writting GUI every time.
LOL...This doesn't answer any of the problem posed and you still missing my point!

Thanks anyway!
 

joeyd999

Joined Jun 6, 2011
6,281
I would like to know how to import a GUI from a project to another in Visual Studio?

Say you have developed a Windows Form Application in VB.net and you want to do the same thing but in C++ and you don't want to re-design the UI all over again.
I know *nothing* about VB. And it's been at least a dozen years since I wrote a Windows app based on their C++ library.

But, I've noticed lately that lots of development suites seem to compile the GUI into an XML document, which is later imported into the app through a library call. I know Android works this way.

I do not know if VS uses XML to package the GUI, or, if it does, if the VB XML is similar to C++ XML, but you may want to look in this direction.
 

Thread Starter

Eric007

Joined Aug 5, 2011
1,158
I know *nothing* about VB. And it's been at least a dozen years since I wrote a Windows app based on their C++ library.

But, I've noticed lately that lots of development suites seem to compile the GUI into an XML document, which is later imported into the app through a library call. I know Android works this way.

I do not know if VS uses XML to package the GUI, or, if it does, if the VB XML is similar to C++ XML, but you may want to look in this direction.
At least someone who understands what I am trying to do... I am required to develop Form application in C++ and as I am better in VB.Net, I am quickly implementing it in VB to see how the system works basically if the design algorithm works and testing the system functionality... I will try to code it in C++ BUT re-designing the UI is a pain...

I will look into your suggestion...

Thanks!
 

Thread Starter

Eric007

Joined Aug 5, 2011
1,158
Stupid question!

How would you do this?

I want to start from 0 then increment it by 1 and the maximum value is 7, ie

0+1=1
1+1=2
2+1=3
...
6+1=7
7+1=0
0+1=1
...

like the addition in a 8-bit register: 255+1=0.

what's the algorithm?

i=0;
i+=1

bah bah...

I am actually exhausted right now.. any help on this little math? and Sorry for not posing the question properly but I know you got me... lol
 

joeyd999

Joined Jun 6, 2011
6,281
Note that the & operator will only do modulo arithmetic for powers of 2. If this is part of your c++ app, you may want to use the actual modulo (%) operator instead. This will work with any number in the case your requirements change:

i = (i+1) % 8

Remember that modulo returns the remainder of the division of the two arguments.

EDIT: '&' is far less computational intensive than '%', but also not nearly as flexible.
 

Thread Starter

Eric007

Joined Aug 5, 2011
1,158
Sorry sorry it is 3am here... I can't think straight nomore... I know the '&' operator... lol

I think it's time for me to sleep... or else I'll sound stupid here...
 

vpoko

Joined Jan 5, 2012
267
OP, you are trying to convert code, you just don't realize it. You're most likely using Windows Forms as your GUI API. Windows Forms has a graphical designer in Visual Studio that lets you drag components visually to lay them out. Behind the scenes, though, is a code-behind file (usually with a .designer extension) that contains statements in whichever language you're coding in, that create your components and lays them out. Dragging components causes Visual Studio to change the statements in that file. In order to import your GUI layout, you need to convert the .designer file's statements into your new language. If you were going between VB.NET and C#, this would be trivial, but with C++ I'm not so sure (I haven't done any C++ Windows development).
 

Thread Starter

Eric007

Joined Aug 5, 2011
1,158
C++ is such a pain for Windows Form application. Lots problem with managed and unmanaged classes, standard and System strings conversion, bah bah bah... I would say VB.net and C# are best for Windows Form Applications,

anyway I killed it in C++ too ...:):p
 

Thread Starter

Eric007

Joined Aug 5, 2011
1,158
i=(i+1) & 7

Look at it in binary and it'll become obvious.
Very obvious! Lesson learnt: it is not too good to work till very late coz the obvious things may become like a *multiple unknowns* equation!
i = (i+1) % 8 works fine too. Btw i'm done with this thing so I was just saying...
 
Last edited:
Top