|
codedgn wrote: The purpose why people post questions here is to seek solution not advice.
You must either be particularly dense, or you know absolutely nothing about computing! As I stated before there is no solution to this problem, as is the case with many of the questions here. All we can do is advise the OP of that fact and make suggestions as to what other course of action they may take. The fact that the questioner does not like the answer makes no difference to the outcome.
|
|
|
|
|
RedSonja wrote: I think your determination to be amusing at my expense just exceeded my determination to find help here.
My question, actually, was serious: how could you expect a compiler will handle it? Compilers simply cannot.
RedSonja wrote: Perhaps among the other readers there are some who understand what my problem is and have dealt with it themselves in the recent past.
Again, my suggestion was serious: unsigned char is actually one of the most portable data type.
RedSonja wrote: The problem is not the code, or the size of integers. The problem is handling the code auditors.
If there aren't problems with the size of the integers, then shouldn't be problems with the auditors. Well, actually here I can understand your point, anyway is portability really a concern, there? If it is then I suppose you've already solved the problem and can boldly argue with the auditors. On the other hand, if portability isn't really a concern, why ('the fresh hell' again) should auditors worry about (holding this point is more troublesome).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
The compilers will handle whatever, based on the build. One build won't fit all, like you would already know. I don't think that using an integer is such a sin. Yes, the size is dependent on the architecture, but you can always make multiple builds (unless of course your code runs on a really large number of different architectures, and you don't want to maintain a build for every such architecture).
I see no reason to carry those old beliefs today. It doesn't do any harm to use that "standard header" and the datatypes present in it, but it doesn't make any sense either any longer.
Just my 2c.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Actually integer is machine dependent, say for Turbo C it is 16 bit. For Visual C it is 32 bit. So you cannot write a portable with int since it changes its behavior with the machine.
Please refer this article to get more info [^]
Величие не Бога может быть недооценена.
modified on Wednesday, October 28, 2009 6:38 AM
|
|
|
|
|
Hi,
I am creating a COM object in VC++ to take the snapshot of the screen (PrintScreen key functionality) and to send it to the default printer. I could get the screen shot by using the keybd_event() in to the clipboard but I could not find a proper way to print the screen to the default printer.
Can anybody help me in resolving this. Could any one send me the code snippet to do this in ATL COM application?
With Regards,
Abraham Chethuvelil
|
|
|
|
|
|
Thanks David,
Let me ask you one doubt from your code.
You have taken the default printer to the Handle and in the calling area, you have used it with GetPrinter(). I require the function which will work same as the code snippet in VB.
Dim PauseTime, Start
Clipboard.Clear
Call PrintScreenApp
Dim dataPic As Picture
PauseTime = 20 ' Set duration.
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
Set dataPic = Clipboard.GetData()
DoEvents ' Yield to other processes.
If dataPic <> 0 Then
Printer.PaintPicture dataPic, 0, 0, (Printer.Width - 400)
Printer.EndDoc
Clipboard.Clear
Exit Do
End If
Loop
Set dataPic = Nothing
Can you please help me?
With Regards,
Abraham Jose
|
|
|
|
|
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?
|
|
|
|