|
Can you use the regular MFC command enabling mechanism?
ON_UPDATE_COMMAND_UI(ID_SCHEME_SELMOVE, OnUpdateSchemeSelMove)
...
void CMainFrame::OnUpdateSchemeSelMove(CCmdUI* pCmdUI)
{
pCmdUI->Enable(false);
} Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks a lot, that was helpful.
|
|
|
|
|
Using DirectShow I have made a program that captures a video stream and writes the data to screen and to disk. Rendering to screen is done by using IVMRWindowlessControl.
Problems occur when the desktop is locked, e.g. by the screensaver. After unlocking, the rendering part of my application is gray. Calling IVMRWindowlessControl:: RepaintVideo refreshes this rendering part but resets the framecounter and the video contents.
Any ideas how to solve this problem?
Best regards,
Peter
|
|
|
|
|
can you get a handle to the window and call InvalidateRect
BOOL InvalidateRect(
HWND hWnd, // handle to window
CONST RECT* lpRect, // rectangle coordinates
BOOL bErase // erase state
);
|
|
|
|
|
Hi, I have a small problem with my ListCtrl.
I noticed when writing code for HDN_ITEMCLICK notify message, that this will be affected only if I click on a far left side. When I click on item label I cant get click notification!!!
Why is this?
I'm using one column with no header and only text, I added LVS_EX_TRACKSELECT | LVS_EX_FULLROWSELECT stayls!
Thanks.
|
|
|
|
|
I'm not sure how the header notification HDN_ITEMCLICK applies to LVS_EX_FULLROWSELECT.
Maybe LVN_ITEMACTIVATE is the notification you're looking for?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks for yours answer!
How to implement LVN_ITEMACTIVATE?
This is a notify messeage, I cant find it with "Add Windows Message Handler..."
I use vc++ 6.0!
-- modified at 4:16 Wednesday 12th September, 2007
|
|
|
|
|
Here's one way (I can't remember if it was the same in VC 6)
ON_NOTIFY(LVN_ITEMACTIVATE, ID_MYLISTVIEWCTRL, OnMyLVNItemActivate)
void OnMyLVNItemActivate(NMHDR *pNotifyStruct, LRESULT *result)
{
...
}
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
In my last project I was using a CListCtrl with dinamic number of rows and columns. I managed the selection of a click with...
void CMyTabView::OnClickTab(NMHDR* pNMHDR, LRESULT* pResult)
{ POSITION pos = m_clcTabList.GetFirstSelectedItemPosition();
if (!pos)
{ m_nRowNum = -1;
UpdateData (FALSE);
}
while (pos)
{ int nPos = m_clcTabList.GetNextSelectedItem(pos);
m_nRowNum = nPos;
UpdateData (FALSE);
}
Invalidate (); UpdateWindow ();
*pResult = 0;
return;
}
Hope it helps
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Hi,
I have implemented Client and server applications using Named pipes.
Server is written as a Service. This is working fine in admin user mode, Server (service) and client able to communicate properly.
where as in a guest user mode , Server is able to start( at the startup service starts automatically). But client not able to connect getting access denied error.
Not sure any privilizes have to provide while creating a pipe or creating a file from client.
Can any one help me out in this.
Nagadravid
|
|
|
|
|
I think your OS is Vista! It is so sure, that you cant do think the easy way.
You got to create accessable objects in your service. This is a sample from the great Micheal Dunn, which should help you: http://www.codeproject.com/vista-security/PMSurvivalGuide.asp
Greetings from Germany
|
|
|
|
|
Thanks Karstenk.
My OS is XP. One thing m not able to understand is if I run server as a normal console application (rather than as a service), even in guest usermode it is working fine. but in case of service it is failing.
|
|
|
|
|
What account is your service running in the context of?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Service is running in Local system account (admin mode). Below are the service creation properties.
CreateService(
shSCManager, // SCM database
m_pServiceName, // name of service
m_pServiceName, // service name to display
SERVICE_ALL_ACCESS, // desired access
SERVICE_WIN32_OWN_PROCESS |SERVICE_INTERACTIVE_PROCESS, // service type
SERVICE_AUTO_START, // start type
SERVICE_ERROR_CRITICAL, // error control type
szServicePath, // path to service's binary
NULL, // no load ordering group
NULL, // no tag identifier
NULL, // no dependencies
NULL, // LocalSystem account
NULL);
There is no dependencies on the service.
|
|
|
|
|
Hey weird just solved this problem ! with the help of the really cool tool Process Explorer
Mine was to do with passing events but the same problems occur. It is todo with Security descriptors.
My guess is that you are using CreateNamedPipe
HANDLE WINAPI CreateNamedPipe(
LPCTSTR lpName,
DWORD dwOpenMode,
DWORD dwPipeMode,
DWORD nMaxInstances,
DWORD nOutBufferSize,
DWORD nInBufferSize,
DWORD nDefaultTimeOut,
LPSECURITY_ATTRIBUTES lpSecurityAttributes
);
Now my other guess is that your are passing NULL as lpSecurityAttributes. Refering to MSDN
"If lpSecurityAttributes is NULL, the pipe gets a default security descriptor"
You will not that is doesn't say THE default security descriptor. This is because it creates the pipe with the security descriptor for the user that creates it.
This explains your "It works in user mode command-line" but not as a service because the service will be running as SYSTEM.
FIRST SOLUTION
Pass an empty (DACL) security descriptor which has the behaviour of allowing any user/system process to access your pipe.
SECURITY_ATTRIBUTES sa;
SECURITY_DESCRIPTOR* psd=(SECURITY_DESCRIPTOR*)new unsigned char[SECURITY_DESCRIPTOR_MIN_LENGTH];
InitializeSecurityDescriptor(psd,SECURITY_DESCRIPTOR_REVISION);
SetSecurityDescriptorDacl(psd, TRUE,(PACL)NULL,FALSE);
sa.nLength = 0;
sa.bInheritHandle = TRUE;
sa.lpSecurityDescriptor = psd;
Now use "sa" in the call to CreateNamedPipe
SECOND MORE SECURE SOLUTION
pass a fully filled out security descriptor, have a look at MSDN for an example.
|
|
|
|
|
Thanks Carrivick. I hope it will resolve my problem.
Naag
|
|
|
|
|
Were you passing NULL in the Secutity Attributes ?
|
|
|
|
|
As Mark pointed to, it is important to run the service in a spezific account, so an outside program has access rights. Or as in M.Dunn project the objects becomes lower rights so it can accessed.
This is all about accounts and access rights, really boring and bad documented stuff.
Greetings from Germany
|
|
|
|
|
I have a Form where i need to set a string value (NA) and double value.
In DDX_TEXT i use a double variable.
When i set the string value, and updatedata(TRUE), it says "Please enter a number". How to avoid this error message?
Thanks
Thanks
Raji
|
|
|
|
|
if you want to enter a string on the editbox(I think you used of editbox) you can use of SetWindowText .
|
|
|
|
|
Thanks. It works. But since it is a string, while modifying some other edit filed (number) and updatedata(TRUE), the error message "Please enter a number" is displayed. Please let me know a way to avaoid this error / catch this error message.
Thanks
Thanks
Raji
|
|
|
|
|
RajiRaghu wrote: string value (NA) and double value.
I think you need to use SetWindowText and GetWindowText, instead of using control variable as double. Or simply how can string value like "NA" be stored in double?
- NS -
|
|
|
|
|
ya. But there are lots of calculations involved.
Thanks
Raji
|
|
|
|
|
AfxTextFloatFormat is called by DDX_Text where this message is generated.
I can say another option. Add a member function same as UpdateData(BOOL bSaveAndValidate = TRUE). Remove DDX_Text entry in the DoDataExchange. Convert the window text to double in the new UpdateData if the BOOL bSaveAndValidate is TRUE (if it is NA you can check it also) and do vice versa if FALSE. Also call the CDialog::UpdateData(bSaveAndValidate) so that other control variables will not be affected.
Hope it is OK.
- NS -
|
|
|
|
|
RajiRaghu wrote: When i set the string value, and updatedata(TRUE)...
That could be a source of your problem. Use SetWindowText() instead of UpdateData() .
"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
|
|
|
|