|
Finally figured it how it has to be done :
Posting my anwer here :
#include <windows.h>
#include <stdio.h>
// The following constant may be defined by including NtStatus.h.
#define STATUS_SUCCESS ((NTSTATUS)0x00000000L)
// The LSA authentication functions are available in Unicode only.
#define UNICODE
int _cdecl main()
{
PLUID sessions;
ULONG count;
NTSTATUS retval;
int i;
retval = LsaEnumerateLogonSessions(&count, &sessions);
if (retval != STATUS_SUCCESS) {
wprintf (L"LsaEnumerate failed %lu\n",
LsaNtStatusToWinError(retval));
return 1;
}
wprintf (L"Enumerate sessions received %lu sessions.\n", count);
// Process the array of session LUIDs...
for (i =0;i < (int) count; i++) {
GetSessionData (&sessions[i]);
}
// Free the array of session LUIDs allocated by the LSA.
LsaFreeReturnBuffer(sessions);
return 0;
}
it works ffine...SOme body please mark this answer and close the threda as I cant
Kushagra
|
|
|
|
|
Hi Experts,
Is there any windows C++ functions which can be used to get the
folder or file name that is selected either by right or left
click.
Got some hints in the forum but that only prints the type of mouse
event like eg Left click or right click. It uses "UserActivityHook"
to know the typeof event. What I would like to know is the file or
folder name on which the mouse is clicked.
Thanks.
|
|
|
|
|
Member 2114852 wrote: What I would like to know is the file or
folder name on which the mouse is clicked.
You may have to work this out for yourself. When the mouse event fires the screen position of the mouse is captured. You then take that position (x, y), convert it if necessary to be relative to your own window, and figure out which item it is pointing to. If you are using ListView, TreeView etc then there are other events where this conversion is done for you and the actual subitem reference is returned.
|
|
|
|
|
Just refer the Shell APIs for those notification refer ChangeNotifiyWatcher.zip in the below link. [^]
Величие не Бога может быть недооценена.
|
|
|
|
|
Are you referring to a folder selected in Windows Explorer?
|
|
|
|
|
Yeah.. I am referring to a folder selected in windows explorer.
|
|
|
|
|
|
You know that helper macro in MFC (pardon my ignorance but I haven't used MFC in probalby 6-7 years) that is used for creating object at runtime, used in Views, I think it's RUNTIME_CLASS or something???
What is the name of the closest pattern for that implementation, obviously it's not a singleton and it's not quite a factory either, or is it?
I am implementing (in another language) a object which does:
1. Prevents direct instantiation by virtue of a private constructor
2. The second object which is used to create the said oibject manages the instances to limit only one per class
So I get the benefits of a singleton while still honoring inversion of control or DIP. Without the global introduced using a singleton.
Cheers,
Alex
|
|
|
|
|
XanderXP wrote: What is the name of the closest pattern for that implementation, obviously it's not a singleton and it's not quite a factory either, or is it?
I guess that it could be said that the MFC Doc/View architecture closely resembles the Model-View-Controller pattern[^].
XanderXP wrote: I am implementing (in another language)
Sounds interesting. What language are you working with?
Best Wishes,
-David Delaune
|
|
|
|
|
Randor wrote: guess that it could be said that the MFC Doc/View architecture closely resembles the Model-View-Controller pattern
It could be, but more formally I believe MFC and Doc/View are refered to as MVP, unfortunately neither pattern are what I am looking for. I think I may have to discover my own name as it's one part service locator and one part singleton but removed of functionality in both to meet very specific requirements.
Randor wrote: Sounds interesting. What language are you working with?
Only the best, most flexible language in the world. :P
*cough* PHP *cough*
Seriously though, while the language is responsible for some of the most naieve developers and most hackish projects, known to man, like any language if you follow best practices, patterns, etc. It's a real treat to work with.
Cheers,
Alex
|
|
|
|
|
XanderXP wrote: *cough* PHP *cough*
Heh, I remember the birth of PHP. I was not doing any Windows development in the mid 90's and was a Unix developer/sys admin. I haven't done any PHP development in over 10 years I would probably be lost in PHP5. The PHP language itself has come a long way.
Good luck with your PHP project.
Best Wishes,
-David Delaune
|
|
|
|
|
Randor wrote: Heh, I remember the birth of PHP. I was not doing any Windows development in the mid 90's and was a Unix developer/sys admin. I haven't done any PHP development in over 10 years I would probably be lost in PHP5. The PHP language itself has come a long way.
So you remember it's birth as a series of Perl scripts and being called "Personal Homepage"? :P I started at the time PHP 3 was released...
Back then I was learning/tinkering in C and C++ in the 1990's, it was only when I started thinking I'd like to make a career out of software development that I looked for an easy enterance. Web site projects were plenty and didn't require a BSc. so I started learning JS, HTML and ASP. I hated ASP, looked for an open source solution and started with Perl which led me to PHP (thank god).
It's annoying to develop in, because of the lack of any standard framework (at least a few hundred available -- with new ones popping up each week) unlike MFC, to provide your application with some structure. When fixing or working on existing applications, it can be like finding a needle in a haystack.
One guys interpretaion of MVC and a front controller, actually turns out to be a extremely tightly coupled application bootstrap, front controller, routing, dispatching and more, in one monolithic class over 1000 lines.
Lots of bad practice in PHP but there is a small community dedicated developers trying to change that by introducing patterns, OO best practices, architecture and more.
Zend framework is a good start, with it's design issues and all.
Cheers,
Alex
|
|
|
|
|
Hi
I am dyanamically creating a class inherited from CScrollView.
The restore button of this view should be disabled so that the user may not be able to click on it.
Please help me.
Thanks and regards
Deepu.
|
|
|
|
|
|
I have dynamically created the window.Now I want to disable/remove the Restore button ie (Minimize,Maximize ,Close) of the window title bar.
I wish to disable/remove the restore button so that the user cannot resize the window.
The window should be in maximized state intially and
if user want,he can minimize it ,but window should not be resized.
please help me
|
|
|
|
|
Hi,
Deepu Antony wrote: I have dynamically created the window.Now I want to disable/remove the Restore button
For making non-sizable MDI window and removing maximize button:
CWnd *pParent = GetParent();
CMenu* pMenu = pParent->GetSystemMenu(FALSE);
if (NULL != pMenu)
{
pParent->ModifyStyle(WS_CAPTION|WS_MAXIMIZEBOX ,0,0);
pParent->ModifyStyle(WS_THICKFRAME, 0, 0);
pParent->ModifyStyle(0,WS_CAPTION,SWP_FRAMECHANGED);
}
Best Wishes,
-David Delaune
|
|
|
|
|
Thanks for the reply.
I have tried it.And aslo i have tried in childframe precreate function in CREATRSTRUCT structure .
CREATRSTRUCT cs;
cs ~=WS_MAXIMIZEBOX
which disables the maximize box.
But both the ways gives me the same result.That intially window is maximised and the user can press the restore button.
Once the restore button is pressed, the maximize button is disabled.But this is not the actual requirment that the user should not be able to pres the restore button in initial case also.
Is there is any method so that initially also restore button should be disabled
|
|
|
|
|
Hi,
Sorry for the late reply. The code that I showed you is working for me in VS2008 on MDI child windows. If you show me how and where you are attempting to remove the buttons I may be able to help.
Best Wishes,
-David Delaune
|
|
|
|
|
Thank you very much David for showing intrest.
I tried to do it in MDI child frame window PreCreateWindow by modifying the CREATESTRUCT
it was not working.
Also i pasted the code which you have posted in View class OnCreate function .
both was showing the same result.
Initailly the window will be displayed as maximized and restore dowm button will be enabled.
But once the user press the restore down button, the window will be resized and then the
Maximize button will be disabled. After that the user cannot click on the maximize button.
But what i want to do it is to disable\remove the restore down button in the begining itself so that the user may not be able to resize the window.
The reason is that i am displaying a graph which should be always displayed in a full window.
Is there any solution.
|
|
|
|
|
Deepu Antony wrote: Is there any solution.
First lets try to get into the same code. If you have Visual Studio 2008 and have installed the samples navigate to the following folder:
Microsoft Visual Studio 9.0\Samples\1033\AllVCLanguageSamples\C++\MFC\advanced\mtmdi
Open this project and find the Bounce.cpp file. In the OnCreate function add:
CWnd *pParent = GetParent();
CMenu* pMenu = pParent->GetSystemMenu(FALSE);
if (NULL != pMenu)
{
pParent->ModifyStyle(WS_CAPTION|WS_MAXIMIZEBOX ,0,0);
pParent->ModifyStyle(WS_THICKFRAME, 0, 0);
pParent->ModifyStyle(0,WS_CAPTION,SWP_FRAMECHANGED);
}
And in the PreCreateWindow function add:
cs.style &= ~WS_THICKFRAME;
This should cause the MDI window to be non-resizable and the Maximize/Restore grayed out. If you have another version of Visual Studio let me know and we can change samples.
Best Wishes,
-David Delaune
|
|
|
|
|
I want to create a separate class for drawing that have its own dc(device context), may be initialized from a given dc. do all drawing stuff within its dc and copy the contents on to target dc when requested.
Please guide me how to do this.
|
|
|
|
|
|
Hi all,
i want to split any file
please tell me how can i find out the maximum number in which i can split the selected file.
please help me for this.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Hi,
I do not understand the question. There is nothing stopping you from splitting a 100 Megabyte file into 104857600 files containing 1 BYTE each. You can keep doing this forever until you run out of drive space.
Can you clarify your question? What are you trying to achieve?
Best Wishes,
-David Delaune
|
|
|
|
|
I mean if there is a 100 mb file,so what are the maximum number in which i can split this file.
so tell me this in general case for any file.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|