|
Hi every body.
How i'am program same MSN Messenger when has user login.
a program stay in system tray popup dialog message same
MSN Messanger or Norton Antivirus
Thank you.
|
|
|
|
|
My error!
First time!i choice Two.m_cbodata is Two.
Second time!i choice One.m_cbodata is Two.
When i choice ,my Combo Box data is not change.
I don't know what happen.
pls help me.
My code is following......
//MyView.h
public:
//{{AFX_DATA(CMyView)
CString m_cbodata;
//}}AFX_DATA
//MyView.cpp
void Click()
{
UpdateData(TRUE);
if (m_cbodata=="One")
{
AfxMessageBox("One");
}
if (m_cbodata=="Two")
{
AfxMessageBox("Two");
}
}
|
|
|
|
|
i found my error!!!
i change following code!!!!
//MyView.cpp
if (0==m_ctrldevice.GetCurSel( ))
{
AfxMessageBox("One");
}
if (1==m_ctrldevice.GetCurSel( ))
{
AfxMessageBox("Two");
}
|
|
|
|
|
how about this:
CString str;
str.Format("%d",m_ctrldevice.GetCurSel() + 1);
AfxMessageBox(str);
this will display a messagebox with "1","2", or whatever the cursel is.
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|
|
Hi !
I'm facing many problems (app crashs) when my app is compiled in release mode (problems I don't have in debug mode). I noticed that removing some const_cast improved the situation.
This makes me wonder : am I allowed to use const_cast ? How can I spot the situations where const_cast should be avoided ? If const_cast is dangerous, why is it provided ?
Thanks for your enlightment !
Jerome
|
|
|
|
|
hian So Jerome BAck!!!!
so any way here you's Answer,As MSDN states that,i have maked sentence bold which might be causing problem in your program
pointer to any object type or a pointer to a data member can be explicitly converted to a type that is identical except for the const, volatile, and __unaligned qualifiers. For pointers and references, the result will refer to the original object. For pointers to data members, the result will refer to the same member as the original (uncast) pointer to data member. Depending on the type of the referenced object, a write operation through the resulting pointer, reference, or pointer to data member might produce undefined behavior.
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Hi everybody,
Currently i am thinking how to program a PC Booking/Reservation System for an office of 100 PCs where user login is controled by Windows Active Directory.
I have little idea about AD login control, anybody can tell me where to start?
Thanks
JW
DJ
|
|
|
|
|
well.....i had a doubt earlier regarding how i can access data from different classes.....i got the answer.....though that exactly didnt solve my answer.....
u c i am making a dialog box.....that is to load a picture.....and upon moving the mouse upon it.....it is supposed to change the pictures......(bacially these pics are frames of a volume control).....what i have done is that i have loaded the pics.....into the dc memory(and made it compactible).....so by bitblt it displays.....it workz as well.....
my problem is.....i have many such controls......so i have derived a class from the Cstatic class and by using the concept of subclassing.....i can get the mouse controls for the particular control.....
but to bitblt it i have to call the variable that pointz to the frame of that picture......but i have declared the variables that hold the frames of this in the main CXyzDlg::OnInitDialog() .....how do i access this variables from th derived class THAT I HAVE CREATED?????
PLEASE HELP!!!!!!
|
|
|
|
|
could you be more specific, even give some code exemple and point out the error
|
|
|
|
|
ok......
this os what i have declared in the CXyzDlg.h
<br />
CSize m_size;<br />
CSize m_size1;<br />
<br />
CPoint m_pt;<br />
CDC m_dcMem;
CDC m_dcMempotI[32];
<br />
HBITMAP m_hBmpOld;
HBITMAP m_hBmpNew;
BITMAP m_bmInfo;
<br />
BITMAP m_bmInfo1; <br />
<br />
this is what i have added in the CXyzDlg::OnPaint()......here i have called the variables that points to the picture in the dc memory
<br />
void CCreamzDlg::OnPaint() <br />
{<br />
if (IsIconic())<br />
{<br />
CPaintDC dc(this);
<br />
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);<br />
<br />
int cxIcon = GetSystemMetrics(SM_CXICON);<br />
int cyIcon = GetSystemMetrics(SM_CYICON);<br />
CRect rect;<br />
GetClientRect(&rect);<br />
int x = (rect.Width() - cxIcon + 1) / 2;<br />
int y = (rect.Height() - cyIcon + 1) / 2;<br />
<br />
dc.DrawIcon(x, y, m_hIcon);<br />
}<br />
else<br />
{<br />
<br />
<br />
CPaintDC dc(this);<br />
dc.BitBlt(offsetx,offsety,m_size.cx+50,m_size.cy+50,&m_dcMem, 2, 0,SRCCOPY);<br />
<br />
dc.BitBlt(offsetx1,offsety1,m_size1.cx,m_size1.cy,&m_dcMempotI[m_i], -14, -13,SRCCOPY);<br />
<br />
dc.BitBlt(offsetx2,offsety2,m_size1.cx,m_size1.cy,&m_dcMempotI[m_j], -14, -13,SRCCOPY);<br />
CDialog::OnPaint();<br />
<br />
<br />
}<br />
}<br />
<br />
the code that i am showing here is the one that works.......that is the one that doesnot use subclassing.....
i need subclassing feature coz the only action that i can get with a ststic control is just the event "On Clicked()"....but i need the mousemove function as well in the static window....so for that i derive a class from the base class CStatic....and add the mouse movements into it(subclassing).....the problem is that even in this derived class i have put in the WM_PAINT message as well....so that it can be automatically updated.....and thatz when the problem arises.....
i am not able to call the
dc.BitBlt(offsetx2,offsety2,m_size1.cx,m_size1.cy,&m_dcMempotI[m_j], -14, -13,SRCCOPY);
coz inside it the the derived class the variable : ,&m_dcMempotI , m_j ,offsetx2,offsety2,m_size1 are not defined...
what do i do....
if i were to put the dcmemory variable in a class....each time i create an object....a lot of memory is taken...coz all the frames of the volume controls get created again and again.....but tere is a need only for one.....
i hope u understood the prob.....
this is what i had written in the CXyzDlg::OnInitDialog()
in this there are three static windowz that i have created (one background bitmap,two controlz bitmap)
with the variables m_st1 ,.m_st3 ,m.st4 respectively being the static variables linked to the static windows.
<br />
BOOL CCreamzDlg::OnInitDialog()<br />
{<br />
CDialog::OnInitDialog();<br />
<br />
<br />
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);<br />
ASSERT(IDM_ABOUTBOX < 0xF000);<br />
<br />
CMenu* pSysMenu = GetSystemMenu(FALSE);<br />
if (pSysMenu != NULL)<br />
{<br />
CString strAboutMenu;<br />
strAboutMenu.LoadString(IDS_ABOUTBOX);<br />
if (!strAboutMenu.IsEmpty())<br />
{<br />
pSysMenu->AppendMenu(MF_SEPARATOR);<br />
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);<br />
}<br />
}<br />
<br />
SetIcon(m_hIcon, TRUE);
SetIcon(m_hIcon, FALSE);
<br />
m_i=0;<br />
m_j=0;<br />
m_check=FALSE;<br />
<br />
<br />
m_DragOn=FALSE;<br />
<br />
<br />
CClientDC dc(this);<br />
m_dcMem.CreateCompatibleDC( &dc );<br />
<br />
sourcex=sourcey=0;<br />
<br />
<br />
m_hBmpNew = (HBITMAP) LoadImage(<br />
AfxGetInstanceHandle(),
"c:\\mm.bmp",
IMAGE_BITMAP,
0,
0,
LR_CREATEDIBSECTION|LR_LOADFROMFILE); <br />
<br />
if( m_hBmpNew == NULL )<br />
{<br />
AfxMessageBox("Load Image Failed");<br />
}<br />
<br />
else {<br />
<br />
<br />
m_st1.GetClientRect( &rectStaticClient );<br />
rectStaticClient.NormalizeRect();<br />
m_size.cx=rectStaticClient.Size().cx;<br />
m_size.cy=rectStaticClient.Size().cy;<br />
m_size.cx = rectStaticClient.Width();
m_size.cy = rectStaticClient.Height();
<br />
m_st1.ClientToScreen( &rectStaticClient );<br />
ScreenToClient( &rectStaticClient);<br />
<br />
m_pt.x = rectStaticClient.left;<br />
m_pt.y = rectStaticClient.top;<br />
GetObject( m_hBmpNew , sizeof(BITMAP), &m_bmInfo );<br />
VERIFY(m_hBmpOld = (HBITMAP)SelectObject(m_dcMem, m_hBmpNew ) );<br />
offsetx= m_pt.x;<br />
offsety=m_pt.y; <br />
}<br />
<br />
<br />
m_dcMempotI[0].CreateCompatibleDC( &dc );<br />
<br />
strcpy(m_filename,"E:\\projectz_infoz\\minimax_potz\\modified\\pot1\\pot");<br />
_itoa( 0, m_charz, 10 );<br />
strcat(m_filename,m_charz);<br />
strcat(m_filename,".bmp");<br />
<br />
<br />
m_hBmpNew = (HBITMAP) LoadImage(<br />
AfxGetInstanceHandle(),
m_filename,
IMAGE_BITMAP,
0,
0,
LR_CREATEDIBSECTION|LR_LOADFROMFILE); <br />
<br />
if( m_hBmpNew == NULL )<br />
{<br />
AfxMessageBox("Load Image Failed");<br />
}<br />
<br />
else {<br />
m_st3.GetClientRect( &rectStaticClient );<br />
rectStaticClient.NormalizeRect();<br />
m_size1.cx=rectStaticClient.Size().cx;<br />
m_size1.cy=rectStaticClient.Size().cy;<br />
m_size1.cx = rectStaticClient.Width();
m_size1.cy = rectStaticClient.Height();
<br />
m_st3.ClientToScreen( &rectStaticClient );<br />
ScreenToClient( &rectStaticClient);<br />
<br />
m_pt.x = rectStaticClient.left;<br />
m_pt.y = rectStaticClient.top;<br />
GetObject( m_hBmpNew , sizeof(BITMAP), &m_bmInfo );<br />
VERIFY(m_hBmpOld = (HBITMAP)SelectObject(m_dcMempotI[0], m_hBmpNew ) );<br />
offsetx1= m_pt.x;<br />
offsety1=m_pt.y; <br />
}<br />
<br />
<br />
for(m_i=1;m_i<=31;m_i++)<br />
{<br />
<br />
m_dcMempotI[m_i].CreateCompatibleDC( &dc );<br />
<br />
strcpy(m_filename,"E:\\projectz_infoz\\minimax_potz\\modified\\pot1\\pot");<br />
_itoa( m_i, m_charz, 10 );<br />
strcat(m_filename,m_charz);<br />
strcat(m_filename,".bmp");<br />
<br />
<br />
m_hBmpNew = (HBITMAP) LoadImage(<br />
AfxGetInstanceHandle(),
m_filename,
IMAGE_BITMAP,
0,
0,
LR_CREATEDIBSECTION|LR_LOADFROMFILE); <br />
<br />
if( m_hBmpNew == NULL )<br />
{<br />
AfxMessageBox("Load Image Failed");<br />
}<br />
<br />
else {<br />
GetObject( m_hBmpNew , sizeof(BITMAP), &m_bmInfo );<br />
VERIFY(m_hBmpOld = (HBITMAP)SelectObject(m_dcMempotI[m_i], m_hBmpNew ) );<br />
}<br />
<br />
}
<br />
m_i=0;<br />
<br />
<br />
<br />
m_st4.GetClientRect( &rectStaticClient1 );<br />
rectStaticClient.NormalizeRect();<br />
m_size1.cx=rectStaticClient.Size().cx;<br />
m_size1.cy=rectStaticClient.Size().cy;<br />
m_size1.cx = rectStaticClient.Width();
m_size1.cy = rectStaticClient.Height();
<br />
m_st4.ClientToScreen( &rectStaticClient1 );<br />
ScreenToClient( &rectStaticClient1);<br />
<br />
m_pt.x = rectStaticClient1.left;<br />
m_pt.y = rectStaticClient1.top;<br />
offsetx2= m_pt.x;<br />
offsety2=m_pt.y; <br />
<br />
<br />
<br />
return TRUE;
}<br />
<br />
please get me a solution......anyone....
if anyone has got a bettr way of doing this without subclassing.....that is also ok as well....
HELP!!!!!
|
|
|
|
|
hi all,
I want to Right Click on the different static Controls..(Labels,..)
How to do that using Visual C++?
Can anybody please help me?
Thanks in advance..
|
|
|
|
|
...
hi there...
this is how i do it....
well.....first derive a class say "CMystatic"from the base class CStatic class using the 'ADD CLASS' option in the wizard.....
after u do this.....
again take the wizard....then take the "message maps option" and in that select the class name that u have just derived (here called as CMystatic) from the "class name" combo box......
then.....in the messages option select the WM_LBUTTONDOWN.....by doubleclicking on this the wizard automatically loads the handler responsible when the left button is clicked on the static control.....
if have still doubt check up.....
Create your own controls - the art of subclassing
By Chris Maunder .....which iz a very informative topic available in code project .....
cheerz....
|
|
|
|
|
hi....;)
if u want right click......after subclassing....just select the "WM_RBUTTONDOWN"......there ar numerous other types u can handle when u subclass......
best of luck..
cheerz
|
|
|
|
|
I am building a dialog based application (MFC) showing complex tebular data, say different form of grids. I did not find any grid to fullfill my needs. so i put a numer of msflex grids (15 grids) set their properties to give look and feel i want, but it caused an anoying problem.
The size of resource templete file .rc is 12MB but changing size and properties of grid/dialog to get desired look causes the size of .rc file upto 200 MB, the computer nearly dies while compilation may be due to large size of .rc file, dialog also contains 3 bitmap images the total size of iamges is just 615KB (so the BMP's are not the problem)
I want to ask that;
1. Is their any limitation on the resources in an application/ dialog?
2. Limitation on Number of controls that can be placed on dialog?
3. Obviously 200MB .rc file is unacceptable, any compiler options; how to fix .rc files, I have regesigned the dialog but when the number of controls increases same problem reappears.
Please, Help.
|
|
|
|
|
Me too got the same prblm. ..
But once we delete the grids, the .RC file size will decrease.
Again we can add the grid.
But its safe to have backup of .RC file
It might be a bug in the ActiveX grid.
|
|
|
|
|
Thanks for ur Reply
Again we can add the grid.
Adding the grids back re-increases the the size of .rc file; problem reappears
It might be a bug in the ActiveX grid.
Any tool or method to ensure the safe usability of AX controls? so one can check the contols before using it.
MSFlex grid is Microsoft's product, it cant be buggy (maybe); ithink it is some other problem related to resource compiler about which i know nothing.
|
|
|
|
|
Hai frens. . .
Can any one guide me to select a particualr row of flex grid. . .
I use the function SetRowSel(), but this is selecting the number of rows given as parameter. I need to know how to select a particular row. . .and what function is used for that.
could any one help me please. . .
Thanx
bye
|
|
|
|
|
Grid Properties -> control tab
Set Selection by row, it will select whole row when SetRowSel is called.
|
|
|
|
|
The actual prblm here is i can able to select row wise. . .
but if i want to select another row keeping the previous row selected, there comes the prblm. So, if there any function exsists to select a particular row then i will keep the previous row selected and using that func i will select the next row.
|
|
|
|
|
Hello,
I'm working on a project that uses the SECTreeCtrl from Stingray's Objective Toolkit. I need to handle the message that gets fired when a branch is expanded and when a branch is collapsed. For the MFC CTreeCtrl, this message is TVN_ITEMEXPANDED.
My problem is that there seems to be no such message for the SECTreeCtrl.
The class is declared as follows:
class TreeView : public SECTreeCtrl
When I try to add the message handler for the TreeView class through Class Wizard, no such message shows up. Furthermore, there is no other aptly named message that suggests it gets fired when a branch is expanded/collapsed.
What am I missing?
-Ian
|
|
|
|
|
|
thank you, thank you, thank you!
Cheers,
-Ian
|
|
|
|
|
Dear friends,
Consider the following simple program:
int a= 2, b= 3, c=23, d=5, e= 12, f= 30, g= 100;
if(g>a)
{
DoSomething();
}
if(a==2 && c == 21)
{
if(d== 5)
{
DoSomething
}
else if( e == 4)
{
DoSomethingElse();
}
}
As can be seen from the above program, there are two if conditions in order to fullfil the
client's requirements. The client informed us about these conditions and so we included these
conditions in the program and sent the software to the client.
Now, after few days, the client made a call to us and said that he wanted another condition:
if(d==2 || e==11)
{
DoSomething();
}
So we added this condition in the program, compiled it and sent the copy to the client.
Similarly client again called us and asked us to add some new conditions and this situation
is going on and on. client is daily calling us to add new conditions.
Now we want to give something generic to the client i.e we want to add some feature such that
there is no need for client to call us , instead he should be able to define his conditions himself
whenever he likes and able to customize it.
Can anyone suggest me the solution of this problem ? DO i need to add scripting support ?
The client is not too much technology savvy, so i like to avoid scripting, however if there
is no other solution then i need to give scripting support. If you suggest scripting then whaat
do you think will be the best solution VBScript or something else ??
Oh yes, the functions DoSomething() and DoSomethingElse() are predefined. The client will not write new functions. Instead he should be able to define new *condition* and tell that which of these predefined functions gets called if condition is met.
Imtiaz
|
|
|
|
|
sounds like you want us to do your homework
seriously though, if hes paying for the support on a per job basis then just add it in as he asks for it.
Bryce
---
To paraphrase Fred Dagg - the views expressed in this post are bloody good ones.
--
Publitor, making Pubmed easy.
http://www.sohocode.com/publitor
Our kids book :The Snot Goblin
|
|
|
|
|
bryce wrote:
sounds like you want us to do your homework
Seriously though, i was not expecting this kind of reply here at Code Project Visual C++ forum. This is not a school work. I only defined my actual problem in simple words and wrote a simple source code above. The actual code is something else. I defined problem in simple source code in order to avoid complexity. The actual software is that of Stock Exchange. There are no variable like a,b,c as described above. The problem is the same.
Imtiaz
|
|
|
|
|