|
Hi
Can somebody explain to me why SetTitle doesn't work within OnOpenDocument? That is, if you try to set the title within this member function, with for example,
SetTitle("This is a test");
you can use
CString ok = GetTitle();
within the function to see that it is set but when you look at the text in the upper left of the application it reverts to the file name.
More importantly, can anybody explain how to get it to work?
Many thanks in advance
John
John Paul Jones
|
|
|
|
|
trap the frame window create and precreate functions like below
//--------------------------------------------------------
//
//--------------------------------------------------------
BOOL CFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// modify the window bits
cs.style &= ~FWS_ADDTOTITLE;
return CMDIChildWnd::PreCreateWindow(cs);
}
//--------------------------------------------------------
//
//--------------------------------------------------------
BOOL CFrame::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CMDIFrameWnd* pParentWnd, CCreateContext* pContext)
{
CDoc* pDoc = (CDoc*)pContext->m_pCurrentDoc;
lpszWindowName = pDoc->DocName; // a doc variable
return CMDIChildWnd::Create(lpszClassName, lpszWindowName, dwStyle, myRect, pParentWnd, pContext);
}
mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them
|
|
|
|
|
Hi
Can somebody explain to me why SetTitle doesn't work within OnOpenDocument? That is, if you try to set the title within this member function, with for example,
SetTitle("This is a test");
you can use
CString ok = GetTitle();
within the function to see that it is set but when you look at the text in the upper left of the application it reverts to the file name.
More importantly, can anybody explain how to get it to work?
Many thanks in advance
John
John Paul Jones
|
|
|
|
|
How can I detect a mouse click that is outside my dialog? I need to get a handle to the clicked window without deactivating my own dialog.
Thanks - Erik
|
|
|
|
|
use SetCapture() and ReleaseCapture()
mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them
|
|
|
|
|
I am developing a client/server model application using shared memory. My program is based on Zoran Todorovich article (Interprocess Communication using Shared Memory, 14 Dec 1999). My problem is after the server is killed the client keep trying to send data to the server . This gives me a pretty significant delay on the client.
The client algorithm is as follows (bases on Mr. Todorovich's article):
foo = OpenFileMapping(...)
if foo is NULL then
server is killed
else
server is running
The server algorithm is as follows:
foo = CreateFileMapping(...) during start up
closeHandle(foo) on destruction
Would someone tell me a better way to check is the server has been killed?? Thank you all for your help.
|
|
|
|
|
Hi,
one possible way to notify the client about the server is killed is to use a user defined message like WM_SERVER_KILLED that can be handled by all your client applications.
Another way if your file-mapping is inside an DLL is to use a shared bool variable somewhat like BOOL ServerExists which can be checked by the client before try opening the mapped-file.
P.S.: I have tried both versions and they worked well
----------------------
www.klangwerker.de
mario@klangwerker.de
----------------------
|
|
|
|
|
Hello there!
I have a slight problem with VC6.0.
Well, to be much more detailed...
You all may know the Qt-Library and so do I...
I´d like to import the UI-Files generated by the QtDesigner directly into the VC project resource folder and on "make"
it should happen, that this resource is taken to generate a corresponding cpp and h file out of it. The command to do this in a dos box is:
uic -o <file>.h <file>.ui
uic -o <file>.cpp -i <file>.h <file>.ui
moc -o moc_<file>.cpp <file>.h
So this is what VC shall do for me when a UI file has changed (which means that the cpp and h files are outdated).
Can someone help me please?!
Thanks a lot!
|
|
|
|
|
I'm french
"excusez moi" for the faults
i'd make an appli with two different String tables
i need to switch dynamically between this two resources
(a radio button allows me to set up a memeber variable)
Is it possible ??
Can i keep the same ID for the string in the two tongues
and thus how transmit the good table with the good version
By default if you can't help me for the code
can you correct my english!!!
tankyou
|
|
|
|
|
What you have to do depends on which OS you are targeting. If you have the luxury of targeting only for Windows NT/2000 then you can use multiple string tables in the same app. If you need to target Windows 9x/Me, then you need to use other means.
Also keep in mind that if you're using MFC, you need to take into account MFC's quirks as well.
|
|
|
|
|
Everyone, good afternoon.
It is worried in the way of restoring Registory.
Information on Registory is kept by using RegSaveKey in the file. After that, Registory is changed, and it tries to be restored with RegReplaceKey.
The executive result of RegReplaceKey is successful.
The BackUp file made after the practice is being made, too.
But, Registory isn't being restored.
Is it improper if anything isn't done before carrying out RegReplaceKey so that it may be restored to the normality?
Example.(Save)
HKEY hKey;
RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_ALL_ACCESS, &hKey);
RegSaveKey(hKey, "C:\\HKLMSOFT", NULL);
(Restore)
HKEY hKey;
RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_ALL_ACCESS, &hKey);
RegReplaceKey(hKey, NULL, "C:\\HKLMSOFT", "C:\\HKLMSOFT.bak" );
or
RegOpenKeyEx(HKEY_LOCAL_MACHINE, NULL, 0, KEY_ALL_ACCESS, &hKey);
RegReplaceKey(hKey, "SOFTWARE", "C:\\HKLMSOFT", "C:\\HKLMSOFT.bak" );
But, it isn't restored.
Thank you for reading it.
sakurajyousui
|
|
|
|
|
Hi all, I have this BIG and URGENT problem:
I developed an ocx in VC++ 5.0 and I want to use a recordset object which is opened into a VB application (DAO 3.5). How can I use this object in my OCX?? I mean: How can I pass the Recordset from VB to Vc++ ??
Thank you very much in advance
Carlo Comino.
|
|
|
|
|
when i had a similar need (passing a recordset from a vb client to a c++ dll) i ended up using a temporary db table to store the results in the recordset and reading it from the c++ code
there's prolly a better way but i couldn't find it
mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them
|
|
|
|
|
If I want to create a new thread in my code & run it in Debug Mode what are the visual C settings?
Can I create this in a Console App, should it be Debug Multithreaded ?
My code compiles, but the new thread never kicks in when I run it??? Any help appreciated...
Gerry.
|
|
|
|
|
If I want to create a new thread in my code & run it in Debug Mode what are the visual C settings?
--> C/C++ Code Generation : DEBUG_MULTITHREADED ... should be all
Can I create this in a Console App, should it be Debug Multithreaded ?
--> YES and IT MUST BE MULTITHREADED!
My code compiles, but the new thread never kicks in when I run it??? Any help appreciated...
--> CAN`T SEE THE CODE! This can have a lot of reasons - maybe your thread never gets an object it is waiting for .... Do you use any WaitFor..() functions ???
Greatings Mario ///
Greatings Mario ///
----------------------
www.klangwerker.de
mario@klangwerker.de
----------------------
|
|
|
|
|
Have any idea about how to invoke a context menu on right
click of Network Neighborhood computer. Say u want to display two menu
items like connect and disconnect of a n/w neighborhood computer using
ShellExtensions.
Any idea or suggestions highly appreciated..
Pls. provide how to register the component , i mean under what hive to be
registered.
Thanks & Regards,
soma
|
|
|
|
|
I found that there are some memory leaks when running it in NT.
Here are the source codes.
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
typedef struct DATA
{
char *data;
DATA *next;
} DATA;
void test2(DATA *d)
{
if (NULL == d->data) {
d->data = new char [100000];
if (NULL == d->data) {
printf("No memory for d->data.");
return;
}
}
else {
DATA *dp = d;
while (dp->next != NULL) dp = dp->next;
dp->next = new DATA;
if (NULL == dp->next) {
printf("No memory for dp->next.");
return;
}
memset(dp->next, 0, sizeof (DATA));
dp->next->data = new char [100000];
if (NULL == dp->next->data) {
printf("No memory for dp->next->data.");
return;
}
}
}
void main(void)
{
printf("Press ENTER to start.\n");
_getch();
int i;
DATA d, *dp, *next;
memset(&d, 0, sizeof (DATA));
for (i = 0; i < 200; i++) {
test2(&d);
test2(&d);
test2(&d);
test2(&d);
test2(&d);
}
printf("Press ENTER to continue.\n");
_getch();
delete[] d.data;
dp = d.next;
i = 1;
while (dp != NULL) {
next = dp->next;
delete[] dp->data;
delete dp;
dp = next;
i++;
}
printf("i = %d.\n", i); // 1000 expected.
printf("Press ENTER to finish.\n");
_getch();
}
Pls help...;)
|
|
|
|
|
I found out this mysterious memory leak too, but I am really puzzled because my testing program can't be simpler (see below). I used VC++6/SP4 to compile it and checked it with MemCheck 5.0. The latter said "no HeapFree for HeapAlloc" four times and "no HeapDestroy for HeapCreate". I am not even using the new and delete operators, but why is the program calling HeapAlloc and HeapCreate AND not calling HeapFree and HeapDestroy to clean up the mess?
#include "stdafx.h"
#include <stdio.h>
void main(void)
{
char c;
printf("Test to see if there is memory leak...\n");
c = (char) getchar();
printf("The character is %c.\n", c);
}
|
|
|
|
|
Well... the c lib is calling the HeapAlloc/HeapCreate for internal data, but since that data needs to be allocated for all live of your program there is no need for calling HeapDestroy/HeapFree. When your program ends the OS automatically frees all the memory that has been allocated by you (in this case by the c lib) so there is no leak at all...
Bye,
Rui Lopes
|
|
|
|
|
I want to implement refresh, back and forward buttons in my browser!! how can i do this?
Please help. I would also like to impement an favourites button or something like that.
THANKS!!!!!
DAMION
|
|
|
|
|
Could I have some example code for C++ MFC to create and display a simple property sheet, or Tabbed dialog box, with the Tabs positioned along the bottom please?
Thanks
David
|
|
|
|
|
Use the TCS_BOTTOM style wich is defined in CommCtrl.h (line 5067 in my version).
With the best regards, Vitaly.
|
|
|
|
|
My program has some property settings and so i make a dialog box with some textboxes and checkboxes to display all those settings. I allow the user to change the settings and save them. I want to update the Dialog view when the user click the checkbox. For example, there are 8 checkboxes represent 8 bit binary number and there is a textbox to represent this 8-bit binary in hex number. I want the textbox display the most updated binary information from those 8 checkboxes.
So, I send message to the dialog when the user "click" the checkbox. However, i don't know how to update the Dialog box so that it can update the textbox.....
Can anyone help me?
|
|
|
|
|
Invalidate(false) redraws a window ( which both the text box and dialog box are ) without erasing the background first, thus avoiding flicker. Invalidate(true) erases the background first.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
I think you want CWnd::UpdateData().
|
|
|
|