Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

Alton Williams

@Alton Williams
About
Posts
55
Topics
22
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • ActiveX controls child window of another ActiveX control
    A Alton Williams

    Thanks Tom:) I've been asking this question since May:(( enven done a google search. But, received no joy. Question where do place

    TClarke wrote:

    void AfxEnableControlContainer( );

    Gratefully Alton:):-D:-D

    C / C++ / MFC delphi database com docker help

  • ActiveX controls child window of another ActiveX control
    A Alton Williams

    Hello all
    Are you concerntating? Yes, good. I am wondering it anyone knows the answer to this topic or can point me in the right direction.

    I'll elaborate upon my query. Thus any replies I get (hopefully), will be answeredin the correct context.
    Below are is a sample three controls.

    1. A standalone control (Demo control 1)
    2. Another standalone control (Demo control 2)
    3. A meta control which has its own features as well as containing controls (1 & 2 above)

    When I build the first two, they both build and register successfully. I can use either (or both) on other projects as child windows. i.e. VC dialogues, VB forms, Delphi Forms. Web pages ect. with no problems.

    There seems to be a problem when ActiveX control is a parent.
    The nature of my query is this: how can achieve no3 (meta control) Without it causing crashes when I insert it into other projects (or the test container)

    Step by step to what I did to create number 3:

    • I've designed a control for called CMetaCtrrl via AppWizard

    • Inserted both Demo1 and Demo2 ActiveX controls into the project with their wrapper classes generated

    • Added a member 'variables' to both

    • Inserted the handler WM_CREATE (that's what you have to do if you're using child windows)

    • Inside the function OnCreate. I've added code to allow creation of the children windows

        	CRect rcInit(CPoint(0), CPoint(0));
      	m_demo1.CreateControl(m_demo1.GetClsid(), "", WS_CHILD | WS_VISIBLE,
      		rcInit, this, 1001);
      	m_demo2.CreateControl(m_demo2.GetClsid(), "", WS_CHILD | WS_VISIBLE,
      		rcInit, this, 1002);
      
    • Added code to position and make Demo controls 1 & 2 visible

    • Built the project (Which it does successfully) also favourably accomplished is the registration of the control.

    That done I test newly created control. It's when I insert that's when the troubles start. When using the test container it raises an execption, or on placement of the control on a form (or dialogue) the same things happens. In addition to that it brings down whatever development tool I'm using. The problem is occurring when an attempt is made to create the first chold window.

    On debugging I've stepped into m_demo1.CreateControl().
    Which leads me to step into AFX_MODULE_STATE* AFXAPI AfxGetModuleState()

    C / C++ / MFC delphi database com docker help

  • how we can convert CWnd* to HWND
    A Alton Williams

    Or you do this

    CWnd *pWnd // whatever window your pointing to
    HWND MyHandle = (HWND) pWnd
    
    C / C++ / MFC

  • Copy constructor
    A Alton Williams

    Nibu thomas wrote:

    Note the ampersand in red. It is mandatory for copy constructors that you pass the object to be copied by reference or else it will result in calling the copy constructor again for the same object leading to trouble.

    Because it calls by value which makes a copy of the object which a copy constructor does so you'll get an infine call to a copy constructor, which will hang your system!

    NiLeSh KoRpE wrote:

    Why do i need copy constructor ,in call by value functions.

    NEVER! a copy constuctor and is supplied by the compiler it should be used when you have a property that allocates memory. in in such a case it is beneficial to overide the assignment operator. And a destructor (C++ does not do automatic memory management, like Java). Also another another constructor (it's got to copy something) e.g.

    class foo{
    public:
       foo(); //default ctor
       ~foo(); //dtor
       foo(const foo &source); //copy ctor
       foo& operator =(const foo &source); //overloading assingment operator
    private:
       baz *m_data; // pointer to sometjhing of type baz
    };
    
    C / C++ / MFC

  • how to square a value
    A Alton Williams

    simple Linda you do this

    double squared(double dNumberIn)
    {
      return dNumberIn *= dNumberIn;
    }
    

    all the best Alton

    C / C++ / MFC question c++ help tutorial

  • 'The heck? How is 14==4?
    A Alton Williams

    The reason is because your using the sizeof operator to request the size of the array an not the pointer eg:

    #include 
    void main() // returning a void is NOT recomended
    {
      char *pszSite = "Code project";
      cout << "The size of string is: " << (sizeof)pszSite << endl; // prints 12
      cout << "The size of character is: " << (sizeof)*pszSite << endl; // prints 1
      cout << "The size of pointer is: " << (sizeof)&pszSite << endl; // prints 4
    }
    

    In other words with using pointers to chars

    • No prefix operator treats it as a string.
    • Deferencing (asterisk) operator means get the contents to where it is pointing to.
    • Address of (ampersand) operator means get the actual address of the pointer

    I hope that makes sense Alton

    C / C++ / MFC question com debugging performance

  • own Window in Mfc Dialog
    A Alton Williams

    Have you tried http://www.google.com/search?sourceid=navclient&ie=UTF-8&rls=GGLD,GGLD:2005-14,GGLD:en&q=WNDCLASSEX[^]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windowclasses/windowclassreference/windowclassstructures/wndclassex.asp[^] http://www.winprog.org/tutorial/simple_window.html[^] By the way I are posting the same question more than one and what is worse you're repeating yourself one the same thread and that's people get annoyed.

    C / C++ / MFC c++

  • mfc ActiveX control containing child windows
    A Alton Williams

    Three weeks ago I sent this thread http://www.codeproject.com/script/comments/forums.asp?forumid=1647&select=1488286&df=100&mpp=50&fr=4916#xx1488286xx[^] Although The person who replied was helpful. My Question hasn't been answered. I thought someone might know with clarification

    C / C++ / MFC com question c++ tools

  • want some help [modified]
    A Alton Williams

    paras_s12 wrote:

    so i face a problem of how can an edit box is disabled from other form which has menu and i want to click on menu that is popup and has one option that is delete when i click on delete it will display next dialog box and then also make some edit control disabled which are on that dialog box plz anybody help me in this regard as i try some but not find success

    I'm sorry I don't understand your objectives

    C / C++ / MFC help c++

  • A teaser
    A Alton Williams

    Viorel. wrote:

    You can add to the total number of ways the following unusual one:

    Good, I want more.

    C / C++ / MFC question

  • A teaser
    A Alton Williams

    toxcct wrote:

    if the member is public, then any function can change it if the member is protected, only the member functions of the class + children classes + friend functions can change it. if the member is private, then only member functions are allowed to access it.

    I know that, hence I deliberately placed it in the private section

    SaRath C wrote:

    let me ask one question. if we do so, then what is the meaning of data sexurity in C++?

    This is a hypothetical question to see what answers the forum comes up with. -- modified at 9:17 Monday 5th June, 2006

    C / C++ / MFC question

  • A teaser
    A Alton Williams

    toxcct wrote:

    sorry, i don't understand your question after the sample. may you please rephrase it ?

    My question is how many ways can you later modify myObject.m_nNum to a different value By doing it:

    • Outside the class without using friends
    • Ingeneous ways to do it inside the class without using a setter method

    I hope that is clearer Tox!

    C / C++ / MFC question

  • A teaser
    A Alton Williams

    Hi all, Consider this class

    (unit1. h)
    class MyClass{ public: MyClass(){}; MyClass(int nNum): m_nNum(nNum){} ~MyClass(){}; private: int m_nNum; };

    in the main program

    #include"unit1.h"
    int main()
    {
        MyClass myObject(300);
    }
    

    The question how many ways to modify the property (myObject.m_nNum) to another number without using setters or friends?

    C / C++ / MFC question

  • ActiveX control as parent
    A Alton Williams

    Hello Roger, Sorry I've a while to answer your question

    Roger Stoltz wrote:

    Alton Williams wrote: When I build and register the control. I interpret this as you get an assertion or runtime error when you try to register the component after a successful build. Correct?

    No, Rog! It builds and get registered perfectly when I place the end result onto another project be it VC dialogue or a VB form the aproppriate developer app (MSVC6 or MSVB6) crashes. I if it would be a HWND problem I'll explain the issue more clearly. I've created three controls;

    1. A control called child1ctrl which is a subclass of "EDIT"
    2. Another called child2ctrl is that of "STATIC"
    3. A third one called holderctrl which isn't subclassed

    Firstly, I design controls 1 & 2 individually either as single project or two projects (that's not relevant). Naturally it builds and registers the two controls ok. At this stage when add either (1 or 2) to other projects. Works perfectly. It's when I am design control no 3. I'm what is the cause for concern I do the follow

    • I go through the wizard:doh:
    • I add controls (1 and 2) to the project and it generates the wrapper classes.(CChild1 & CChild2)
    • I make these as two member variables one of each class.
    • I write code to create the two child windows

    I have no problems with build and the control registers with no problems. Its when I add HolderControl onto other projects I drag and drop it on a diaglogue box and crashes VC++ (msdev.exe). Likewise I do it on a for VB (VB.exe) comes down. To begin with I wrongfully wrote code to create (1 & 2) in WM_CREATE.

    class CHolder{
    
    virtual void PreSubclassWindow();
    private:
    CChild1 m_ctrl1;
    CChild2 m_ctrl2;
    BOOL m_bFlag
    

    Then

    void CHolderCtrl::PreSubclassWindow()
    {
        m_bFlag = m_ctrl1.CreateControl(clsid, NULL, dwStyle, rect, this)
    &&     m_ctrl2.CreateControl(clsid, NULL, dwStyle, rect, this);  
                    
         COleControl::PreSubclassWindow();
    } 
    

    On debugging what is causing the crashing seems lie with the first call to create for the first "window" so the second call doesn't happen.:confused::confused: MS Calendar Control 8.0 dosen't behave like this. I has two child ComboBoxes and 50 Statics on it. I don't if I'm clearer now. I going to repost the questio

    C / C++ / MFC com help tutorial question learning

  • Difference between WIN32 Application and WIN32 Console Application wizard
    A Alton Williams

    zahid_ash wrote:

    please clarify that what is the diference between WIN32 Application and WIN32 Console Application wizard

    Simple. Win32 app creates a MSWindows type interface and Win32 Console Application creates a MSDOS (Similar to command prompt). http://www.sunlightd.com/Windows/FAQ.html#ConsoleIntro[^]

    C / C++ / MFC c++ question

  • Difference between WIN32 Application and WIN32 Console Application wizard
    A Alton Williams

    zahid_ash wrote:

    What the windows.h file makes diference in developement or programming

    Yes if you want to Windows based GUI apps. Otherwise you'll get errors

    C / C++ / MFC c++ question

  • ActiveX Property list question
    A Alton Williams

    Hi experts, I'm writing an ActiveX control. I would like to create a property list based on all the entries in the combobox of the property page. I've tried using CBIndex in the property / data exchange. I've also tried an enum. But come to a loss. What I want to do is have a list of the legal states listed of my properties. Thus they get listed in "All" property page of VC++ or the property pane of VB ect. Can anyone tell how this done. Thanks Alton

    C / C++ / MFC c++ com question

  • ActiveX control as parent
    A Alton Williams

    Hi Roger, Thanks for your prompt reply!

    Roger Stoltz wrote:

    How does it crash your system? Error messages? Some info from debug sessions?

    When I build and register the control. When I place it on another form (in VB) or Dialogue box (in VC++) for testing. it seems to bring down VB or VC++. If I'm lucky if my final app comes down or doesn't respond at run-time. Is that any clearer? Alton

    C / C++ / MFC com help tutorial question learning

  • ActiveX control as parent
    A Alton Williams

    Hi all, Are you concentrating? Yes, good! Please read this carefully An example of my problem is I have three controls.

    • Control A
    • Control B1
    • Control B2

    I want to be able to either B1 or B2 to be a child window of A depending on how I set the properties. Of course I know A is child window. when I place it on the a driver (demo) app, it crashing my system. I want to know to do this safely? Many thanks, alton

    C / C++ / MFC com help tutorial question learning

  • Subclassing ActiveX control
    A Alton Williams

    Muhammad Azam wrote:

    but i just want to know why are you doing this through ActiveX control

    Answer this is a component of my result.

    Muhammad Azam wrote:

    I mean you can change the background and text color of standard Edit control by Handling WM_CTLCOLOR Message.

    I know that I want to able to have the result on VB, Delphi, VC++ ect.

    C / C++ / MFC question com help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups