|
What do you meen????
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
I mean, your answer is right, I just don't get what this could achieve. The point of the keypress event is surely to respond to the key that was pressed. Why does hte OP want to call it, without specifying a key that was pressed ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Dear Christian Graus,
i am sorry .., may be i am going wrong.
The Q. is asked by kalikarr, he wants to call the keypress event in the form load. So before not loading the form he wants to call the event. I think no superman can't enter a value before loading the form. So that i passing a dummy value to that method to fire. however i think that(temp) will also have the value of '0x00'.
replay me.
Thanks.
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
You have totally misunderstood me.
Your answer is fine. I am saying, I don't get what the original poster hopes to achieve with code like this, as the code in a key press event generally checks what key was pressed, in which case it would do nothing, or if he has an action he performs on any key being pressed and wants to perform that same action at startup, he should factor it out into a method. I am saying the person who asked the question has design issues, not criticising your reply.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
i want to navigate backeard and forward in my code window
how to do that with a short key,
hello
|
|
|
|
|
ghumman63 wrote: i want to navigate backeard and forward in my code window
how to do that with a short key,
you can find these shortcuts by going to menu Tools->Options->Environment->KeyBoard, there you will find an edit box having label "Show commands Containing:", there you should type "View.N"(without quotes) then you will find the shortcuts of Navigate Forward and Navigate Backward.
In short you can find shortcut of any menu or you can even customize that.
Regards,
Mushq
|
|
|
|
|
I am currently writing an application that launches and manipulates other programs. I currently launch another application through the use of the process class, and since I need to manage many other applications, I just store the MainWindowHandle value into an array, and dispose the process object that I had created.
The problem that I am having is, when it comes time to manipulate the application, I do not know whether the application is still running or not(has the user closed it?). Is there a Windows API that returns values based on a window handle? Is there any alternative to using an API to accomplish this?
Would I be better off creating an array of processes, eg Dim myArray() as Process ?
Any suggestions are greatly appreciated
modified on Monday, March 17, 2008 11:42 PM
|
|
|
|
|
You could store the actual process object in an array or you can use the Process.GetProcessByName[^] method to find the process again. You would want to store the process name (the name of the executable) rather than the handle.
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
Thanks for the advice. Storing the process in a process array makes things a lot easier.
Thanks,
Mitch
|
|
|
|
|
You're welcome. The one thing to keep in mind when doing that is going to be how long you must keep those references and how many of them you will be keeping. Holding a bunch of Process objects in memory in an array will consume a lot more memory than just holding a string value of the process name. If you won't need access to the Process information for a while (or are passing the array around as a function parameter) you really should think about just keeping the process name and only creating a Process object as needed.
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
You are correct. When I changed out my process array for just a regular array, I had saved quite a bit of memory. I am also able to get the process by using the GetProcessById method. However, once I call theProcess.HasExited method, I get a "Win32 Exception: Access is Denied".
[Edit]
With a little more digging around in my code, it seems that my error is being caused earlier in my code.
Dim newApp As Process = New Process
newApp.StartInfo.FileName = appSelPath
newApp.StartInfo.WindowStyle = ProcessWindowStyle.Normal
newApp.Start()
However, when I call newApp.MainWindowHandle to store the value in the array (I need to use this for Windows API's), it returns 0.
Thanks for your time,
Mitch
|
|
|
|
|
That is probably a better solution since you are the one starting the processes you will have access to the process Ids.
There are situations where Process.HasExited will throw a Win32Exception so you will still want to trap for that error and handle it appropriately. This mostly occurs when the exit status can't be returned for some reason.
As for MainWindowHandle returning 0, this is also a legal value. A process has a main window associated with it only if it has a graphical interface; otherwise MainWindowHandle will be 0. Take a look at WaitForInputHandle[^] to allow the process to finish startng.
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
Thanks a lot for all of your help, it is greatly appreciated.
Although, it seems that WaitForInputIdle does not want to work correctly for me.
This is the code that I am now using:
Dim newApp As Process = New Process
newApp.StartInfo.FileName = appSelPath
newApp.StartInfo.WindowStyle = ProcessWindowStyle.Normal
newApp.Start()
newApp.WaitForInputIdle()
MsgBox(newApp.MainWindowHandle.ToString)
Even when I call WaitForInputIdle(), it does not stall my application and I immediately get 0 as the main window handle... It works with notepad.exe, but when I launch iexplorer.exe (internet explorer), I still get 0...
Thanks,
Mitch
modified on Tuesday, March 18, 2008 3:11 PM
|
|
|
|
|
You're welcome. Glad to help out.
It seems that WaitForInputIdle() applies only to process with a UI but there may also be other conditions which cause it to return false. You might want to consider uisng the WaitForInputIdle(Int32) overload since the version you are calling has the potential to wait forever. Also, if for some reason the process doesn't have a message loop, both overloads will immediately return false, so you might want to test the return value as well.
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
Hello,
I am running an experiment which I call VB four different functions I wrote to measure transitor characteristics. I want to display on the form which measurement I am doing. I went about doing this by creating a textbox on the form and then assigning the name of the measurement to the textbox value right before each of the four measurements was done.
The problem is that only the name of the last measurement is displayed after all four measurements are done.
I think it might be because VB is single thread.
Is there some function I can use to update the form?
Thanks,
Orlando
|
|
|
|
|
Hi,
the effects of GUI changes that you order in an event handler typically will show
up only after that handler has exited, so if you set 4 different text values to a
single control, it will only show the last one.
There are a few solutions to this:
1.
the universal approach is to somehow split the actions, e.g. by adding at least one
thread (and then that thread is not allowed to access your GUI elements, so you
have to start using Control.InvokeRequired and Control.Invoke).
2.
another way to slice the job is by using a Windows.Forms.Timer; it will tick periodically
on the GUI thread, so it is allowed to access your Controls.
3.
a quick hack is to leave all as is and to include Application.DoEvents() statements
everytime you want immediate GUI results; this however is dangerous: if your handler
ever gets called recursively, a stack overflow may result. Example: a long handler
might restart if you press the button again before its first action has finished,
since every DoEvents() looks for Windows messages AS IF everything that has already
been started also has finished.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
How do I select a particular selected Value using a list view control?
|
|
|
|
|
What do you mean by "select a ... selected value"??
Are you talking about a ListView setup for multi-select and you want to iterate over the items selected by the user?
|
|
|
|
|
Has anyone ever managed to clear the MS Access (2003) sync list?
Under Tools > Replication > Synchronize Now...
I get the window to choose the location of my replica.
Now due to numerous attempts, my list has grown rather large, and I haven't found how to remove entries or how to clear it.
The correct entry is the second one, and this requires users to have to change their selection.
I've actually made a VBA button that uses a hard coded value to synchronize sans the dialogs.
There's gotta be a way around this.
(and no, I'm not willing to make a new database and import stuff.)
thanks in advance.
(i hope this is the most relevant message board)
Eric D. Georgiades
Networking Professional / Multimedia Developer
|
|
|
|
|
Eric Georgiades wrote: (i hope this is the most relevant message board)
You're actually looking for a site dedicated to Office. CP doesn't have an Office forum and does very little with it.
AFAICT, there's no way to clear that list. There's nothing stored in the Registry, nor any file in the users Windows profile, other than inside the Design Master database. So, basically, you can't clear this list without doing:
Eric Georgiades wrote: (and no, I'm not willing to make a new database and import stuff.)
|
|
|
|
|
Dave Kreskowiak wrote: AFAICT, there's no way to clear that list.
I was afraid so.
I always appreciate your expertize,
even though it's an office question
thanks again.
Eric D. Georgiades
Networking Professional / Multimedia Developer
|
|
|
|
|
Goal: I would like to be able to display "XXXX users are currently logged in" on a webpage in my web application. XXXX represents the number of users who are currently logged into the application.
In my application, each user has their own unique username and password combination. When a successful login occurs, a field called "UsrIsLoggedIn" is updated with a 1 for that user. UsrIsLoggedIn is a tinyint data type and will always contain data that is either a 1 or a 0. When a user clicks the "logout" button, the UsrIsLoggedIn changes from a 1 to a 0. However, if a user does not click the "logout" button and closes the browser to end their session, there is no way to know that they are logged out. I want to be able to create an administration page that shows who is currently logged into the application. Any ideas? Or is there a better way to accomplish this goal? Any thoughts would be appreciated! Thanks!
|
|
|
|
|
select count(*) from logins where UsrIsLoggedIn = 1
I'd store the time the logged in user last asked for a page, and then, when this time is over a certain amount, log them out.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Chrisitan,
Thanks for the reply.
You said "I'd store the time the logged in user last asked for a page, and then, when this time is over a certain amount, log them out.". I thought about this idea originally too; however, it would rarely be accurate. Regardless of whether or not I set the logout time to 20 minutes later, 4 hours later, or 1 day later - I could actually be updating their status as being logged out of the application when they are in fact logged into the application. Do you have any other ideas?
|
|
|
|
|
Mr Business Kid wrote: Regardless of whether or not I set the logout time to 20 minutes later, 4 hours later, or 1 day later - I could actually be updating their status as being logged out of the application when they are in fact logged into the application. Do you have any other ideas?
There's really no way around this. Your server-side code cannot know if the user is either just sitting there staring at a page, or if the user closed the browser. There is no event that's fired on the client-side that the browser is closing down. No event means no notification to the server.
This is just a fact of web life you have to put up with.
|
|
|
|
|