• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 155
  • Last Modified:

Naming the control in varient Environment....

Hi,
i have developed a new ActiveX control, the control name is MyButtonCtrl, so when i open VB and add a new instance of my control its name will be (MyButton1), and its caption will be (MyButton1) also, but when i use my control in VC++ environment, the control ID will be (IDC_01) and its caption is (01).
so how i can make the control caption (MyButton1) or (MyButton01) in VC++ environment ??
0
raqadi
Asked:
raqadi
  • 4
  • 3
1 Solution
 
job_sCommented:
Use

  MyButton01.Create();

  MyButton01.SetWindowText( "Caption");
0
 
DanRollinsCommented:
How did you create the control?  

When I use the VC++ ATL COM AppWizard to create an ActiveX control, then when I insert it into a dialogbox, it will be given a default ID that is based upon the name I used when I created it.

The default ID seems to be based upon twhatever gets typed into the "Prog ID" input in the ATL Object Wizard Properties box.  You can edit this by looking in the file named YourCOntrol.rgs that the CW creates.

-- Dan


0
 
raqadiAuthor Commented:
i create the control using VC++ MFC COM AppWizard, and i named my control (MyButton), the strange thing that it gives me the correct name and caption in VB environment (MyButton01). but in VC++ environment it gives me an id (IDC_01) and a caption (01)
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
raqadiAuthor Commented:
sorry, i create it using MFC ActiveX ControlWizard
0
 
DanRollinsCommented:
When I used the MFC ActiveX Control wizard, my default ID was based upon the name that I chose for the project.

There is an [Edit Names] button in the wizard.  Perhaps you deleted the default name there.

You can also look in the file named MyButton.ODL  Also look in the Resource View tab and examine the String Resources.

-- Dan
0
 
raqadiAuthor Commented:
i checked these two things before, and i didnt find anything unusual, and if there is anything wrong it will be reflected on any environment, not only on VC++ !!!
0
 
raqadiAuthor Commented:
thank you MR Dan, i spent 3 days in search for the deference in the my code and the standard code, and i found it, and the problem is solved :), thanx again
0
 
DanRollinsCommented:
hi ragadi,
Thanks for accepting my comment as an answer.

In case somebody looks at this question later... can you describe exactly what part of your code caused the problem?

-- Dan
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now