|
m_myList.SetItemState (nIndex, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); /ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Thanks but this is only highligting it by graying the background. I want it to be selected as when a mouse is clicked on an item.
|
|
|
|
|
Try this.
Theoretically it is the same as the previous post.
INT index = 0;
LVITEM lvi;
ZeroMemory(&lvi, sizeof(lvi));
lvi.mask = LVIF_STATE;
lvi.iItem = 0;
lvi.iSubItem= 0;
lvi.state = LVIS_SELECTED;
lvi.stateMask=LVIS_SELECTED;
m_myList.SetItemState(index, &lvi);
|
|
|
|
|
Thanks a lot. It works fine now. It was some issue of wrong tab order too.
|
|
|
|
|
a have 3 editbox and 2 radio buttons. When i select a radio button a want an editbox to became disabled. How do i do that?
|
|
|
|
|
GetDlgItem( itemID )->EnableWindow(FALSE);
Or map the Edit in class wizard to a CEdit m_edit
and call m_edit.EnableWindow(FALSE);
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I am sending a string to a List Box control. I want to make the color of the string Red or some other color. I dont know how to change the color. Can someone help me out?
Thanks.
Jerry
|
|
|
|
|
Try using CFont class.
Here you can set size, color, fontstyle ...
(Don't forget to set it back to original.)
good luck.
|
|
|
|
|
The list box control won't, natively, allow you to set the colour of a single row. You'll have to do some owner-drawing.
The List View control (CListCtrl in MFC) doesn't allow it either, but the owner-drawing is simpler. You can handle NMCUSTOMDRAW notifications to customise parts of the drawing process. With the list box (CListBox), it's all or nothing.
You'll find lots of ideas at http://www.codeproject.com/listctrl/[^].
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Being an vc++ windows application programmer is it necessary to have knowledge about DACL.
|
|
|
|
|
Typically, no. The right behaviour is normally to simply pass NULL for an lpSecurityAttributes parameter, in which case Windows will apply a default ACL to the object.
If you do want to know about ACLs and security, I suggest Programming Windows Security by Keith Brown.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Thx for you quick reply.
BTW when will i have to use and learn to use DACL. Any simple situation where i cannot survive with a knowledge of DACL.
|
|
|
|
|
sanomni wrote:
BTW when will i have to use and learn to use DACL. Any simple situation where i cannot survive with a knowledge of DACL.
It depends on what type of software you are developing. I've not needed to know anything about it since NT was introduced. However, if my coding required anything security-related, I would thus know quite a bit about it.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Here is a scenario where you must know DACL, because the NULL will not work.
If you have two processes, one of which is running as a service under the local system account, and you want each one to be able to open a mutex, but you do not want the mutex to have 'wide open' access, then you must apply a DACL. This is all well and good, but suppose the process which is running as a service created the mutex, and the other process is running under the security context of the logged on user. The logged on user process will not be able to open the mutex if it was created under the context of the service (which usually runs as local system) - it will get access denied. So, then you have to apply the correct kinds of DACL to not only secure the object, but to allow it to be opened by the correct types of users.
Typically, the NULL DACL will either assign the object the security context of the process which created it, or give the object access to 'everyone'. In some cases, like the one mentioned here, neither case is a workable solution, so a non-NULL DACL must be applied.
|
|
|
|
|
Hiya I have dropped an IPAddress Control from the toolbox onto my form. But when I use GetAddress() or IsBlank() methods of the IPAddress control, the program crashes with:
Debug Assertion Failed!
Program:
File: f:\vs70builds\3077\vc\MFCATL\ship\atlmfc\include\afxcmn2.inl
Line: 344
Does anyone know how to fix this??
Thanks.
|
|
|
|
|
Seems like your dialog is closed the time u call this method
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Did you try running under the debugger and hitting Retry when prompted? That takes you to the line firing the assertion.
Also, look in the vc7\atlmfc\include directory under Visual Studio .NET's install directory.
The source line reads:
_AFXCMN_INLINE BOOL CIPAddressCtrl::IsBlank() const
{ ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, IPM_ISBLANK, 0, 0L); } This indicates that you tried to call it on an object whose m_hWnd member isn't a valid window handle. Usually this means that either you tried to use an object you haven't initialised (m_hWnd is NULL ), that you stored a pointer returned from GetDlgItem and then later tried to use that pointer in a different message handler, or, more rarely, that some kind of memory corruption has occurred (typically through a buffer overrun). You'll also get problems passing CWnd pointers between threads, particularly if they point to temporary objects.
You must not store pointers to temporary CWnd objects. Any MFC function returning a CWnd* may return a pointer to a temporary object; these temporary objects are cleaned up the next time your program is idle. If you need to reference a window for a period longer than the duration of the current function, create a CWnd -derived object and call Attach .
You can use the DDX_Control function in your DoDataExchange override to automatically hook up a member variable to a control. You can do this through the Visual Studio environment by right-clicking the control in the dialog designer and choosing Add Variable.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hi,
For the moment I'm working on a lockscreen feature. This works fine except for the fact that if dialogs (with choices and options and stuff) are opened, these are not closed. How can I get a handle to these dialogs (so that I can close them)?
(Note: these dialogs can call dialogs themselves).
tnx!
|
|
|
|
|
Read the documentation on the EnumWindows, EnumDesktopWindows, and EnumChildWindows APIs in MSDN. I don't follow exactly what you're trying to do, but these are the APIs you would want to use to get HWND values of existing windows.
Hope this helps you get started.
|
|
|
|
|
tnx for your help. It worked although I had to do some workarounds (but as long as the boss is happy )
What I'm trying to do:
I'm working on a medical dossier for hospitals. => privacy of the patient. So all viewable data should be hidden when a doctor is not working on his computer....
|
|
|
|
|
Why would you want to close an open dialog? That doesn't sound very user friendly!
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I have subclassed an the EDIT control in my active x project.
How can I get at the base class data and methods, from within my super active x class?
its really annoying, it must be so simple!!!;P
|
|
|
|
|
hi,
i am creating a sample for testing interop.
i am having one .net(c#) class. i am going to expose this to Com Client.
i am having one MFC client program.
in that i am referring the .tlb file which is created from .net( with the Register for COM property of project is true).
it is working fine.
my problem is:
if i set that property(register for COM) to false, and i create a dll and thro' regasm/tlbexp i create a tlb.
and finaly i refer it in the MFC client program , then i will get the error "Class not registered".
could u anybody let me know what will the problem be?
|
|
|
|
|
The CLSID for .NET classes, if not explicitly set, is derived from your class's assembly version numbers (among other things). A wizard-generated project has the AssemblyVersion attribute set to 1.0.* , which instructs the compiler to generate new numbers for the last two components of the version number when you compile (the numbers are derived from the compile date and time).
Either set the Guid attribute (see GuidAttribute ), or use a fixed version number.
[EDIT] In case it wasn't clear, the consequence of the first paragraph is that the CLSID changes every time you recompile the component. [/EDIT]
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hi,
For the last few days I've been trying to create a small DLL using the IActiveDesktop interface without avail.
What I want to do is create a dll which contains a method that when passed the location of a file, sets the wallpaper to that file.
I need this to integrate with a Java application I'm writing. Just on that note, I am strictly a Java developer with some C++ experience. However! Until this week I had never opened VS.NET nor tried to perform Windows coding of any kind.
Now, I managed to create a small .exe that does this as per the COM tutorial on this site. I'd like to take this code and compile a DLL.
Alas, I'm having no end of problems. I don't know which template project I'm supposed to be using and I'm generally finding this IDE very difficult to cope with especially the linker errors! argh!
MSDN is proving a poor substitute to my beloved Javadoc and I'm at a point where I'm ready to pull my hair out from frustration.
Could someone *please* write me a small step-by-step guide as to how I should approach this?? What templates do I need to use? I tried the MFC DLL template to no avail. Maybe I'm not configuring it right? I just don't know.
|
|
|
|