|
Peter, Chan wrote: I think the fastest way maybe convert it to vs.net 2005. But it is not such easy. It showed a lot of errors.
Those errors have nothing to do with Vista. They are the result of VS2005 being more C++ compliant.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
I just want to know that is there any MFC or ATL class for regular expression search or validation? If not, what are the other alternative?
I don't want to use .Net or anything which needs framework to be installed on client machine.
Looking for any help, suggession.
Thanking you,
Anurag Gandhi.
Anurag Gandhi.
|
|
|
|
|
I think boost may have a regex library. C++ and MFC do not, as standard.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
Hi,
I have some problem in handing the WM_NCPAINT. As per MSDN, the dc with the region clipped can be obtained as follows for handling the WM_NCPAINT.
case WM_NCPAINT:<br />
{<br />
HDC hdc = GetDCEx(hwnd, (HRGN)wParam, DCX_WINDOW|DCX_INTERSECTRGN);<br />
}
But when I tried this am getting hdc as NULL. Any solution for this issue.
N.B - I tried using the DCX_CACHE flag in the GetDCEx() function. Eventhough in this case it returned a dc handle, the clipping is not proper.
Thanks
Naveen
[OpenedFileFinder]
|
|
|
|
|
Can u use GetClipBox API?
akt
|
|
|
|
|
Is wParam == 1 when GetDXEx() fails?
If not, try calling GetLastError() when it fails and see what the error code is.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
its now ok Mark. When I specified the DCX_PARENTCLIP flag it working fine also cliping is proper.
|
|
|
|
|
Hi all,
I am making a multi threaded application in which i have made a UI thread and from that thread i m using SendMessage() function to send a message to be displayed like this.
int row_no = test_int;
m_pLogWnd->SendMessage(MSGDIS, (WPARAM)(CString*)&logmsg,(LPARAM)(&row_no));
and recieving that message in my main class function like this..
LRESULT CMonitorVw::OnDispMessage(WPARAM wparam, LPARAM lparam)
{
CString* pLogMessage = (CString*) wparam;
int *u = (int*)lparam;
m_obj->m_List.SetItemText(u,7,*pLogMessage);
return UpdateData(FALSE);
}
<\pre>
if i do this i am getting an error
SetItemText' : cannot convert parameter 1 from 'int *' to 'int'
either tell me the way to convert int to int* or in any other way i pass or recieve inter value.
Thanks in advance
|
|
|
|
|
neha.agarwal27 wrote: m_obj->m_List.SetItemText(u,7,*pLogMessage);
change it as
m_obj->m_List.SetItemText(*u,7,*pLogMessage);
|
|
|
|
|
Actually you don't to pass an integer pointer, you may pass directly the integer value:
m_pLogWnd->SendMessage(MSGDIS, (WPARAM)(CString*)&logmsg,(LPARAM)row_no);
and
LRESULT CMonitorVw::OnDispMessage(WPARAM wparam, LPARAM lparam)
{
CString* pLogMessage = (CString*) wparam;
int u = (int)lparam;
m_obj->m_List.SetItemText(u,7,*pLogMessage);
return UpdateData(FALSE);
}
BTW usually pointers are passed only as LPARAM (though maybe an issue only on very old Windows versions).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Others have answered the details of your questions, but I wanted to make an observation.
When passing pointers between threads, you need to make sure that the item being pointed to (logmsg and row_no) will remain in existence during the time the receiving thread is processing the message. In general, this means that you should not pass pointers to items allocated on the stack i.e. variables that are local to the function sending the message. Your code is ok in this respect because you use SendMessage instead of PostMessage. However, using SendMessage tends to defeat the purpose of multi-threading by forcing the two threads to act sequentially.
Judy
|
|
|
|
|
Im Create a static control inorder to use it as a label
CStatic *temp = new CStatic();
temp->Create("YYYYY" ,SS_SIMPLE ,CRect(0,0,25,25) ,this);
My requirement is if my text which should display inside static control
exceeds the rectangle limits it should take a new line automatically.
It Must be multiline static control.
so how can i do it.
bhw
|
|
|
|
|
Use MultiLine Edit Control and make it readonly.
|
|
|
|
|
|
In the read only edit box how to stop the blinking |.
bhw
|
|
|
|
|
Don't let it have the input focus.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi ereryone,
I need a multithreaded downloading module for my project in vc++.net now.
Would you like give me the code about it? Or give me some advice to do this.
Thanks a lot!
|
|
|
|
|
I subclassed a control (actually, a CStatic) and want to access from it's functions some data members of the parent.
Let's say the new class of the control is CMyOwnCtl, and the parent, the main dialog, is CMyOwnDlg.
I am defining a pointer to the parent in CMyOwnCtl.h:
CMyOwnDlg *Parent;
This works only with
#include "CMyOwnDlg.h"
#include "CMyOwnCtl.h"
in this sequence. However, CMyOwnDlg.h requires the definition of CMyOwnCtl, i.e. the includes have to be in the other sequence.
I solved this by placing the pointer to the parent in the global definitions. However, I wonder if it could be done more elegantly.
|
|
|
|
|
You can put the includes in the cpp files, and then forward declare the class - so put
class CMyOnwCtl;
in the top of CMyOwnDlg.h and vice versa. This tells the compiler that a class exists, and it will find the details out during the compile process.
I should add - this works because you have a *pointer* to CMyOwnDlg in CMyOwnCtl - this is fine, all the compiler needs to do when compiling the header, is allocate space for a pointer. If you put an instance of the object in the header, it would not work.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I tried this already before asking, but it causes an error, when assigning the address of the parent to the pointer. If ctl_MyControl is the member variable of the instance of the subclassed control, and Parent is defined in MyOwnCtl.h as
class Parent;
then
ctl_MyControl.Parent = this;
in the parent's OnInitDialog causes
error C2440: '=' : cannot convert from 'class CMyOwnDlg *const ' to 'class $S217 *'
However, if the pointer is defined (in the globals) as
CMyOwnDlg *Parent;
then
Parent = this;
works fine from OnInitDialog.
|
|
|
|
|
Vancouver wrote: ctl_MyControl.Parent = this;
This means that ctl_MyControl is not a pointer, which means it won't work, like I said. If ctl_MyControl is a member variable, a forward declaration will only work if it's a pointer to an instance of your control.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Sorry, I mistyped it in the post. Of course I declared it as a pointer and it created the mentioned error.
|
|
|
|
|
|
class *Parent;
is in CMyOwnCtl.h. If it was not there, I would not have any problem: in the function itself CMyOwnDlg can be used. because both headers are known there (and then John M. Drescher's suggestion works).
|
|
|
|