|
I have an application that is loaded at startup. I don't want it to do certain things if nobody logs in, or if somebody logs in using Remote Desktop. Is there an API to check if the computer is locked? I know about ISensLogon::DisplayLock, but that seems to be event based. I don't need event notification though. I just need something simple like this
if (! IsComputerLocked() )
{
// do something
}
|
|
|
|
|
I Suppose that you could start searching for the GINA.DLL.
This dll controls all the log in process.
Hope this helps.
|
|
|
|
|
|
I have a friend of mine which has written a fullscreen app which act as a menu for its kids.
Now he would like to be able to run it fullscreen and take over the WINDOWS, WINDOWS+E, WINDOWS+M, ALT-TAB keys when the session start. Or something like that.
What would be the best way to achieve that?
|
|
|
|
|
The easiest part is the full screen: you could use this line in the last line of the OnInitDialog handler:
this->ShowWindow(SW_SHOWMAXIMIZED);
The other part is a little bit harder, you should create a "system wide hook" (there are good articles here in the codeproject about that). In order to do that you'll need to create a DLL with the hook.
With that hook you'll be able to control all the keystrokes except CTRL+ALT+DELETE that is controlled in a different process. If you want to control that you should create a GINA.DLL or download one that would allow this to you.
Hope this helps.
|
|
|
|
|
Thanks!
I was also wondering if there was a more generic way.
Instead of me catching a given list of arbitrary key combination, perhaps there is a way to simply disable all of these?
or at least somewhere in the registry where to find these shortcut?
|
|
|
|
|
I've googled for it and it seems that in Delphi you could do it using SystemParametersInfo
procedure TForm1.Button1Click(Sender: TObject);
var
Nada : integer;
begin
Nada:=0;
{DesHabilitar ALT-TAB}
{Disable ALT-TAB}
SystemParametersInfo( SPI_SETFASTTASKSWITCH, 1, @Nada, 0);
end;
Hope this helps...
I would go for the service with the low level keyboard hook, it works for sure...
|
|
|
|
|
Nice! Thanks!
|
|
|
|
|
Hi All,
How can I subclass the Tooltip control in a list ctrol?
I've read the article on per subitem tooptips.
I just can't seem to figure how to get a handle to the actual tooltip to enable it to show balloons.
Any comment or a link would be welcome.
Thanks
P1p3r
|
|
|
|
|
Send the list a LVM_GETTOOLTIPS message to get the HWND of the tooltip control. Once you have that, you can subclass it like any other window.
|
|
|
|
|
Hi Mike,
Thanks for the reply.
The problem is, When I use that method
I'm only getting the item number in the LVN_GETINFOTIP message handler.
I'd like to get all the subitems, and MSDN only says you must use LVS_EXFULLROWSELLECT.
I'm using comctl32.dll v6 in my manifest
any ideas or articles?
Again, Thanks for the help.
P1p3r
|
|
|
|
|
Not sure if you mean the subclassing that I thought you meant, but you can read about SetWindowsHookEx and SetWindowLong API, or search for the article here in codeproject. There is one article about changing the control/dialog to show additional item, similar to what you want to do.
|
|
|
|
|
Hello gurus,
I have a quad-core machine and I'd like to know how to programmatically launch threads simultaneously (start together) on the different cores?
The program should run like this:
Core 1 -> main process creates n threads depending on the number of cores available
Core 2 -> thread1
Core 3 -> thread2
Core 4 -> thread3
...
Core n -> threadn
'->' means 'runs'
See what I mean???
How can I build such a routine? Any idea?
Thanks in advance for the help.
Best regards.
Fred.
There is no spoon.
|
|
|
|
|
Check out SetThreadAffinityMask()
|
|
|
|
|
I know this function already, but the problem is to launch the threads simultaneously, as the post suggests.
Best regards.
Fred.
There is no spoon.
|
|
|
|
|
If you've used SetThreadAffinityMask() correctly can't you wait on an event object in all the threads? Signal (set) the event to fire them off?
Mark
|
|
|
|
|
Hi guys.
I need to run some IE instance...
I used CoCreateInstance() ... it worked good but I noticed that it uses always the same exe, so in my multithreaded application it uses always the same running instance, i see in my taskmanager always the same iexplorer.exe even if i run more than one browser. Instead i need to run multiple exe, one exe for every thread. As I read on msdn CoCreateinstance uses the same instance.
So how to run a new exe when i create a new instance???
IClassFactory* oby;<br />
CoGetClassObject(CLSID_InternetExplorer,CLSCTX_ALL, NULL, IID_IClassFactory, (void**)&oby);<br />
hr = oby->CreateInstance(NULL,IID_IWebBrowser2, (LPVOID*)&WebBrowser);
I tried this code...but it doesn't work, it uses always the same exe without running a new one.
Thanx!
|
|
|
|
|
Why are after running a new exe.
I will not happen, because windows always share resources.
Creating a new instance means that you are instanciating a new object.
If just want to run two copies of the same exe why not use ShellExecute function. I think this will help.
|
|
|
|
|
thanx for you answer...
i need to run multiple instances, evenif using the com object was surely lighter on system resource...so i used shellexecute and then link to the browser...
now it's ok!
|
|
|
|
|
I have a base class from which I derive several classes. Since I pass these derived classes to many functions, I decided the best approach is to specify the base class type in the function header. Is there any way to determine the derived class from a base class pointer?
class Base
{
};
class derA : public Base
{
};
class derB : public Base
{
};
void SomeFunction( Base* base )
{
}
|
|
|
|
|
As a rule, the code in SomeFunction shouldn't care what type of derived class is passed to it. If you need specialized behavior in SomeFunction , add a virtual function to the Base class that can be overridden in the derived classes:
class Base
{
public:
virtual void Behavior();
};
class derA : public Base
{
public:
virtual void Behavior();
};
class derB : public Base
{
};
void SomeFunction( Base* base ){
base->Behavior();
}
derA A;
derB B;
SomeFunction(&A);
SomeFunction(&B);
Software Zen: delete this;
|
|
|
|
|
That's basically what I implemented, but I was just wondering if here was an easier way to do it. Thanks anyway.
|
|
|
|
|
derA* einA = dynamic_cast<derA>(base);
derB* einB = dynamic_cast<derB>(base);
if(einA) {
} else if(einB) {
} else {
}
--
Verletzen zerfetzen zersetzen zerstören
Doch es darf nicht mir gehören
Ich muss zerstören
|
|
|
|
|
Hello.
We need to use UserControl components written in C# in our existing MFC application. The components need to be inserted into existing ActiveX controls (written using MFC and ATL as separate OCX files). The recommended way is to turn on the /CLR switch and use CWinFormsControl class. Using this approach I was able to insert a simple test component into one of our ActiveX controls and successfully build the OCX in Debug mode, however when running the application I noticed that when the app tries to create an instance of the modified ActiveX control it fails with the following error: ClassFactory cannot supply requested class. The same load failure occurs even when I completely removed the test component from the ActiveX control so it seems that the failure is caused by building with the /CLR switch. I also tried to build the ActiveX's StdAfx.cpp and the cpp file containing code for the ActiveX DLL (such as InitInstance and DLLRegisterServer) without the /CLR switch but it didn't help. The control is registered properly and w/o errors (at least that's what regsvr32 shows).
We use Visual Studio 2005, any help will be greatly appreciated. Thank you.
|
|
|
|
|
Have you been successful on using a C# UserControl with an unmanaged MFC ActiveX host container?
Similar to you, we need to use a C# UserControl and expose it as an ActiveX control. As far as I can see there are some completely different approaches. One would be using an unmanaged MFC ActiveX as host container for the Windows Forms control. And then using CWinFormsDialog or CWinFormsView to host the Windows Forms control. Another approach would be to rebuild the complete ActiveX interfaces with C# and expose it directly to COM.
We tried approach one and have some major problems. We created the MFC ActiveX host container which works and currently displays an empty CDialog. Now, when turning on Common Language Runtime support (/clr), Visual Studio 2005 locks up when loading the project. 100% reproducible... turning of '/clr' everything works, turning it on VS2005 locks up while loading the project without any error message, it just hangs while loading CLR dlls like 'mscoree.dll', 'mscorwks.dll'.
Any help would be appreciated... thanks in advance!
cheers,
mykel
If they give you lined paper, write the other way!
|
|
|
|