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
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
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.
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()
Or you do this
CWnd *pWnd // whatever window your pointing to
HWND MyHandle = (HWND) pWnd
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
};
simple Linda you do this
double squared(double dNumberIn)
{
return dNumberIn *= dNumberIn;
}
all the best Alton
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
I hope that makes sense Alton
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.
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
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
Viorel. wrote:
You can add to the total number of ways the following unusual one:
Good, I want more.
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
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:
I hope that is clearer Tox!
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?
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;
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 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
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[^]
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
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
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
Hi all, Are you concentrating? Yes, good! Please read this carefully An example of my problem is I have three controls.
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
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.