|
I'd like to remove the CTabCtrl from a property sheet. Currently, I make it not visible, but I need to determine the size of the CTabCtrl in the property sheet to adjust the property pages accordingly. Otherwise, there's ugly space around it.
FYI: I'm using this approach as I use the property pages in a normal property sheet at times in addition to a "netscape'ish" property sheet.
|
|
|
|
|
If you already have a pointer to the tab control (possibly with GetTabControl ), GetWindowRect should return its dimensions. Then you can displace the remaining controls upwards in the OnInitDialog of the sheet just like this:
CWnd *pWnd=GetWindow(GW_CHILD);
while(pWnd!=NULL){
CRect rect;
pWnd->GetWindowRect(rect);
rect.OffsetRect(0,-tabHeight);
ScreenToClient(rect);
pWnd->MoveWindow(rect,FALSE);
pWnd=pWnd->GetNextWindow();
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi,
I've been staring at this problem for hours and hours... what is wrong?!
This is what I do:
...snip...
CComModule _Module;
BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_Lex, CLex)
END_OBJECT_MAP()
extern "C"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID )
{
if (dwReason == DLL_PROCESS_ATTACH)
{
TCHAR pszLoader[MAX_PATH];
GetModuleFileName(NULL, pszLoader, MAX_PATH);
_tcslwr(pszLoader);
if (_tcsstr(pszLoader, _T("explorer.exe")))
return FALSE;
_Module.Init(ObjectMap, hInstance, &LIBID_LEXBHOLib);
DisableThreadLibraryCalls(hInstance);
}
else if (dwReason == DLL_PROCESS_DETACH)
_Module.Term();
return TRUE;
}
...snap...
I get this error:
---Configuration: LexBHO - Win32 Unicode Release MinDependency--------
Linking...
Creating library ReleaseUMinDependency/LexBHO.lib and object ReleaseUMinDependency/LexBHO.exp
LIBCMT.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
ReleaseUMinDependency/LexBHO.dll : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
LexBHO.dll - 2 error(s), 0 warning(s)
But when I comment these lines out...
...things are working just fine. What is wrong with _tcslwr? Because that's where the problems start...
Help is much appreciated,
/Tommy
|
|
|
|
|
Ummm... the configuration you have selected (MinDependency) does not link the C run-time library to save space on the final DLL. So, you cannot use any of the functions provided by this library (like vg. _tcslwr ). Either change the configuration or avoid calls to the C run-time library.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
No, that's not it, but thanks anyway... I have another project that builds with this piece in ReleaseMinSize. That's what's making this thing so strange! What else can make it behave like this?
/Tommy
|
|
|
|
|
(Another shot in the dark) Seems like LIBCRT thinks is being linked against a console program instead of a DLL. Check the /subsystem directive in the linker part of the project settings.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Under your project settings, make sure that you have chosen one of the "Using MFC" options.
(IE. "Using MFC in a shared .dll" or "Using MFC in a statically linked .dll")
|
|
|
|
|
No, it works with a project I have and there's no MFC at all. And there shouldn't be!
It must be something else!
Mail me and I'll send the project to anyone who wants it!
/T
|
|
|
|
|
I had the same problem :
- put an empty main funxion somewhere to keep the linker happy
- don't use LIBC funxions
- tell me if you find another solution
|
|
|
|
|
This is a famous one. It is cause by _ATL_MIN_CRT preprocessor definition. Look here[^] for details.
Vagif Abilov
MCP (Visual C++)
Oslo, Norway
If you're in a war, instead of throwing a hand grenade at the enemy, throw one of those small pumpkins. Maybe it'll make everyone think how stupid war is, and while they are thinking, you can throw a real grenade at them.
Jack Handey, Deep Thoughts
|
|
|
|
|
Hi. I have some fundamental questions about dialog box and property sheet. Most ultimately have to do with program design and memory management.
Dialog Box:
Is the following good program design?
-----
MyBox mBox;
if (mBox.DoModal == IDOK)
// Is it good program design to get data from a dialog box after it has been closed/distroyed?
DataType = mBox.GetData();
-----
Dialog Box & Property Sheet:
What do you think about declare all dialog box and/or property sheets as private data member rather than local data member?
In general, I want to make sure there is not memory leak with dealing with dialog box and/or property sheet and local data members.
Thanks,
Kuphryn
|
|
|
|
|
Question 1: It is not only good style, but also about the only reasonable way to retrieve data entered by the user into the dialog. Go ahead with this solution.
Question 2: I don't know how keeping these private will help you prevent memory leaks. Could you be more specific?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks.
If you declare a dialog box locally, what if the function goes out of stack? If it is local, you can create a new box and delete each box every time.
Again, I would like to make sure everything is safe and good program design.
Kuphryn
|
|
|
|
|
I'm still not very sure about what your question is, but in general you should prefer to declare variables locally rather than as member variables (unless there are compelling reasons not to do so).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Here is an example of the second questions.
-----
Class MyClass()
{
void TestFunc();
privete MyDialogBox *dBox;
}
void MyClass::TestFunc()
{
dBox = new MyDialogBox;
if (MyDialogBox->DoModal == IDOK)
...
delete dBox;
dBox = NULL;
}
-----
In the code above, MyDialogBox is created on the heap instead of being a local call.
Kuphryn
|
|
|
|
|
It is much better to do it this way:
class MyClass
{
void TestFunc();
};
void MyClass::TestFunc()
{
MyDialogBox dBox;
if (dBox.DoModal() == IDOK)
...
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks. Nicely explained.
Kuphryn
|
|
|
|
|
how to know info about sockets currently run in a PC?
the sockets are created by other apps.
info includes ports, addresses for both side of sockets.
is it possible?
thx
includeh10
|
|
|
|
|
one link http://www.sysinternals.com/ntw2k/source/tcpview.shtml
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
another one http://www.sysinternals.com/ntw2k/freeware/tdimon.shtml
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
thank u!
before i try, i want to know if it is only avaliable on NT and win2k?
a flower ...
includeh10
|
|
|
|
|
there's a version for win 95/98/Me also, check it out at www.sysinternals.com
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
i downloaded 20 (or all) zips from the company. they look very wanderful!
i will go through to find key code.
i think u use them before, u should be an expert about the stories.
thx again
2 flowers ...
includeh10
|
|
|
|
|
another tool: in MS-DOS command window, type "netstat -a".
|
|
|
|
|
OK I have my app which I am trying to test on other machines
I have built it as a Multi threaded DLL so I am using the MSVCRT.dll
as well as the MSVCP60.dll due to C++ and STL
On my machine (a win2K box) all is well.
On the two NT server 4 sp6 machines where I ahve tried to run it all is NOT well.
I put the exe plus my lib's .dll and the msvcrt.dll and msvcp60.dll all in the same directory.
I try and run the app (it is a console app) and I get this:
"The procedure entry point __lc_collate_cp could not be located in the dynamic link library MSVCRT.dll"
Hmm...well I drag a copy of depends.exe over and open the app in it and it reports no errors ( i.e. problems with linked functions that don't exist), and in fact reports that the version of MSVCRT.dll I am using is the one in the app's directory (naturally), NOT the one in winnt\system32\.
The one in the c:\winnt\system32\ dir has a version of 4.20.6201 and the one I am using (or need to use) is 6.10.8924.0
I had always understood that you should avoid replacing the stuff in system32 to prevent breakage in other apps.
Should I in fact change the installer to just overwrite it (if it is older than mine) ?
This app will be installed on server machines so I am a but leery of doing this.
Any suggestions will be greatly appreciated, and I happily send you a virtual beer !
|
|
|
|