Click here to Skip to main content
15,913,709 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Get window type? Pin
Michael Dunn28-Mar-05 23:48
sitebuilderMichael Dunn28-Mar-05 23:48 
GeneralFile I/O Pin
Anonymous28-Mar-05 21:48
Anonymous28-Mar-05 21:48 
GeneralRe: File I/O Pin
David Crow29-Mar-05 4:51
David Crow29-Mar-05 4:51 
Generalnetwork printing problem Pin
Sudhir Mangla28-Mar-05 21:35
professionalSudhir Mangla28-Mar-05 21:35 
GeneralRe: network printing problem Pin
DasdaDAS28-Mar-05 22:53
DasdaDAS28-Mar-05 22:53 
GeneralRe: network printing problem Pin
Sudhir Mangla29-Mar-05 2:15
professionalSudhir Mangla29-Mar-05 2:15 
QuestionHow to create CButton dynamically in MFC? Pin
xo300028-Mar-05 21:05
xo300028-Mar-05 21:05 
AnswerRe: How to create CButton dynamically in MFC? Pin
DasdaDAS28-Mar-05 23:23
DasdaDAS28-Mar-05 23:23 
Hi,
U can use the following method to create the buttons dynamically. In the following statement "but" is the CButton object which is declared as public class variable.

if(!but.Create("click me",WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,CRect(10,10,100,30),this,ID_MYBUTTON))
AfxMessageBox("Button Not Created");
else
AfxMessageBox("Button Created");
The argument ID_MYBUTTON is a macro and should be replaced with some integer values like below.
#define ID_MYBUTTON 100
Then the message handling mechanism. First declare the member function in the class like as below.
void MyMessage();
In the message map macro add the following step. This should be in the message map of the class in which u r going to create the button.

ON_BN_CLICKED(ID_MYBUTTON,MyMessage)

and define the function, i.e., MyMessage().

finally make sure that, ur member function and data members are displayed in the class view.
Hit the execution icon, and check the result.

Hope this will be little drilling for the people who doesn't have much knowledge about mfc and its message hook mechanism.

Let me know if u have more doubts.

thanks,


Zxczc
GeneralRe: How to create CButton dynamically in MFC? Pin
xo300029-Mar-05 1:13
xo300029-Mar-05 1:13 
GeneralRe: How to create CButton dynamically in MFC? Pin
jhwurmbach30-Mar-05 3:56
jhwurmbach30-Mar-05 3:56 
QuestionWininet question? Pin
mvtapia28-Mar-05 20:53
mvtapia28-Mar-05 20:53 
AnswerRe: Wininet question? Pin
ThatsAlok28-Mar-05 21:36
ThatsAlok28-Mar-05 21:36 
GeneralRe: Wininet question? Pin
mvtapia28-Mar-05 23:37
mvtapia28-Mar-05 23:37 
GeneralRe: Wininet question? Pin
ThatsAlok28-Mar-05 23:52
ThatsAlok28-Mar-05 23:52 
GeneralRe: Wininet question? Pin
mvtapia29-Mar-05 11:58
mvtapia29-Mar-05 11:58 
AnswerRe: Wininet question? Pin
Michael Dunn28-Mar-05 23:54
sitebuilderMichael Dunn28-Mar-05 23:54 
GeneralDot Matrix Printer Pin
Renjith Ramachandran28-Mar-05 19:41
Renjith Ramachandran28-Mar-05 19:41 
GeneralRe: Dot Matrix Printer Pin
Blake Miller29-Mar-05 5:52
Blake Miller29-Mar-05 5:52 
GeneralRe: Dot Matrix Printer Pin
Renjith Ramachandran29-Mar-05 7:25
Renjith Ramachandran29-Mar-05 7:25 
Generalc language Pin
Anonymous28-Mar-05 19:28
Anonymous28-Mar-05 19:28 
GeneralRe: c language Pin
ThatsAlok28-Mar-05 20:29
ThatsAlok28-Mar-05 20:29 
GeneralRe: c language Pin
Anonymous29-Mar-05 22:12
Anonymous29-Mar-05 22:12 
GeneralRe: c language Pin
Alexander M.,29-Mar-05 2:57
Alexander M.,29-Mar-05 2:57 
Generalusing CShockwaveFlash in own ActiveX Pin
AndreasTegeler28-Mar-05 19:12
AndreasTegeler28-Mar-05 19:12 
GeneralProcess and parent Pin
vikramlinux28-Mar-05 19:11
vikramlinux28-Mar-05 19:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.