|
You could use either:
EnumChildWindows()
or
HWND hChildWindow = GetWindow(hThisHWnd, GW_CHILD);
Darka [ Xanya]
"I am not a slave to a god that doesn't exist."
|
|
|
|
|
If you know the ID of the child you can use GetDlgItem . It works for any window, not just dialogs.
Steve
|
|
|
|
|
Hi,
void C1View::OnViewIncomeview()
{
AfxGetMainWnd()->SendMessage(WM_COMMAND, ID_FILE_NEW);
CMDIFrameWnd *pFrame =
(CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild =
(CMDIChildWnd *) pFrame->GetActiveFrame();
CView *pView = (CView *) pChild->GetActiveView();
CEdit *r1 = new CEdit;
r1->Create(WS_CHILD|WS_VISIBLE|ES_AUTOVSCROLL,
CRect(x1,y1,x2,y2), pView, 1);
CEdit *r2 = new CEdit;
r2->Create(WS_CHILD|WS_VISIBLE|ES_AUTOVSCROLL,
CRect(x3,y3,x4,y4), pView, 1);
r1->SetFocus();
}
I have this piece of code in a function of a called by the application when an icon is clicked on the toolbar.
Now if I go to some other function of the same class and that function moves the caret from one edit box to another
What has to be done?
Thanks
Prithaa
|
|
|
|
|
Hi all,
Could someone please help me with the following problem:
How can I wait for a acknowledgement from another device when I have sent it a piece of data throught the serial port. (before sending the next piece of data).
I'm using VS2K5, and I have done the following:
<br />
..... looping .....<br />
array<String^>^ Text = gcnew array<String^>(10000);<br />
<br />
if (!serialPort1->IsOpen){ <br />
serialPort1->PortName = portNum; <br />
serialPort1->BaudRate = 9600;<br />
serialPort1->Open();<br />
}<br />
<br />
serialPort1->Write(Text[x]);<br />
<br />
:confused: ..... wait for ack ..... :confused:<br />
<br />
array<wchar_t>^ buffer = gcnew array<wchar_t>(10000);<br />
serialPort1->Read(buffer,x,sizeof(buffer));<br />
Thank you in advance
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
You can set a timeout for the reading: you'll wait until either all the data arrived or the timeout expired.
Check out the SetCommTimeout[^] function and the COMMTIMEOUT[^] structure.
|
|
|
|
|
Thanx Cedric ... I'll have a look
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
hi all,
I am having non-blocking TCP socket, trying to receive in a loop for requried bytes.
I am disconnectiing server by removing n/w cable from m/c running server application.
every time recv() fails with WSAWOULDBLOCK, why?
How can i detect that server died abnormally at client end?
recv() also not returning 0?
following is code
iMode = 1; // non-zero = non-blocking mode
iResult = ioctlsocket(sockMain,FIONBIO,(u_long FAR*)&iMode);
iDataGot=0;
while ( iData2Recv >= iDataGot )
{
// recv single byte at a time
iResult = recv(sockMain,&chData,1,0);
// if zero byte got or any other error
if ( iResult == 0 )
{
//never reach here
break;
}
/* timeout scheme
// check timeout period
DWORD dwCur = GetTickCount();
if ( dwCur > dwTimeout )
{
// timeout occured, so we failed
break;
}
*/
if ( iResult == SOCKET_ERROR )
{
if ( WSAGetLastError() != WSAEWOULDBLOCK )
{
// never reaches here
break;
}
else
{
// always executed.
continue;
}
}
// we got something add into output string
if ( iResult == 1 )
{
// add data,update counter into string and break if all datalen is received.
}
client application calls receive() after 10sec and it timeouts after 10sec if no data arrived. I want eliminate later 10sec. and detect server has died.
Thanks in advance.
Jetli
Constant Thing In World Is Change.
|
|
|
|
|
Hi,
Can VC++ work with Linux or Unix?
Or VC++ works only with Winodws?
Prithaa
|
|
|
|
|
prithaa wrote: Can VC++ work with Linux or Unix?
no.
prithaa wrote: Or VC++ works only with Winodws?
yes.
|
|
|
|
|
Hi,
What are the other alternatives of C++ with Unix or Linux
other than Java to handle Visual side of an application
Prithaa
|
|
|
|
|
prithaa wrote: What are the other alternatives of C++ with Unix or Linux
You asked about VC++ not C++. C++ is totaly cross-platform. VC++ is not. The difference is that VC++ contains library that can only target windows operating system (basically).
If you want to have a cross-platform GUI, take a look at wxWidgets[^], it is 'similar' to MFC.
|
|
|
|
|
prithaa wrote: What are the other alternatives of C++ with Unix or Linux
other than Java to handle Visual side of an application
Pick your weapon.[^]
|
|
|
|
|
vi, ÔÔÔÔÔ vi... (say vee-ay)
what, weren't we talking about powerful GUIs ?
|
|
|
|
|
Eiffel is one. Though the most-advanced IDE for it (EiffelStudio) is very expensive for commercial code, unless your product is open source in which case it is free.
Kevin
|
|
|
|
|
You can use C++ in Linux and Unix, just not the Microsoft Visual C++ IDE. Try Eclipse CDT[^] or KDevelop[^] if you need a graphical IDE.
|
|
|
|
|
Why asking twice ? couldn't you wait for 10 minutes ?
|
|
|
|
|
Hi,
Sorry
but I did not ask twice.It just happened that the network was not working properly and the Post message got clicked twice
Sorry again
Prithaa
|
|
|
|
|
prithaa wrote: Can VC++ work with Linux or Unix?
No.
Having said that, a friend of mine is using VC++ IDE to develop a Linux application. He edits files with VC++, and than uses g++ from Linux on VMWare to compile them and debug them (VMWare enables shared folders between the host and guest OS).
|
|
|
|
|
Technically, your friend's code is C++, not VC++. The 'V' part of the name is what makes it Windows vs. non-Windows. Visual Studio is the default editor for VC++.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Agree. That's why my response was "No".
|
|
|
|
|
Nemanja Trifunovic wrote: That's why my response was "No".
And prithaa was supposed to figure all of that out by reading "no?"
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi, it's me at new
I change the background color of my CFormView like this :
m_bgrBrush.CreateSolidBrush(*TheColor); // *TheColor is a DWORD RGB(x,x,x) from a class in the mainframe
HBRUSH MyView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CFormView::OnCtlColor(pDC, pWnd, nCtlColor);
if((nCtlColor == CTLCOLOR_STATIC) || (nCtlColor == CTLCOLOR_DLG) )
{
pDC->SetBkColor(*TheColor);
return (HBRUSH) m_bgrBrush;
}
return hbr;
}
Now i want to change the background color at runtime.
A Invalitade() or RedrawWindow() doesn't change the color at runtime
Thanks
|
|
|
|
|
Do you want to change color of background if yes you need to insert new color
|
|
|
|
|
baerten wrote: pDC->SetBkColor(*TheColor);
you have to change TheColor color accordingly
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief And You
|
|
|
|
|
about dll problem,thank
i have two file
a static dll file ,another static Exe file
i think Exe call List Class in dll,but..........
************************static dll******************************
<<<<<list.h>>>>>>>>
#pragma once
class AFX_EXT_CLASS List:public CListCtrl
{
public:
__declspec(dllexport) List();
__declspec(dllexport) ~List();
__declspec(dllexport) void CMCreate(CWnd *pWnd);
DECLARE_MESSAGE_MAP();
public:
__declspec(dllexport) afx_msg void OnNMClick(NMHDR *pNMHDR, LRESULT *pResult);
};
<<<<<<list.cpp>>>>>>>>>
#include "Stdafx.h"
#include "List.h"
List::List()
{}
List::~List()
{}
BEGIN_MESSAGE_MAP(List,CListCtrl)
ON_NOTIFY_REFLECT(NM_CLICK, &List::OnNMClick)
END_MESSAGE_MAP()
void List::OnNMClick(NMHDR *pNMHDR, LRESULT *pResult)
{
AfxMessageBox(_T("OK"));
*pResult = 0;
}
void List::CMCreate(CWnd *pWnd)
{
this->Create(WS_VISIBLE | WS_BORDER|SS_NOTIFY | WS_TABSTOP | WS_CHILD | LVS_ALIGNTOP | LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_OWNERDRAWFIXED, CRect(20, 20, 800, 200), pWnd, 123);
}
*************************Exe************************
List *m_pList;
m_pList=new List();
m_pList->CMCreate(this);
why ,i Click m_pList not show "ok"???
my english is not good,sorry
thank you
Blog:
http://360.yahoo.com/rxgmoral
|
|
|
|