|
Have a look at this article: http://www.codeproject.com/internet/telnetview.asp[^] From it you can extract a good example of using CreateProcessAsUser and LogonUser.
One big note (and something I ran into) - this is not a *complete* tutorial. One thing not mentioned is, if you need to, loading the user's registry hive. This may or may not be necessary given your application. There are MSDN articles on that, just search for them.
Sometimes I feel like I'm a USB printer in a parallel universe.
|
|
|
|
|
Hello!
Is there some smart way of checking whether a click with the left mouse button is part of a double-click? Or will I have to use a timer, that is, when the left mouse button is clicked, I use the timer to wait and see if I receive an WM_LBUTTONDBLCLK within some interval.
|
|
|
|
|
you don't have to count time !
WM_LBUTTONDBLCLK tells you if you made a double click (that means your two click are into a time intervalle like specified in your windows settings.
TOXCCT >>> GEII power
|
|
|
|
|
I'm Sorry that I didn't describe the problem accurately enough..
When we look at the incomming messages, a double click looks like this:
WM_LBUTTONDOWN <<<<
WM_LBUTTONUP
WM_LBUTTONDBLCLK
WM_LBUTTONUP
I want to check if the message marked with the <'s is part of a double click. I guess I could do this myself with a timer, i.e wait and see if a WM_LBUTTONDBLCLK shows up within a given interval, but I was wondering if there already existed a function to do this.
Cheers.
|
|
|
|
|
no, timer is not a correct solution because if you change your mouse settings, this will not correspond to the new "reality".
What i don't understand, is why you look at all the incomming messages ???
Windows send much and more messages, and if you start catching all of these, you'll die before.
just associate a function to the WM_LBUTTONDBCLK and that'll work.
To persuade yourself, do what you did to know which messages were sent, but with the mouse over menu items !!!
Just catch the messages you need !
Moreover, if WM_LBUTTONDBCLK is sent, it's because you really made a double-click...
And finally, to answer your last question, if wou wanted to know if WM_LBUTTONDOWN was part of a double-click, set a flag when this signal happens, but we get back to our first problem... you have to set your timer with the value windows asociate to a double-click...
could you give me the reason why you need this ?
thanks
TOXCCT >>> GEII power
|
|
|
|
|
What I need this for is a tray icon! Try clicking once on the windows messenger tray-icon: A menu pops up! Try double clicking: The application shows! Messenger obviously knows when I double click and when I single click, and it isn't just handling DBLCLK, because then the menu would popup the first time you clicked.
When you right click the icon, the menu appears right away. When you left click, then menu doesn't appear until a second later. So I was guessing that they wait and see if a WM_LBUTTONDBLCLK is coming.
|
|
|
|
|
yes you're right...
thanks for that very good example
have a nice day dear pie
TOXCCT >>> GEII power
|
|
|
|
|
you are right, will have to use timer
greatest thing is to do wot others think you cant suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
What is the difference between Stack Commit Size Vs Stack Reserve Size Vs Stack param inside the create thread func? Thanks.
|
|
|
|
|
Hi, i need a way to communicate between my app which is written in C++ and Java. The problem is, the application that runs the java code is not mine and it just runs the java code in a safe environment. This poses some security restrictions such as, i can't open any sockets, and seeings that was the obvious way to me to make them communicate, i don't know what to try next. Are there any facilities in Java to make communication with another windows application easier?
Thanks in advance for any responses.
Kuniva
--------------------------------------------
|
|
|
|
|
What do you exactely want to do upon the java application?
Wouldn't signal sends work ?
TOXCCT >>> GEII power
|
|
|
|
|
What exactly are signal sends? Never heard of them..
Kuniva
--------------------------------------------
|
|
|
|
|
I'm going to pretend to be an expert on this because I just hooked up a browser-based Java application to a complex C++ library using JNI.
To get meaningful communication between the Java applet and your C++ application, you are probably going to need to remove the security restrictions on the applet so it runs outside the browser's sandbox. You can do this by signing the applet with a cryptographic signature, or by running the Java code as an application instead of an applet. Once you do this, the Java app and your C++ app can communicate by sockets, or writing files to the local filesystem, or you could use JNI (or COM if the applet is written for the Microsoft VM) and package your C++ app as a DLL that the Java applet can call.
If you can't or don't want to change the security restrictions on the Java applet, pretty much the only way to get it to communicate is to have both it and your C++ app talk to the same server on the applet's host (I suppose you could also send Windows messages to the applet's window, but that's a really limited form of communication). Applets are allowed to open a socket, but only back to a server on the host from which they were downloaded. Hosting the applet on your local machine might work for you as well.
|
|
|
|
|
Well the problem is that the java code is not running in a browser and its not an applet, its just.. scripts running through JNI already by another application, so i can write the scripts, but not change the application. So i want to communicate with the scripts.
Kuniva
--------------------------------------------
|
|
|
|
|
If code you don't control is putting the Java code in a restricted sandbox, there isn't a lot you can do (that's what the sandbox features is for, after all).
Do you know the details of the sandbox restrictions? Do you get a SecurityException when you try to connect to a local socket from the Java?
|
|
|
|
|
Yes thats exactly how it is. But when i try to make a socket, i just get an error, not an exception i think, the code is basically like this:
try
{
ds = new Socket(InetAddress.getByName("localhost"),port);
}
catch(UnknownHostException uhe)
{}
catch(IOException ie)
{}
catch(Error e)
{
CodexConsole.Print(0,1,"Error");
}
And i always get the error. I looked at the definition of JNI_CreateJavaVM and there's like three parameters u pass right? Well i might be able to "crack" them out of the java container application if i know what to change, but i'm not sure.. Would that work? if i could somehow lift the restrictions?
Thanks for your help.
Kuniva
--------------------------------------------
|
|
|
|
|
The restrictions aren't put in when the VM is started, but sometime later with a call to System.setSecurityManager
|
|
|
|
|
In my code, I have a menu to restart a service. Previously, I was calling ControlService(hService, SERVICE_CONTROL_STOP, &ServiceStatus) to stop it, and then StartService(hService, 0, 0) to start it. However, ocaasionally, this does not work. Putting a sleep(100) between these two events seems to fix it. However, I cannot guarantee this solution on all machines. Does anyone know how microsoft implements their restart button in the Services Control Panel?
|
|
|
|
|
tried using EnumServicesStatus() ?
greatest thing is to do wot others think you cant suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
Thanks. Would I have to call this in a while loop and keep trying to start this when it's not yet started? How long would I wait? I'm trying to see if anyone knows how Microsoft does it and what their timeout value is.
|
|
|
|
|
how do i save html + images in that html?
here i found a sample which does save html only, how about saving
images?????
http://home.inreach.com/mdunn/code/URLDownload/URLDownload.html
Thanks
|
|
|
|
|
|
man i was not drunk and i wanna save html page + images using my vc
application
So do i have right to ask it here now?
DOES Web Browser control let save html+images ? or it does let save only HTML?
|
|
|
|
|
im sure u are looking for this
http://www.codeproject.com/shell/iesaveas.asp
greatest thing is to do wot others think you cant suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
well this is not exactly what i need i already checked this article
it does save file as .mht but i need FULL WEB PAGE. I changed SAVE TYPE in code and did try to save whole page but it doesnt save images only html code.
thanks for responce
|
|
|
|