troubleshooting Question

Win32(non-MFC) How to resize a button control based on dynamically configuable text

Avatar of jim_welch_se
jim_welch_se asked on
C++Microsoft DevelopmentEditors IDEs
4 Comments2 Solutions4317 ViewsLast Modified:

Basically I am new to programming and espically Win32 GUI programming(non-mfc).  I am basically trying to resize and reposition a Button Control (within a dialog) based on some configurable text that the user enters.

What I have is the following dialog.

 ______________                _____________         _____________      _____________            
|        CTRL1           |             |        CTRL2           |    |          CTRL3         |   |      CTRL4           |
 ---------------------                ----------------------     ----------------------      --------------------

CTRL2 is the dynamicly controled button the other three controls(CTRL2,CTRL3,CTRL4) are staticly located.

1) I have to resize CTRL2 button based on the text that was dynamically defined by the user
2) The button has to be placed next to CTRL3, but the same distance that is present between CTRL3 & CTRL4.
3) The Button can not grow to overlapp CTRL1.

What I have been able to figure out is the:
* Height of the button
* Y position of the button

    HWND hWndInsertAfter,
    int X,   //UNKNOWN
    398,  //Y of position...Known
    int cx,  //UKNOWN
    25,  //Height of button...Known

Any insight into this issue will be greatly appreciated.
Join our community to see this answer!
Unlock 2 Answers and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros