|
Hello,
I need to add docking support in a dialog based application. Is this possible? (I could not find explicit examples here in CodeProject, most of the examples are for a Single or Multiple Document application and not for a Dialog based application.
The docking child window contains several combo boxes and a graph control, this window should be attached to some location in the main dialog window, but can be also "detached" as a modeless dialog.
I guess that the child dialog should derive from a CDialogBar...but what to do on the main dialog?
Another limitation: I can't use an ActiveX control to contain the docking window as in this example:
Docking CSizingControlBar objects inside ActiveX containers[^]..
Can someone provide some hint on how to do this?
Thanks in advance.
-- Ricky Marek (AKA: rbid)
-- "Things are only impossible until they are not" --- Jean-Luc Picard
My articles
|
|
|
|
|
I add a class in my VC2005 project. I select the class template to be MFC and automation enabled. I want this class to be derived from CCmdTarget and handle some of the connection point events. The wizard created cpp file has a dispatch map.When I try to add methods to thjis class I do not find the dispatch map getting filled up. Is there anything I'm missing here?
|
|
|
|
|
You can always add them by yourself, although you don't find it in the Class Wizard. Try with a new project and another class that you now it has this message in class wizard. Put it in the new project to see the form and copy it to your project. Most of times it should work, as long as you don't ask something imposible to that class.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
What is the difference between
a::a()
and
a::a(void)
Do we enforce some kind of extra information by use of the void keyword?
|
|
|
|
|
tom groezer wrote: What is the difference between
a::a()
and
a::a(void)
Do we enforce some kind of extra information by use of the void keyword?
They are the same. The C language requires functions with no parameters to have the void. A lot of people have carried that over into c++
|
|
|
|
|
hello!!!!!!!
i have two listboxes and two buttons to move the content from one listbox to another.when i select an item from a listbox ...after clicking on button it moves to another listbox....but selected item remains selected in previous listbox.
our requirement is ....item remains in previous box but unselected.
thanks!!
|
|
|
|
|
You can do this by sending a message to the previous ListBox;
Use the SendMessage API as follows:
SendMessage(hWndControl, LB_SETCURSEL, -1, 0);
where hWndControl is the window handle to the previous ListBox. Setting the wParam to -1 means that there is no selection in the ListBox
Hope this helps!
--PerspX
|
|
|
|
|
Hi,
why don't you use the CWnd::SetFocus ()? As CListBox derive from CWnd you can use inheritance**
**is that the english word?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Hi,
I want to View property of a file for with I have written the following code.
ViewProperty(CString strFile)
{
if(strFile.IsEmpty())
{
MessageBox(CString("Please Select a File."), CString("Properties"), MB_ICONASTERISK);
return ;
}
SHELLEXECUTEINFO sh={0};
sh.cbSize = sizeof ( sh );
sh.fMask = SEE_MASK_INVOKEIDLIST;
sh.lpVerb = CString("properties");
sh.lpFile = strFile;
ShellExecuteEx(&sh);
}
But this is working in VS 2003 but not in VS 2005. Can anyone help me what needs to edited.
Thanking You.
Anurag Gandhi.
|
|
|
|
|
Anurag Gandhi wrote: But this is working in VS 2003 but not in VS 2005.
What do you mean by not working? Not compiling? Not executing? Runtime error?
Shog on learning VB6: Ah, that would have been VB6. Kicked my ass anyway.
So easy to learn, just like falling down a flight of stairs...
|
|
|
|
|
Hi Brahmma,
It was compiling and executing. But program was terminating abnormally when calling that function. Sorry for asking incomplete question.
Anurag Gandhi.
|
|
|
|
|
That's fine; did you try debugging? Where does the crash occur?
Anything I will say you will bring it down to whatever you want.
|
|
|
|
|
Anurag Gandhi wrote: SHELLEXECUTEINFO sh={0};
sh.cbSize = sizeof ( sh );
sh.fMask = SEE_MASK_INVOKEIDLIST;
sh.lpVerb = CString("properties");
sh.lpFile = strFile;
ShellExecuteEx(&sh);
Modify this to,
CString sVerb = _T("properties");
SHELLEXECUTEINFO sh={0};
sh.cbSize = sizeof ( sh );
sh.fMask = SEE_MASK_INVOKEIDLIST;
sh.lpVerb = sVerb;
sh.lpFile = strFile;
ShellExecuteEx(&sh);
Prasad
MS MVP - VC++
|
|
|
|
|
I have such a function:
template <class t=""> T& GetInst()
{
static T t;
return t;
}
I'm not sure whether this is thread safe? If T's constructor has many operations, when two thread entered this function early and later, is there such scenario: the first thread is in T's constructor's, the second thread define t again?
|
|
|
|
|
c++ itself has no concept of threads. static means one and only one, not one per thread
|
|
|
|
|
Hi,
Since the value of the locat static variable is stored on heap, per my opinion it should not be thread safe.
Manoj
Never Gives up
|
|
|
|
|
I`m REMY wrote: the second thread define t again?
I think this depends upon the Template Parameter. If first thread invokes the function with class1 type and second invokes with class2 type then those two will be entering different constructors. Since template will generate 2 copies of template class, one for class1 and other for class2.
|
|
|
|
|
|
If the function foo() have a local static variable then its not thread safe.
Manoj
Never Gives up
|
|
|
|
|
So, how to make it safe? Use thread mutex: ?
A& foo()
{
Wait_Mutex(...);
static A a;
Release_Mutex(...);
} ??
This looks very bad performance!
|
|
|
|
|
It depends on what you need. If you wish to have it shared for all threads, you need to work with it like with any other shared memory in multithreading which includes synchronisation (unless only one thread is writing the variable)
rrrado
|
|
|
|
|
Of course, I want to do a shared function by all thread. However, I hope to only have one synchronization in this function. I means, the first thread entered the synchronize, all following thread return the reference of object directly.
|
|
|
|
|
I'm trying to read a char* from a binary file. The data is written to the file correctly, but when I read it back, my string is appended with gibberish. Here's a snippit:
char* load_string(FILE* f)
{
size_t len;
char* str = NULL;
fread(&len, sizeof(size_t), 1, f);
if (len)
{
str=(char*)malloc(len);
fread(str, sizeof(char), len, f);
}
else
{
str=NULL;
}
return str;
}
And here is how I am using the function:
fopen_s(&f, "hi.dat", "rb");
if (f)
{
szLoad = load_string(f);
fclose(f);
}
I'm pretty sure it's a problem with malloc() allocating too much memory, because when I do a strlen(str) it returns as longer than expected, even though len is correctly interpreted from the file.
Any help would be greatly appreciated.
|
|
|
|
|
You need to terminate the string with a null char
malloc the length plus one byte for the '\0'
after you have read the string from the file insert a '\0' at the end of the buffer
|
|
|
|
|
dreamtwister wrote: str=(char*)malloc(len);
fread(str, sizeof(char), len, f);
You might need an extra byte for a NULL otherwise string library functions will just keep going and going and ....
led mike
|
|
|
|