Solved

Graphics and dynamic control creation

Posted on 2002-05-23
3
334 Views
Last Modified: 2013-11-20
I have two questions

1)I usually get involved with developing graphics application (not games) such as one can create 2D or 3D chart based on a set of given data points. My application should be able to run on Windows 9x/NT/2000/XP
Which one should I use ?
a)Windows GDI
b)Directr X
c)OpenGL

I heard that OpenGL can do games and graphics but can MFC
do the same without using any graphic library ?

2)Second, can MFC create dynamic Windows control on the fly (at run-time) in an MFC application just like Visual Basic does ? If it can, how is it done ?

I'd appreciate any links/sources or technical documents that can answer my two questions ?
0
Comment
Question by:kevinnguyen
  • 2
3 Comments
 
LVL 8

Expert Comment

by:fl0yd
ID: 7030858
1) You certainly cannot do with windows GDI what OpenGL/DirectX can. But for simple drawing GDI-functions are sufficient. OpenGL/DX do ask you to do a LOT of initialization and uninitilization.
2) If I recall correct you can accomplish this:
CButton* pB = new CButton;
pB->Create( lpszCaption, dwStyle, rect, pParentWnd, nID );
Don't forget to
delete pB;
if you don't need the button any more.
0
 
LVL 1

Author Comment

by:kevinnguyen
ID: 7030878
How can I add the newly created button to "MyDialog" dialog at a desired location ? What function do I call and what are the parameters ?
0
 
LVL 8

Accepted Solution

by:
fl0yd earned 87 total points
ID: 7031621
When creating the button with
pB->Create( lpszCaption, dwStyle, rect, pParentWnd, nID );
rect will hold the position of the control. Use
RECT rect = { 0 };
and initialize the values for 'left', 'top', 'right', and 'bottom' to the desired values. For pParendWnd pass
static_cast<CWnd*>( &MyDialog );
If you need to reposition the button later, you can call SetWindowPos with the appropriate values.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How do you programatically show and hide the Windows 10 On-Screen-Keyboard? 3 662
if loop in java 3 140
ffmpeg - "rtsp://...... Operation not permitted" 4 80
java ^ examples 8 65
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question