|
|
Hi......
I am working on a SDI (Form based i.e., CFormView) Application. I need to remove the Tittlebar & Menu. Can anybody help me.
Thanks in advance
Sairam
|
|
|
|
|
Hi,
If you dont want Menu and ToolBar in your SDI application.
Comment the Hilighted Lines in this program.
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
//if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | //WS_VISIBLE | CBRS_TOP
// | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | //CBRS_SIZE_DYNAMIC) ||
// !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
//{
// TRACE0("Failed to create toolbar\n");
// return -1; // fail to create
//}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
//m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
//EnableDocking(CBRS_ALIGN_ANY);
//DockControlBar(&m_wndToolBar);
return 0;
}
Thanks and Regards.
SANTHOSH V
|
|
|
|
|
Hmmm...
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
How can i disconnect a computer from using internet after a specified amount of time. The internet connection can be in the form of dial up or LAN/PPP.
Please advice.
Thanks in advance.
Regards,
John.
|
|
|
|
|
emmmatty1 wrote: The internet connection can be in the form of dial up...
If RasDial() was used to make the connection, use RasHangUp() to terminate the connection.
I would think a better solution would be to mimic what happens when you right-click a connection and select Disable. I am not sure what API does this, however. You could try tapping into the Shell (i.e., opening the Network Connections applet in Control Panel, finding the Local Area Connection object, and then invoking its Enable or Disable menu item). I can do this via VBS but have not tried in VC++.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
modified on Wednesday, December 19, 2007 10:04:20 AM
|
|
|
|
|
What do you expect "disconnect" to do, when your computer is connected to a LAN with access to the internet?
Or are you talking about your computer actually *being* the router, connected to some sort of DSL or cable modem?
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
Hello everyone,
Why Visual Studio compiler can not optimize in this case? I think this case is almost the same as sample 1, why compiler can optimize sample 1 but can not optimze sample 2?
(sample 2, http://msdn2.microsoft.com/en-us/library/ms364057(vs.80).aspx)
class A {
public:
A() {printf ("A: I am in constructor\n");i = 1;}
~A() { printf ("A: I am in destructor\n"); i = 0;}
A(const A& a) {printf ("A: I am in copy constructor\n"); i = a.i;}
int i, x, w;
};
class B {
public:
A a;
B() { printf ("B: I am in constructor\n");}
~B() { printf ("B: I am in destructor\n");}
B(const B& b) { printf ("B: I am in copy constructor\n");}
};
A MyMethod()
{
B* b = new B();
A a = b->a;
delete b;
return (a);
}
int main()
{
A a;
a = MyMethod();
}
thanks in advance,
George
|
|
|
|
|
And what is sample 1 and sample 2?
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?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Hi Nelek,
Here is sample 2 code. I do not understand why if we optimize by /O2, there is still copy constructor invoked?
http://msdn2.microsoft.com/en-us/library/ms364057(vs.80).aspx[^]
Here is output,
A: I am in constructor
A: I am in constructor
B: I am in constructor
A: I am in copy constructor
B: I am in destructor
A: I am in destructor
A: I am in destructor
A: I am in destructor
class A {
public:
A() {printf ("A: I am in constructor\n");i = 1;}
~A() { printf ("A: I am in destructor\n"); i = 0;}
A(const A& a) {printf ("A: I am in copy constructor\n"); i = a.i;}
int i, x, w;
};
class B {
public:
A a;
B() { printf ("B: I am in constructor\n");}
~B() { printf ("B: I am in destructor\n");}
B(const B& b) { printf ("B: I am in copy constructor\n");}
};
A MyMethod()
{
B* b = new B();
A a = b->a;
delete b;
return (a);
}
int main()
{
A a;
a = MyMethod();
}
thanks in advance,
George
|
|
|
|
|
George_George wrote: I do not understand why there is still copy constructor invoked?
Because for efficiency-reasons,
A a = b->a; invokes the copy constructor instead of the constructor and the assignment-operator.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
Thanks jhwurmbach,
You mis-understood my question. My question is NRVO technique is used to optimize to reduce the need to invoke copy constructor. Why in the above code, NRVO does not take effect and copy constructor is still invoked.
regards,
George
|
|
|
|
|
Hi Friends,
I want to know the size of WCHAR.
This is the code line i am using WCHAR InputText[99999]=L"";
I am using this string to read a *.txt file.
But if i choose a 5 mb file. I am not able to read.
It is posible to increase the size
Thanks and Regards.
SANTHOSH V
|
|
|
|
|
U can set its value to the maximum positive value of int or to the available memory.
Come online at:-
jubinc@skype
|
|
|
|
|
WCHAR* InputText = ( WCHAR* ) HeapAlloc( GetProcessHeap( ), HEAP_GENERATE_EXCEPTIONS, 5 * 1024 * 1024 );
|
|
|
|
|
Not many people read the whole file into a buffer. As we say, this solution doesn't scale.
Most people read text files, line by line... only buffering what they need.
If you're writing a text editor... it's a different story... and in that case you should dynamically allocate the text file buffer.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<a href="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</a>
|
|
|
|
|
santhoshv84 wrote: This is the code line i am using WCHAR InputText[99999]=L"";
Why not use a std::wstring object instead?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
i am working on client server application both are developed on mfc.My problem is that client create a file after writing put it in a directory on server and server is continuously searching that directory and try to open that file but still hold by client.How can i know that particular file is not hold by client.
thank u in advance
|
|
|
|
|
One solution may be sending a parameter when client ends working with file.
Another possibility (but I don't know if that is ok for you) is to use the "share priviliges" flags of the file. You can create the file to be used only by one application or by more as you want.
Another one would be create another empty file that just hold the name of the first one + _busy or something like that, and deleting that sec file after ending the work with the first one.
P.S. there must most probably be better solutions, my knowledge is limited, this is just a logic think.
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?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
modified on Wednesday, December 19, 2007 4:22:20 AM
|
|
|
|
|
Nalek came up with some solutions.
Another one... Write to file AAAA.aaa, then when you're done with it, close it, and rename it to BBBB.bbb, and the server can then catch that file.
I hope the server is not in a loop continouusly checking for the file - your users won;t thank you for that. I trust you're using FindFirstChangeNotification etc for this job.
Iain.
|
|
|
|
|
Iain Clarke wrote: Nalek came up with some solutions.
Another one... Write to file AAAA.aaa, then when you're done with it, close it, and rename it to BBBB.bbb, and the server can then catch that file.
I suppose that is an irony to say my solutions suck. For next times, I prefer a simple "this is bad, is better that". I know I am limited, but I try and from corrections like yours
Iain Clarke wrote: I trust you're using FindFirstChangeNotification etc for this job
I learn too.
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?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Iain Clarke wrote: I hope the server is not in a loop continouusly checking for the file...
That's what his "server is continuously searching that directory" comment is implying.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Can we restart the system programatically?
Can you show me tha way?
Thank you.
Saadhinchaali
|
|
|
|
|
The following is from MSDN :
BOOL WINAPI InitiateSystemShutdown(
__in_opt LPTSTR lpMachineName,
__in_opt LPTSTR lpMessage,
__in DWORD dwTimeout,
__in BOOL bForceAppsClosed,
__in BOOL bRebootAfterShutdown
);
Initiates a shutdown and optional restart of the specified computer.
To record a reason for the shutdown in the event log, call the InitiateSystemShutdownEx function.
However, note the following :
To shut down the local computer, the calling thread must have the SE_SHUTDOWN_NAME privilege.
To tweak privileges, use OpenProcessToken(), LookupPrivilegeValue(), AdjustTokenPrivileges().
Best of luck,
Bio.
|
|
|
|
|