|
I am working on a application that requires me to know which window has the focus. I have installed a hook for WH_CALLWNDPROC. By looking at WM_SETFOCUS. I can tell when the focus is changed. However, this does not work for console windows (like cmd.exe). Does anyone know how I can tell when a console window gets the focus? Is there a message that gets sent to console windows?
I have tried using WM_ACTIVATE and it does not work.
Dave
|
|
|
|
|
Try using SPY++
Still Alive!!!
Thank you God.
|
|
|
|
|
Spy++ doesn't show messages for console windows.
|
|
|
|
|
I am having difficulties getting VC 6 to honor the dependencies between projects with different configurations. Here is what I am running into:
Project Main has 3 confugrations
* C1
* C2
* C3
Project Sub has 2 of the 3 Main configurations
* C1
* C3
When I go to build Main project C2, which is trying to link with Sub project C3, VC insists on building Sub project C1 instead of C3. I have searched high and low for a way to specify this, w/o any luck (obviously).
I have the dependencies set up properly using the dependencies dialog. In the project settings, there is a check box for "Allow per-configuration dependencies" but that seems to operate on files, not on projects.
Please help
|
|
|
|
|
Was the set active project specified?
Still Alive!!!
Thank you God.
|
|
|
|
|
Not quite sure, but it sounds like your build targets don't have identical names. That makes VC guess as to which targets really need to be build. For example, if Project A has a ReleaseMinSize target, and depends on Project B which has a Release target, when you build A, VC will guess that you want B:Release built too. If the names are different enough, it may guess wrong.
If you can't change the names, go to Build->Batch Build and select the target(s) you need built.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
Actual sign at the laundromat I go to: "No tinting or dying."
|
|
|
|
|
Hi Michael. The way I have it set up is my main project (Main) has 3 configurations: Internal, External, and Eval (internal is a private build for our company, external is the version we sell to the outside world, eval is a demo/trial build).
Main is dependant on Sub (a dll/lib pair). Sub only has 2 configurations: Full and Eval. It doesn't make a distinction between Internal and External because there is no need to.
So, Main-Eval should link with Sub-Eval, and that is working just fine. And Main-Internal is linking properly with Sub-Full. The problem is that when I go to build Main-External, VC thinks it is dependant on Sub-Eval. In Main-External's project settings, I have it linking with the Sub-Full.lib, which I don't think VC is paying any attention to... it is just taking a guess at which of the two Sub configurations Main-External is dependant on.
I was hoping that the "Allow per-configuration dependencies" check box in the project settings would alleviate this, but it doesn't. If it is not possible to do something like this, let me know. It would be a bummer, but at least I would stop cursing MS up and down as I have been for the past week.
Thanks.
D
|
|
|
|
|
In case anybody is interested... i figured this out (it wasn't easy). VC tries to do a name match between project configurations. If one project is dependant on another, and the other project doesn't have a configuration with an exact name match as the dependant one, it will do a "best guess" name match.
In my case, my main project configurations were:
Main - Win32
Main - Win32 External
Main - Win32 Eval
Sub - Win32
Sub - Win32 Eval
When compiling, Main - Win32 External, it looked at all the configs in Sub to try and find a match. Since it couldn't, it picked the closest match, which was Sub - Win32 Eval, and tried to compile it (which is not what I wanted).
So I changed the names to:
Main - Win32 Exec
Main - Win32 External
Main - Win32 Demo
Sub - Win32 Exec
Sub - Win32 Demo
and everything worked beautifully. Now when compiling Main External, it will find that the config name matches more closely to Sub Exec then Sub Demo.
One of those undocumented features, I guess.
|
|
|
|
|
I have an MFC SDI application with split windows and tabs. See Dan Clark's design: "Drag & Drop & Background Image Tree Control". I have three panes based on CView that display internal information. Two panes are CFormView based to display lots of buttons, trees and lists. It's an instrument panel. The core code includes a compiler/interpreter for a proprietary language (like java) called HTL.
The problem: I also have two panes that are CRichEditView based. These are for the user to edit the HTL source code. The two views are already open in two panes. BUT, this is SDI, they don't have CDocuments, yet. How do I set up a doc/view architecture in InitInstance so that OnFileOpen() will add a doc and stick the file into one or the other view? Can I use CMultiDocTemplate in SDI? I don't want to create child windows like MDI does since I already have the window/pane set up. Right now it fails to find a view and then the frame calls OnInitialUpdate on everything and crashes when something gets called second time.
So Hum
|
|
|
|
|
I can not help you directly but you may take a look at this topic in the MSDN library, it may help you:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_core_document.2f.view_architecture_topics.asp
|
|
|
|
|
I have seen this in some games. I make different process for a single click with mouseup in a second and single click with mouseup after 1 second. how can i distingush both event? I'm using OnTimer to repeate this while clicking on a button.
I might not explain clear, but any one has solution?
Regards,
Shinya.
|
|
|
|
|
Get rid of the OnTimer.
In your buttondown handler, get the current time.
In your buttonup handler, also get the current time. Then compare the time to the time you got in the button down handler. Check if the difference is greater than or less than 1 second.
You can use CTime and CTimeSpan, or COleDateTime and COleDateTimeSpan, or SYSTEMTIME, or FILETIME, etc.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Now that I am actually on the right board, I hope...
I am trying to impliment a window in C++ that I can use in VB. Why? Because VB doesn't provide access to the two things I need for my project:
1. The ability to change the windows control container ambient property from runtime to design mode. I want to build a simple form designer into the program I am making. Most existing form designers cost money I don't have and can't be integrated into your own applications (even assuming I wanted the bloat from them).
A normal designer would be useless anyway. I need to have a way to describe how the events tie into other things. Basically the situation is like this:
[Client] [Forms Control]
|---Inbuilt functions <-- Inbuilt functions -| ^
|---Plugins (scripts) <----------------------/ |
\-----------------------------------------/
In other words, a button may pass the contents of a textbox on to the client's Send function when clicked. Something else may cause a Change event that needs to execute the CallPlugin function instead, which allows the script to ask for the data. There is no practical way to do this if I can't let the user specify which of these things to do in the form layout file. Traditional form designers just place the basic information on the control into the file, not extended stuff like I need.
However, as usual the Unholy Order of MSDN doesn't provide any usable information on control containers and every web page seems to involve how to get the ambient properties, but not change them. Ironically the one page that I once found, when looking for how to change the multiline property of a textbox in VB (go figure..), I can no longer find, or remember what odd combo of search terms I used to accidentally get there.
Help finding usable information on actually using control containers and setting their ambient properties would be greatly appreciated.
2. Eventually I would like to be able to let the users add 'any' control they like through the designer. The problem is that I have no way of knowing what controls I plan to use before hand, so I can't build in a comprehensive list of every event that I need to trap. I *think* I may have some idea how to trap and handle events other than the known ones like 'Click', which all controls tend to have, but I have no idea how to properly get a list of possible events or how to use that information to identify unknown events and deal with them. As usually, all documentation on the subject refers to using known events and its sole concession to the possibility that such unknown events even exist is something like:
ElseIf
'Put code to handle unexpected events here..
C++ code refering to this isn't any better, but I figure that if I have a list of things the object *should* do, then there may be some chance of figuring out which event it did fire. Nice that this tiny key detail escaped the notice of all those experts writing example code. Kind of like how MFC docs always assume you know which header file to look in for the value of the WTF_ISTHIS flag for some API call (or that you even have the needed files). lol
|
|
|
|
|
Ok.. I have mananaged to actually find an online copy of the files for CPatron, which claimed to show how to use control containers, but as usually only provided 'half' the information about them.... The half that was missing was of course involved with setting properties, instead of just reading them. Sigh....
Anyway, I hunted a *lot* more and found:
dispparams.rgvarg[0].vt = VT_BOOL;
dispparams.rgvarg[0].bool = FALSE; // Or TRUE for *run mode*.
dispparams.rgdispidNamedArgs = DISPID_PROPERTYPUT;
dispparams.cArgs = 1;
dispparams.cNamedArgs = 1;
hreselt = Object->Invoke(DISPID_AMBIENT_USERMODE, NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYPUT, dispparams, NULL, NULL, NULL);
Which I assume will do what I want... Anyone have a clue if a VC++ class that impliments this can call the Invoke property of a VB window, or am I going to have to build my own window in VC++ to handle that as well?
Still hunting for info on how to find out what events a control fires, I just hope it is slightly less frustrating to find...
|
|
|
|
|
We have a suite of apps (GUI, console, server, on Win and Unix) that constitute a release. Our xplatform build script gets the current version number (eg: "4.1.0") from an env var, and creates a text file (eg: CurrVersion.h) in its pre-build step, that has a few #define s a la:
#define CurrentVersionMajor 4
#define CurrentVersionMinor 1
#define CurrentVersionPatch 0
The Unix apps just use these #define s and bake the version info into themselves. CurrVersion.h is not stored in CVS - it's generated at build time and deleted when the build cleans up. This scheme does away with having every developer remember to change their app's version info before releasing.
I'm trying to do the same thing for Windows and have run into a problem.
Generating a Windows version resource in a pre-build step is easy, but having it referenced by a Windows app's .rc file at compile time isn't. It seems that that the version info needs to be *in* the app's .rc file (and can't be just referenced from another location, or be present in an rc2 ). Also, #includ ing another file from the app's .rc file isn't foolproof, since MSDEV regens the .rc when you add/modify/delete resources, overwriting your #include statement.
Any ideas?
Notes:
- I don't want my prebuild step to directly hack the
.rc file (by inserting the generated version resource), because the .rc is under version control and should only be edited by a developer.
- I could muck with the resource info in the .exe in a post- build step, but I prefer to have a human-readable source code solution.
- I've already read the version-related articles at CP.
Thanks,
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
The way I did this once was three-step. First I modified the version resource in the .rc file to:
#include "somefile.h"
VS_VERSION_INFO VERSIONINFO
FILEVERSION MY_FILE_VERSION
PRODUCTVERSION MY_PROD_VERSION
... Then in the somefile.h file, I'd have:
#define MY_FILE_VERSION 1,2,3,4
#define MY_PROD_VERSION 1,2,0,3 Part of the build process was to run a little utility I wrote that parsed the somefile.h file and incremented the numbers accordingly.
Probably not the most elegant solution, but it worked for our situation.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Doesn't your #include statement get overwritten when the .rc is edited in the resource editor?
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
No, it stayed intact.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hmm, DevStudio wipes out my #include when I edit the .rc (eg: by adding/modifying a dialog).
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Let me look through my archives and I'll send you what I used.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
|
Thanx just what i was looking for.
Still Alive!!!
Thank you God.
|
|
|
|
|
Unfortunately, it doesn't work.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
|
Unfortunately, a version resource appears to be only recognized when present in the .rc file, not in the .rc2 (or #includ ed by it).
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|