|
define _WIN32_WINNT as a value bigger or equal than 0x0500!
read definition of SetLayeredWindowAttributes in WinUser.h!
Don't try it, just do it!
|
|
|
|
|
|
In my SDI application, I have 2 tree controls in a formview, which can be selected by tab control. On tabchange(), I select the root of the tree in which I switched. But, in that case whole tree becomes grayed. I can click on the grayed tree to see the items.
Following is the code, Please Help!!
if (m_TabCtrl.GetCurSel( ) ==1 )
{
m_TreeCtrl2.SelectItem (m_TreeCtrl2.GetRootItem());
}
if (m_TabCtrl.GetCurSel( ) ==0 )
{
m_TreeCtrl1.SelectItem (m_TreeCtrl1.GetRootItem());
}
|
|
|
|
|
Hi
Folks i am here with a problem
I did the followin things in my SDI VC application(MFC exe with default App wizrad options)
1.Created a Dialog Resource with a ComboBox(Attached a Control Variable to that m_ctrlCombo)
,attached a new class to it ( CTestDlg ).
2.Created object of CTestDlg in view class in OnLButtonDown()
[code]
void CTestView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CTestDlg dlg;
dlg.m_ctrlCombo.AddString("Alpha");
dlg.m_ctrlCombo.AddString("Beta");
dlg.DoModal();
CView::OnLButtonDown(nFlags, point);
}
[/code]
The Problem is that when i run the application and OnLButtonDown() Function is invoked
.I get a debug assetion failure
* "File: afxwin2.inl
Line 735 "
when i ignore it two times the Dialog is shown but no string attached to the comboBox
Plz help me out Folks to solve this.
Thanx in advance.
|
|
|
|
|
jinbabaj wrote:
dlg.m_ctrlCombo.AddString("Alpha");
dlg.m_ctrlCombo.AddString("Beta");
This should be in the InitDialog method of the dialog.
The assert pops because the dialog is not CREATED, only constructed, and will be created in the DoModal method.
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
|
Hey..
I wanted to configure Modem settings like
modem speed,parity,data bits,stop bits,"wait for dial tone before dialing" etc. programmtically.
I would also like to set some DUN settings like "Log on to network" and "Allow unsecured password" etc.
Advanced Thanks for any code, suggestions, clues or referrences...
|
|
|
|
|
Well I am not sure but in windows I think there is a file which keeps these settings... Try to look for a file like that!
Well... I am a beginner ...
|
|
|
|
|
|
Take a look at the various RAS functions, including:
RasCreatePhonebookEntry()<br />
RasEditPhonebookEntry()<br />
RasSetEntryProperties()<br />
RasSetEntryDialParams()
etc
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
It was really helpful and i can look at it the DUN related settings.
Now how can we change the Modem Settings do u have/know the some code snippets? Something i found here http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q163/2/36.asp&NoWebContent=1
But i ddidn't get more details to set the "Wait for dial tone before dialing",Call Preferences, "Cancel the call if not connected within"
etc.
Thankx a lot in advance
|
|
|
|
|
hi,
i want to hide a dialog when it start.
but, why it can't hide a dialog in OnInitDialog() with following code?
this->ShowWindow(SW_MINIMIZE); // work in OnInitDialog()
this->ShowWindow(SW_HIDE); // failure in OnInitDialog()
minimize is ok... but, can't hide a window.
even i added following in OnSize() also can't hide a window when i start.
if ( nType == SIZE_MINIMIZED )
{
this->ShowWindow(SW_HIDE);
}
any help?
thanks,
jim
|
|
|
|
|
Instead of calling dlg.DoModal(), use dlg->ShowWindow( SW_HIDE )
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
what u do for dialod based app will lead to assertion!
|
|
|
|
|
|
In my MFC MDI app, when I call GetRichEditCtrl().SetWordCharFormat or GetRichEditCtrl().SetSelectionCharFormat to color a piece of text, and then press Ctrl+Z (or Edit->Undo), the formatting gets undone!
Is there any way to tell the rich edit control not to allow this character formatting to be able to be undoable?
|
|
|
|
|
Use EmptyUndoBuffer() .
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I know of that, but what if before I call SetWordCharFormat the user has an operation that is undoable. If I called EmptyUndoBuffer, they would be unable to undo that operation they had "done" before I called SetWordCharFormat. There's got to be a solution
|
|
|
|
|
Hi!
I am trying to create a chat application using the async socket mode ( I dont need more than 20 connections at a time so I didnt use overlapped mode).
My chat program has a server and clients connected to it. The server returns to all clients the messages sent by a client and all the clients view the same message.
The problem is that my chat server can resend a message which came from a client to only one client... I think I made a mistake in the FD_ACCEPT message:
<br />
case FD_ACCEPT:<br />
{<br />
sockaddr_in remoteAddr;<br />
int iRemoteAddrLen;<br />
iRemoteAddrLen = sizeof(remoteAddr);<br />
hRemoteSocket = accept(hSocket, (sockaddr*)&remoteAddr, &iRemoteAddrLen);<br />
}<br />
break;<br />
This code accepts all incoming clients but only lets me communicate with just one ! How can I communicate with more clients ?(Do I have to create a new socket for all new clients? )
Thank you very much for your future answers!
Well... I am a beginner ...
|
|
|
|
|
You may have to keep a reference to all the client sockets that is connected to your server sockets. You can use an array / list of socket descriptors for this.
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Scolinks wrote:
How can I communicate with more clients ?(Do I have to create a new socket for all new clients? )
Indeed you do. The socket you initially create on your server is just used to accept new connections from clients. When you call accept it will return a socket which you use to communicate with that client. You'll need to keep track of all sockets created by th accept fn.
Phil
|
|
|
|
|
OK! Thanks a lot! I'll try to figure out how I can create a socket array!
Well... I am a beginner ...
|
|
|
|
|
I want my program to run an additional shell command.
I see function:
int system(const char* command);
It can execute command, but I cannot get the result of the command.
Is there any function that can execute command and recieve its result in some parameter? If not, I want any idea to get the result after the command is executed.
(I develop my program on Linux.)
|
|
|
|
|
Use either CreateProcess() or ShellExecute() instead.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
A better approach would be to use redirection. You can redirect the output of a command to a file. It should work irrespective of the platform used.
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|