Re: Thanks for the response

by (Login MCalkins)
Moderator

 
I think a lot of what you asked about can be done with the Win32 API. You might browse through the MSDN library to see which functions seem appropriate.

This thread contains a brief API tutorial:

http://www.qb64.net/forum/index.php?topic=4527.0

In my answers, I'm going to be a bit vague, partly because I completely lack experience with many of the things you asked about. Partly because there are too many questions for me to focus on any one in detail at the moment.

-How do you make it seem like the keyboard is being pressed for things outside the program, like ctrl-c or alt-f4?
>I want to be able to activate it from a program but _SCREENPRINT (CHR$(0) + CHR$(130)) and _SCREENPRINT (CHR$(0) + CHR$(131)) doesn't register with it. It works fine when I actually type it or when i change it to something simpler like "a". Any ideas?

There might be some other way, besides trying to simulate a keystroke. There might be some message that you can send to the program to tell it to activate.

http://msdn.microsoft.com/en-us/library/ms632590%28v=vs.85%29.aspx

-How do you obtain a list of programs names that have windows open?

Browse this:

http://msdn.microsoft.com/en-us/library/ms632595%28v=vs.85%29.aspx

EnumWindows, GetWindowModuleFileName, and GetWindowText look potentially helpful. However, anything that involves needing a callback function will require some C++ code.

-How do you obtain a list of all the programs installed on the system?

I would think the information is in the registry. Where in the registry would be the proper place to look, I don't know. Here is an example of accessing the registry:

http://www.qb64.net/forum/index.php?topic=4721.0

-How do you get the variable of the name of the program of the window you are currently on?

Do you mean your own program, or the foreground window?

Do you mean the title or the executable file name?

For your own program:

The title would be tricky, because I think you would need an HWND first, but the usual way in QB64 of getting your own HWND involves setting your title. :-P

If you mean the file name: GetModuleFilename. There should already be examples in the wiki and on the qb64 forums.

To find the active window: GetForegroundWindow, then probably either GetWindowModuleFileName and/or GetWindowText. Here is an example of GetForegroundWindow to find if your program has focus:

http://www.qb64.net/forum/index.php?topic=5568.0

-How do you switch between windows? Like switch to any of the windows, not just Alt-Tab. I guess changing the variable from the question above this one.

Check out SetForegroundWindow.

-How do you get the address ('C:\Documents and Settings\etc') of the thing or things you have highlighted in a Windows Explorer window?

If there is such a thing, I would suspect that it's in the Shell API.

>What about when you drag something from a folder into a program and it recognizes it and does things, iTunes for example, it would need to know what and where you are dragging it from.

That might be either the Shell API or something to do with Window Messages... :-P

I take it you mean while your program is already open. Otherwise, it's a command line parameter.

Regards,
Michael

Posted on Mar 23, 2012, 3:21 PM

Respond to this message   

Return to Index

Response TitleAuthor and Date
Re(2): Thanks for the response on Mar 24
 Re: Re(2): Thanks for the response on Mar 24
  Re(4): Thanks for the response on Mar 25

 Copyright © 1999-2014 Network54. All rights reserved.   Terms of Use   Privacy Statement