|
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
|
|
|
|
|
|
Hi all. I´m trying to use the API method SetWindowTheme() to completly ride my application from XP theme. My application has custom caption bar and border, and it looks strange when the XP theme is set. But nothing happens when I call this method.
My code:
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
...
SetWindowTheme(this->m_hWnd, NULL, NULL );
return 0;
}
This should work? Please, anyone can help me?
|
|
|
|
|
From the docs:When pszSubAppName and pszSubIdList are NULL, the theme manager removes the previously applied associations. To prevent visual styles from being applied to a specified window, pass an empty string, (L""), which will not match any section entries.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Thanks very much.
|
|
|
|
|
I have class A:CWinApp then call many dialog.Domodal() without main windows.Because we not assign value for m_pMainWnd so that dialog is no longer modal dialog.
|
|
|
|
|
You can't have more than one modal dialog at a time; that's what it means for a dialog to be modal. It takes over the message loop for the application while it is displayed, and control doesn't return to the primary window until the modal dialog closes.
If you want to have multiple dialogs opened simultaneously by an application, you will need to make them modeless. Instead of calling DoModal() , call Create() and ShowWindow() .
Software Zen: delete this;
|
|
|
|
|
hi,
I have ,say N=4 and r=3, i want to display all combinations of Ncr.....
i.e
123
234
341
421...etc
There should not any repition like 123..321..231..etc..it should display only one .......
thanks before..
James
-- modified at 13:48 Saturday 18th February, 2006
|
|
|
|
|
|
To print All the combinations of N elements with r combinations.......
-- modified at 14:24 Saturday 18th February, 2006
|
|
|
|