|
Arun Abraham Jose wrote: Dim PauseTime, Start
Hi Abraham,
Unfortunately VB6 code looks like egyptian hieroglyphics to me. I have always wondered what a Dim is. I searched codeproject and found some C++ code you could copy and paste.
Easy to use class for ScreenCapture to printer[^]
Best Wishes,
-David Delaune
|
|
|
|
|
Hi,
Exactly there lies the problem, some of the functions we found in these samples will not work in ATL application, if I say for example, 'CBitMap' used in the last link you provided is giving error when I use it in my application, but when I try to include afxwin.h, it gives a fatal error saying Windows.h already exists.
When I search through sites, all of them are either used in normal Single Document or Dialog based applications or coded to help in UI based applications. When I use these code snippets in my application it will either throw exceptions or will show syntax errors
Please provide me a solution to this.
With Regards,
Abraham Jose
|
|
|
|
|
Arun Abraham Jose wrote: Please provide me a solution to this.
The MFC framework is nothing more than a thin wrapper around the Win32 equivalents. The CBitmap Class [^] is nothing more than a wrapper around the BITMAP Structure[^].
Anyway have a look at the Capturing an Image[^] sample provided by Microsoft. The CaptureAnImage function in that example is not using any MFC. I'm sure with all the code you are being provided that you can get something working.
Best Wishes,
-David Delaune
|
|
|
|
|
Hello All,
I have a service and I want to spawn a process through it but only at the time when I found no user logged on to the machine. i.e I have a function which is executed on a timely basis and it should check the number of active user sessions on that machine and if the count comes to be zero it should spawn the process in system account .
Regards,
Kushagra
|
|
|
|
|
|
Thanks man ,
That is waht I was looking for
Kushagra
|
|
|
|
|
Beside the solution provided by the poster before, here is an alternative idea.
Catch the SERVICE_CONTROL_SESSIONCHANGE event in your service (only with HandlerEx possible).
This event is triggered every time a user logs on / logs off / remote log on / remote log off etc.
Combined with the solution before you will be able to start your app at the log off of the last user and
stops or pauses if an user logs in.
Greetings
Covean
|
|
|
|
|
NetWkstaUserEnum
The NetWkstaUserEnum function lists information about all users currently logged on to the workstation. This list includes interactive, service and batch logons.
I want only the list of interactive users and not service and batch logons , can you please let me know the way to do it ???
|
|
|
|
|
Maybe try for every logged-in-user you enumurate NetUserGetInfo with level 23 where flag is UF_NORMAL_ACCOUNT.
|
|
|
|
|
How is that suppose to work? Nearly all user accounts are UF_NORMAL_ACCOUNT regardless of session ID.
Best Wishes,
-David Delaune
|
|
|
|
|
Sorry but I just hoped that this will work. I hadn't the time to test.
But as I saw you had an better idea I hope that works.
Regardless of this, I also would think about the idea I posted at first.
Greetings
Covean
|
|
|
|
|
Can you explain this with an example ? My goal is simple I want to count the number of active sessions on a server or machine which will be my own base machine , if count comes 0 I will execute my script else I wont.
Kushagra
|
|
|
|
|
|
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
|
|
|
|