|
Hello OnTilt
I specify one of the way but i am not sure that this is a proper or not.
First make on dailog form which has two property you have o set.
1) Full screen mode
2) Transperent display mode
Now by calling any function which can return pixel value of form will return pixel value of screen. And one more thing this dailog form will not affect operation of any other application.
If this is not usefull to then i am sorry.
Regards,
Divyang Mithaiwala
|
|
|
|
|
Take a look at the GetWindowDC[^] API, if you pass NULL as it's window handle it will return a device context back for the current desktop. After that you can use GetPixel[^] to retrieve the color for any pixel. You'll need something like:
COLORREF GetDesktopPixel( int x, int y )
{
COLORREF cl = 0;
HDC hDC = NULL;
hDC = GetWindowDC( NULL );
cl = GetPixel( hDC, x, y );
DeleteDC( hDC );
return cl;
}
Gavin Taylor
w: http://www.gavspace.com
|
|
|
|
|
Hey thanx Gavin.
It's realy nice. I don't know about this. Thanx again.
Reagards,
Divyang Mithaiwala
|
|
|
|
|
Take a look at the GetWindowDC[^] API, if you pass NULL as it's window handle it will return a device context back for the current desktop. After that you can use GetPixel[^] to retrieve the color for any pixel. You'll need something like:
COLORREF GetDesktopPixel( int x, int y )
{
COLORREF cl = 0;
HDC hDC = NULL;
hDC = GetWindowDC( NULL );
cl = GetPixel( hDC, x, y );
DeleteDC( hDC );
return cl;
}
Gavin Taylor
w: http://www.gavspace.com
|
|
|
|
|
Exactly what I was looking for Gavin. Thanks guys.
|
|
|
|
|
|
How to trap the interrupts produced in Windows Environment,by establishing a system wide monitor/hook.
What is the core API to be used?
(_dos_getvect & _dos_setvect cannot be used in MS VC++ programs)
Any one having any intresting Idea??
-Rane
Rane
|
|
|
|
|
Under Windows NT, 2000, XP, and Server 2003, applications can not handle interrupts. Interrupt handling is reserved for device drivers. Typically, a device driver will handle an interrupt and then signal an event. An application will have a worker thread waiting on that event. It isn't real-time, but it is safer than allowing applications direct access to hardware.
Software Zen: delete this;
|
|
|
|
|
Is it possible to write a universal driver to trap the software interrupts alone.
(Any class/API supporting it?)
Rane
|
|
|
|
|
Hey Guys ..
I'm running a Win32 Console UDP Server/Client application. I want to run my server update function inside my main loop while also checking for key input. All I need to check for is if a single key has been pressed.
The kicker is I need a way to continue on with the update without pausing for user input. When the user hits 't' for toggle it calls a function that closes the socket and reopens it as a server or client.
Here's what I have now, but as I said I need something that doesn't wait for user input.
Update()
{
char toggle;
toggle = cin.get()
if(toggle == 't')
{
ToggleMode();
}
// get all the packets we can
while(ReceiveData());
// Send all the data to the clients
SendData();
return true;
}
Thanks in advance!
|
|
|
|
|
Have a look at _kbhit()
You may be right
I may be crazy
But it just may be a lunatic you’re looking for
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Do I have to be using the CRT libraries for this?
I tried including <conio.h> but when I do:
if(_kbhit())
{ToggleMode()}
It never gets into the true condition hen I press any key on the key board.
Any help?
|
|
|
|
|
jc0dex wrote: Do I have to be using the CRT libraries for this?
Yes. _kbhit is a C run-time function. Look it up in MSDN for some sample code.
You may be right
I may be crazy
But it just may be a lunatic you’re looking for
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
I found that GetAsyncKeyState does exactly what I was needing.
Thanks guys!
|
|
|
|
|
Hi!
I've had some trouble with the CreateProcessAsUser function. I want to start a process with Admin privileges - respectevily which requires Admin privileges - within an application lunched by an account without having any rights.
So far so good. In using the LogonUser function I was able to get a hadle to the previously specified user which could be used for the CreateProcessAsUser function. But it won't work!!! Everytime I try to start a process I get the same error (1314). I've set out to do a search in the www and it seems there are a lot more people having the same problem. As I understand it the user account creating the new process must have a set of special privileges enabled. But how to assign those, since I still haven't any rights for it. I just want to implement a kind of the "RunAs" offered by Windows.
Is there a simple way of doing such a thing?
Thanks in advance
PIT
|
|
|
|
|
To enable a privilege, you can use code from this SDK article[^].
However, I think your trouble is that you need privileges that even an administrator does not have. The closest account that does have the privilege you're going to get is the service account. If you can create a service, use that.
That said, you should strongly consider using CreateProcessWithLogonW instead. It was specifically created to overcome the troubles with CreateProcessAsUser . It works by delegating to the "Secondary Logon" service.
What operating system are you using? CreateProcessAsUser was changed in WinXP so that SeTcbPrivilege is no longer required.
|
|
|
|
|
hi,
i'm trying to teach myself c++ (using mfc), i've just got a quick question. i'm not new to the vs enviorment, i've used it for c# programs.
i am running windows xp sp2 (home edition) with the newest version of the .net framework. i am using visual studio 2002.
when i place a 'rich edit 2.0 control' onto my form, the program won't run. when i remove the control, it runs.
when i run the program with a rich edit box, it looks like everything ran fine and i closed it, however i never even see the program's dialog. does anyone have suggestions to get this thing running?
this is what is in the output window:
'SomeProgram.exe': Loaded 'F:\Programming\SomeProgram\Release\SomeProgram.exe', Symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\user32.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\comdlg32.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\shlwapi.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\shell32.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\winspool.drv', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\ole32.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\oleaut32.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\oleacc.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\msvcp60.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\Program Files\Google\Google Desktop Search\GoogleDesktopNetwork3.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\ws2_32.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\ws2help.dll', No symbols loaded.
'SomeProgram.exe': Unloaded 'C:\Program Files\Google\Google Desktop Search\GoogleDesktopNetwork3.dll'
'SomeProgram.exe': Unloaded 'C:\WINDOWS\system32\ws2_32.dll'
'SomeProgram.exe': Unloaded 'C:\WINDOWS\system32\ws2help.dll'
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\MsgPlusLoader.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\uxtheme.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\PGPhk.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\Program Files\Xfire\xfire_toucan_17902.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\wsock32.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\ws2_32.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\ws2help.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\msvcr71.dll', No symbols loaded.
The thread 'Win32 Thread' (0xb74) has exited with code 0 (0x0).
The program '[2808] SomeProgram.exe: Native' has exited with code 0 (0x0).
thanks in advance,
sam kline
-- modified at 19:13 Saturday 18th February, 2006
|
|
|
|
|
As with all common controls, you have to call the right init function to get them loaded and their window classes registered.
MFC has AfxInitRichEdit() which is the function to call in your situation.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
ok, but where do i put that?
thanks, sam kline
|
|
|
|
|
oh, found it.
AfxInitRichEdit2();
thanks!
|
|
|
|
|
Hi,
Let me explain using a very simple example: finding all combinations of 2
from a set of 6 letters {A, B, C, D, E, F}. The first combination is AB and the
last is EF
The total number of possible combinations is: n!/(r!(n-r)!)=6!/(2!(6-2)!)=15
combinations
Let me show you all the combinations first:
AB
AC
AD
AE
AF
BC
BD
BE
BF
CD
CE
CF
DE
DF
EF
I want to print all the comibinations..........
Regards
James
|
|
|
|
|
You know the algorithm because you just did it manually. Two nested loops, one going from A to E, the other going from one letter after the first loop's letter to F. In each iteration of the inner loop, print out the current letters for both loops.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
void PrintCombinations(char set[],int set_size)
{
for (int i = 0; i < (set_size - 1); i++) {
for (int j = (i + 1); j < set_size; j++) {
printf("%c%c\n",set[i],set[j]);
}
}
} Please note that I haven't actually tried this; I just coded it off the top of my head.
Software Zen: delete this;
|
|
|
|
|
Does anybody know how to copy files or create directory for a windows environment.
I only know how to use the create and copy methods in a .net framework.
Thanks
Kelvin Chikomo
|
|
|
|
|