|
But the control image is attached to a scrollable window -a class derived from CScrollView-
llp00na
|
|
|
|
|
I think I have got it. I have added the mouse event handlers to the derived class from CScrollView .
Thank you very much for your help.
llp00na
|
|
|
|
|
Hi friends,
I have two dialogs .
dialog1 has the following styles
DS_MODALFRAME | WS_POPUP |WS_CAPTION |WS_BORDER
dialog2 has the following styles
DS_MODALFRAME | WS_POPUP.
Dialog 1 is placed exactly on the top of Dialog 2.
These two dialogs are aligned in a way that they appear as a single dialog.
Things are working fine in all the windows operating systems(except Vista)
But in Vista,
The alignment is lost.
The top dialog(dialog1) appears little bigger than the dialog2.
Can somebody help me out solving this problem.
Code is written using pure SDK.(no MFC).
Thanks in advance.
Appu..
"My blood group is not B+.But I have it my blood"
|
|
|
|
|
Hi,
We are using opendesktop api in a binary and we ar getting return code
170 (The requested resource is in use. ERROR_BUSY)after executing the
binary for some times . If i restart the box and execute the binary,
the error disappears.
I have not been able to find any documentation describing under what
conditions ERROR_BUSY is returned by OpenDesktop nor how to handle
this condition. For example, should OpenDesktop be retried after a
short sleep?
If anyone can provide any information on this condition, it would be
appreciated.
Regards,
Yogish
|
|
|
|
|
Hi guys,
I've been reading some forums about catching the escape key. I have this property page and when I press the escape key, instead of closing (which should have happened by default), does not close.
There were some suggestions like overriding OnClose and OnCancel or using PreTranslateMessage which has this code:
BOOL MFCDigPropPage::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message==WM_KEYDOWN)
{
if(pMsg->wParam==VK_RETURN || pMsg->wParam==VK_ESCAPE)
MessageBox("Pressed the escape or enter key!");
}
return CDialog::PreTranslateMessage(pMsg);
}
This code worked when I created a simple dialog box with just the OK and Cancel button on it. But when i tried it on my property page, it does not work anymore. Any suggestions/ideas regarding this one??? I would really really really appreciate any help on this.
Thanks!
waxie
|
|
|
|
|
you need to handle the PreTranslateMessage of the property sheet. if property sheets have a parent then handle the pretranslate of that dialog.
nave
|
|
|
|
|
waxie wrote: Any suggestions/ideas regarding this one???
You need to handle this ,message in owner property sheet. e.g.
BOOL CMySheet::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message==WM_KEYDOWN)
{
if(pMsg->wParam==VK_RETURN || pMsg->wParam==VK_ESCAPE)
MessageBox(L"Pressed the escape or enter key!");
}
return CPropertySheet::PreTranslateMessage(pMsg);
}
|
|
|
|
|
What are you trying to do? If you want the dialog to not close when the user presses Enter/ESC, don't use PreTranslateMessage() which is too low-level. Just change OnOK() /OnCancel() so they don't call EndDialog() . In a property page, handle the PSN_APPLY and PSN_QUERYCANCEL notifications.
|
|
|
|
|
I am trying to develop a Annotation tool, with which i should be able to draw, mark on the windows screen.
Can any help me, in pointing to some documentation/APIs where i can get started.
Thanks in advance,
Vissu
|
|
|
|
|
Vissu89 wrote:
Can any help me, in pointing to some documentation/APIs where i can get started.
check CDC class in MSDN!
"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
|
|
|
|
|
hi ,
how to distribute last column of list control to fit into client area?
thanks
rakesh
|
|
|
|
|
Try the below code.
CRect ClientRect;<br />
GetClientRect( &ClientRect );<br />
CRect LastItemRect;<br />
int nLastitem = GetHeaderCtrl()->GetItemCount() - 1;<br />
GetHeaderCtrl()->GetItemRect( nLastitem , &LastItemRect );<br />
int nNewLength = ClientRect.right - LastItemRect.left ;<br />
SetColumnWidth( nLastitem , nNewLength );
nave
|
|
|
|
|
thank you,
can you please reproduce this probelm by using
1> press window key + e
2> go to details view of folder
now see last column here in list.
can we get last column by using getheaderctrl() fn,
now i have to re distribute this space into all column at runtime .
thanks
rakesh
|
|
|
|
|
if you want to equally distribute the column width do as follows..
CRect ClientRect;
GetClientRect( &ClientRect );
CRect LastItemRect;
int nCount = GetHeaderCtrl()->GetItemCount();
int nWidth = ClientRect.Width()/nCount;
for( int nIdx = 0;nIdx < ncount; nIdx++)
{
SetColumnWidth( nIdx , nWidth );
}
nave
|
|
|
|
|
|
The list will do this for you. Call SetColumnWidth() on the last column and use the LVSCW_AUTOSIZE_USEHEADER flag.
|
|
|
|
|
Hi all,
I want to create a new class derived from CTime.
<br />
class XTime : public CTime <br />
{<br />
public:<br />
XTime();<br />
virtual ~XTime();<br />
<br />
};<br />
then I create a new object
XTime m_Date;
and then I want to initialize my object:
m_Date = NULL;
there is an error when compiling. When I create my object from a normal CTime, everything works.
As far as I learned C++, I can derive a new class and it inherits everything from the base class. But why can't I initialize it? It seems, that the = operator is not working.
Any help?
Juergen
|
|
|
|
|
This is because CTime have a contrcvtor of type CTime(time_t time);
So in the derived class also declare a constructor which accepts a time_t object and simply pass that object to base class.
class XTime : public CTime <br />
{<br />
public:<br />
XTime();<br />
virtual ~XTime();<br />
<br />
XTime( time_t t ):CTime(t)<br />
{<br />
}<br />
<br />
<br />
};
nave
|
|
|
|
|
Ahh, that helped a lot.
Now I have to find a way to inherit the = operator.
Thanks a lot
Juergen
|
|
|
|
|
e-DJ wrote: Now I have to find a way to inherit the = operator.
here it is
class XTime : public CTime
{
public:
XTime();
virtual ~XTime();
XTime( time_t t ):CTime(t)
{
}
const XTime& operator=(time_t t)
{
CTime::operator =( t );
return *this;
}
};
nave
|
|
|
|
|
Aargh,
I use CTime in my application all the time with almost all operators and constructors. When I have to reimplement them all, where is the use in object oriented design. Since I don't want to change these. All I wantetd to change was the behavior of the .Format-Class Member.
I canceled this and will redesign my application.
Juergen
|
|
|
|
|
e-DJ wrote: It seems, that the = operator is not working.
operator = is not inherited. You should redefine it in your derived class.
|
|
|
|
|
Since now, I have not been working with operators. So how should my operator= be defined?
Juergen
|
|
|
|
|
e-DJ wrote: I want to create a new class derived from CTime.
Be careful not to get caught in the "is a" vs. "has a" trap.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi all.
I write win service and I have simple code:
<br />
void main(void)<br />
{<br />
SERVICE_TABLE_ENTRY DispatcherTable[] =<br />
{<br />
{<br />
(LPWSTR)MYServiceName,<br />
(LPSERVICE_MAIN_FUNCTION)ServiceMain<br />
},<br />
{<br />
NULL,<br />
NULL<br />
}<br />
};<br />
<br />
printf("Sample of simple service\n(C) D. Bagaturia, 2007, Email: dato_baga@mail.ru\n");<br />
<br />
<br />
if(!StartServiceCtrlDispatcher(DispatcherTable))<br />
{<br />
CloseHandle(hMutex);<br />
return;<br />
}<br />
<br />
}<br />
Problem is that: Wen 'ServiceMain' function ends control go to main() function, and wen main() ends program ends, sow I get thet my service works less than second.
I try to write:
<br />
void main(void)<br />
{<br />
HANDEL hThread;<br />
SERVICE_TABLE_ENTRY DispatcherTable[] =<br />
{<br />
{<br />
(LPWSTR)MYServiceName,<br />
(LPSERVICE_MAIN_FUNCTION)ServiceMain<br />
},<br />
{<br />
NULL,<br />
NULL<br />
}<br />
};<br />
<br />
printf("Sample of simple service\n(C) D. Bagaturia, 2007, Email: dato_baga@mail.ru\n");<br />
<br />
<br />
if(!StartServiceCtrlDispatcher(DispatcherTable))<br />
{<br />
CloseHandle(hMutex);<br />
return;<br />
}<br />
<br />
do{<br />
GetExitCodeThread(hThread,
lpExitCode);<br />
if(*lpExitCode == STILL_ACTIVE)<br />
Sleep(150);<br />
else<br />
break;<br />
<br />
}while(1);<br />
<br />
}<br />
But in this time I get runtime error.
Wen I try to start or stop my service in ServiceManager, I get error message.
I know thet I blocked the service in case two, but I need this service more then 1 second.
Sow I have:
case 1: service runs less 1 second.
case 2: service runs but, it is blocked.
I know that I made som mistake, but whot?
|
|
|
|