|
the following is my doing:
in precreatewindow()
cs.style|=MINIMIZEBOX;
but doesnt work,somebody can give me some advice and explanination?
thx
|
|
|
|
|
Are you creating the dialog at runtime, or toggling the min/max on and off buttons while the dialog is running?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
there are 2 better ways. if you are using a dialog resource then change the dialog settings with the resource editor (there is an option for min/max button). the other way is to change the window style run-time.
DWORD dwLong;
dwLong = GetWindowLong( hWnd, GWL_STYLE );
dwLong |= WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
SetWindowLong( hWnd, GWL_STYLE, dwLong );
Don't try it, just do it!
|
|
|
|
|
If in MFC, I think ModifyStytle() works the same way.
<code>
ModifyStyle(0, WS_MINIMIZEBOX | WS_MAXIMIZEBOX);
I have a little problem when making this style changes in run time tho. I placed it at the end of OnInitDialog() and the changes is made sucessfully. But at the first time the dialog appears, the MAXIMIZE and MINIMIZE icons (just the icons) are still on the menu bar, until the window is refreshed (e.g. switch to other dialog and switch back). Is this normal?
|
|
|
|
|
Is there a way of enumerating DDE Servers on a computer?
I would like to see which programs accept DDE messages on my local computer?
Orcun Colak
|
|
|
|
|
Is DdeConnectList() of any help.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I have developed a Simple MFC GUI to allow a user to display and control an activity.
The program works fine on a PC with Visual Studio installed, but when I transfer the program
to a Laptop computer I get an Assertion Failure line 410 of file occmgr.cpp.
I built a Deployment & Install project to formally install the program, but still keep getting the same error. It works fine on a desktop PC without Visual Studio installed.
I was told that Assertions are present only in debug builds, and debug builds cannot be
and should not be deployed.
I have now built the application in 'Release' mode, but now need to install the .Net framework.
How do you do that?!?
|
|
|
|
|
Check out commercial installer such as InstallShield. It can package the .NET runtimes. You can give the user the link to download .NET Framework at MSDN.
Kuphryn
|
|
|
|
|
it is because you built your application with Visual studio .NET, and the user that execute then don't have this framework.
run windows update and search for the .NET framework
TOXCCT >>> GEII power
|
|
|
|
|
I downloaded the dotnetfx.exe and installed it on the other PC but still get an Assertion Error on Line 410 of occmgr.cpp.
I think I built a 'Release' version of the program, as it reported during the duilt process that the .Net framework is required on the target machine.
What now!?!
|
|
|
|
|
P.S., if you still get an "Assert" error, that means you are still running the Debug version!
"Fish and guests stink in three days." - Benjamin Franlkin
|
|
|
|
|
What do you need to do to build a Release Version?
I am struggling here!
|
|
|
|
|
There is a combo box near the menus that probably says "Debug". You should just be able to change this to "Release", and rebuild all, and it will work. Notice that the release build usually goes in a different directory, e.g.:
C:\Your Project\Release\YourProgram.exe
.. as opposed to the Debug, which goes in (unless you've changed it), something like:
C:\Your Project\Debug\YourProgram.exe
You'll notice the Release executable is about half the size as the Debug one.
"Fish and guests stink in three days." - Benjamin Franlkin
|
|
|
|
|
Um.. if this is an MFC program, you should NOT need the .NET framework! That is only if you are using C#, managed C++, etc.
You can use the Dependency Walker to see what DLLs your code depends on. Perhaps there is something you are missing. (If your VS.NET didn't install it, you can do a quick Google search and find it.)
When you build in Release mode, what is causing you to believe that you need the .NET Framework? Is some error popping up somewhere?
"Fish and guests stink in three days." - Benjamin Franlkin
|
|
|
|
|
I have now built a 'Release' version and no longer get the message that the .Net Framework is required.
I have installed the 'Release' version and after coping over some DLLs that were missing, when you double click on the icon nothing happens, no errors and apart from a 1/2 second the mouse changes shape to egg timer and back again.
They must be a simple answer to this problem, I am not doing anything unusual.
|
|
|
|
|
I am trying to get the list of domains AND LIST OF COMPUTERS under each domain.
I am getting domains when I use the parameter RESOURCE_GLOBALNET in WNetOpenEnum.
I am getting list of only computers when I use the parameter RESOURCE_CONTEXT in WNetOpenEnum.
But my requirement is I would like to get computers under each domain.
How should I achive this .This is the code.Pls tell me where I am going wrong.
NETRESOURCE res[10];
HANDLE hMain;
int x,y,i;
DWORD dwCnt = 0xffffffff;
DWORD dwSize;
DWORD dwRes;
dwRes = WNetOpenEnum (RESOURCE_GLOBALNET, RESOURCETYPE_ANY, 0,
NULL, &hMain);
dwSize = sizeof (res);
if (WNetEnumResource (hMain, &dwCnt, res, &dwSize) == NO_ERROR)
{
HANDLE hEnum;
dwRes = WNetOpenEnum (RESOURCE_GLOBALNET, RESOURCETYPE_ANY, 0, res,&hEnum);
while (dwRes == NO_ERROR || dwRes == ERROR_MORE_DATA)
{
dwCnt = 9;
dwSize = sizeof (NETRESOURCE) * 10;
dwRes = WNetEnumResource (hEnum, &dwCnt, res, &dwSize);
if (dwRes != ERROR_NO_MORE_ITEMS)
{
for ( i = 0; i < dwCnt; i++)
{
if (res[i].lpLocalName != NULL || res[i].lpRemoteName!= NULL)
{
//MessageBox(0,res[i].lpLocalName,res[i].lpRemoteName,0);
//Add this in to a list box. SendMessage (hwndList, LB_ADDSTRING, 0, (LPARAM)res[i].lpRemoteName) ;
}
}
}
WNetCloseEnum (hEnum);
}
WNetCloseEnum (hMain);
Pls guide
|
|
|
|
|
This works fine for me:
bool GetResources( NETRESOURCE *pNetResource )
{
DWORD dwResult;
NETRESOURCE *NetResource = NULL;
HANDLE hEnum;
dwResult = WNetOpenEnum(RESOURCE_GLOBALNET, RESOURCETYPE_ANY, 0, pNetResource, &hEnum);
if (NO_ERROR == dwResult)
{
NETRESOURCE Buffer[750];
DWORD Count = 0xFFFFFFFF,
BufferSize;
BufferSize = sizeof(Buffer);
do
{
dwResult = WNetEnumResource(hEnum, &Count, &Buffer, &BufferSize);
if (NO_ERROR == dwResult || ERROR_MORE_DATA == dwResult)
{
for (UINT i = 0; i < Count; i++)
{
if (Buffer[i].dwDisplayType == RESOURCEDISPLAYTYPE_DOMAIN)
cout << "Domain ";
else if (Buffer[i].dwDisplayType == RESOURCEDISPLAYTYPE_SERVER)
cout << "Server ";
else if (Buffer[i].dwDisplayType == RESOURCEDISPLAYTYPE_SHARE)
cout << "Share ";
else if (Buffer[i].dwDisplayType == RESOURCEDISPLAYTYPE_GROUP)
cout << "Group ";
else if (Buffer[i].dwDisplayType == RESOURCEDISPLAYTYPE_NETWORK)
cout << "Network ";
else if (Buffer[i].dwDisplayType == RESOURCEDISPLAYTYPE_ROOT)
cout << "Root ";
else if (Buffer[i].dwDisplayType == RESOURCEDISPLAYTYPE_SHAREADMIN)
cout << "ShareAdmin ";
else if (Buffer[i].dwDisplayType == RESOURCEDISPLAYTYPE_TREE)
cout << "Tree ";
else if (Buffer[i].dwDisplayType == RESOURCEDISPLAYTYPE_NDSCONTAINER)
cout << "NDS ";
else
cout << "Unknown ";
cout << Buffer[i].lpRemoteName << endl;
if ((Buffer[i].dwUsage & RESOURCEUSAGE_CONTAINER) == RESOURCEUSAGE_CONTAINER)
GetResources(&Buffer[i]);
}
}
} while (NO_ERROR == dwResult || ERROR_MORE_DATA == dwResult);
dwResult = WNetCloseEnum(hEnum);
}
return true;
}
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I am trying to get the list of domains AND LIST OF COMPUTERS under each domain.
I am getting domains when I use the parameter RESOURCE_GLOBALNET in WNetOpenEnum.
I am getting list of only computers when I use the parameter RESOURCE_CONTEXT in WNetOpenEnum.
But my requirement is I would like to get computers under each domain.
How should I achive this .This is the code.Pls tell me where I am going wrong.
NETRESOURCE res[10];
HANDLE hMain;
int x,y,i;
DWORD dwCnt = 0xffffffff;
DWORD dwSize;
DWORD dwRes;
dwRes = WNetOpenEnum (RESOURCE_GLOBALNET, RESOURCETYPE_ANY, 0,
NULL, &hMain);
dwSize = sizeof (res);
if (WNetEnumResource (hMain, &dwCnt, res, &dwSize) == NO_ERROR)
{
HANDLE hEnum;
dwRes = WNetOpenEnum (RESOURCE_GLOBALNET, RESOURCETYPE_ANY, 0, res,&hEnum);
while (dwRes == NO_ERROR || dwRes == ERROR_MORE_DATA)
{
dwCnt = 9;
dwSize = sizeof (NETRESOURCE) * 10;
dwRes = WNetEnumResource (hEnum, &dwCnt, res, &dwSize);
if (dwRes != ERROR_NO_MORE_ITEMS)
{
for ( i = 0; i < dwCnt; i++)
{
if (res[i].lpLocalName != NULL || res[i].lpRemoteName!= NULL)
{
//MessageBox(0,res[i].lpLocalName,res[i].lpRemoteName,0);
//Add this in to a list box. SendMessage (hwndList, LB_ADDSTRING, 0, (LPARAM)res[i].lpRemoteName) ;
}
}
}
WNetCloseEnum (hEnum);
}
WNetCloseEnum (hMain);
Pls guide
|
|
|
|
|
I have a base class that I have a copy construtor for, since I have dynamically allocated memory etc.
If I add a CList to my base class definition, and add the copying code to my base class copy constructor, do I need to also do the copying in my derived class??
class Msg
{ char *pszTst;
CList myList;
}
class tstMsg : public msg
{ }
msg::msg (const Msg &i_MsgToCopyFrom)
{
POSITION pos;
CIVAttrib attr, *pAttr;
if (i_MsgToCopyFrom.mCleanMsgBuffer != NULL)
{
mCleanMsgBuffer = new BYTE [i_MsgToCopyFrom.mCleanMsgBuffSize];
if (mCleanMsgBuffer != NULL)
memcpy (mCleanMsgBuffer, i_MsgToCopyFrom.mCleanMsgBuffer, i_MsgToCopyFrom.mCleanMsgBuffSize);
}
else
mCleanMsgBuffer = NULL;
pos = i_MsgToCopyFrom.myList.GetHeadPosition();
for (int i=0;i < i_MsgToCopyFrom.myList.GetCount();i++)
{
attr = myList.GetNext(pos);
pAttr = new CIVAttrib;
if (pAttr != NULL)
{
*pAttr = attr;
myList.AddTail(pAttr);
}
}
}
when i have a function call foo (tstMsg i_msg), will the copy constructor defined in the base class be called as well as the copy constructor of the derired class??
Thanks.
-C
|
|
|
|
|
no, it can't, how would it know how to initialise the object from the derived class ?
you must provide in the derived class a new copy constructor.
TOXCCT >>> GEII power
|
|
|
|
|
No.. i meant if i made a call foo (tstMsg i_msg), would this call both the derived and the base class copy constructors??
|
|
|
|
|
you could define such constructor (see my following post to understand where these types come from) :
Manager::Manager(<font style="color:blue;">const</font> string& n, <font style="color:blue;">int</font> d, <font style="color:blue;">int</font> lvl)
: Employee(n, d), <font style="color:green;">
level(lvl) <font style="color:green;">
{
<font style="color:green;">
}
TOXCCT >>> GEII power
|
|
|
|
|
i quote you the related chapter from the "C++ Language" (chapter §12.2.3). for that, we consider we have the following classes :
<font style="color:blue;">class</font> Employee {
string first_name, family_name;
<font style="color:blue;">short </font>department;
<font style="color:green;">
<font style="color:blue;">public</font>:
Employee(<font style="color:blue;">const</font> string& n, <font style="color:blue;">int </font>d); <font style="color:green;">
<font style="color:green;">
};
<font style="color:blue;">class</font> Manager : <font style="color:blue;">public</font> Employee {
set<Employee*> group;
<font style="color:blue;">short </font>level;
<font style="color:green;">
<font style="color:blue;">public</font>:
Manager(<font style="color:blue;">const </font>string& n, <font style="color:blue;">int </font>d, <font style="color:blue;">int </font>lvl);
<font style="color:green;">
};
"the copy:
Classes objects copy is defined by the copy constructor and also by the affectations. Watch the following code :
<font style="color:blue;">void</font> f(<font style="color:blue;">const</font> Manager& m) {
Employee e = m; <font style="color:green;">
e = m; <font style="color:green;">
}
Only the Employee of Manager is copied, because the copy functions of Employee don't know anything from Manager. That is commonly called slicing. That can be a source of surprises and mistakes. One of the reasons we transmit pointers to and references of objects into a hierarchy is precisely to avoid that operations. Polymorphic behavior safeguarding and efficiency improvement are other ones".
hope this will help...
TOXCCT >>> GEII power
|
|
|
|
|
So its not possible?? or do I need to do something else explicit within my copy constructor in my derived class?? How do I explicitly call the base class copy constructor when the derived copy constructor is called??
Maybe I"m not getting it.
-C
|
|
|
|
|
Correct. You need to explicitly copy the base class in the copied object's derived class. The base class default constructor is called before the derived class copy constructor.
In summation, a call to the derived class copy constructor does not call the base class copy constructor. Instead, the default constructor is called in the base class.
Kuphryn
|
|
|
|
|