|
My application is a modeless dialog which sits on top of the application's main window.
Within the dialog is one edit control.
My pointers are correct i.e., Window->Dialog->EditCtrl
In XP, the Alt+Tab function of the Desktop works just fine.
In Vista, the edit control does not regain focus.
I am fine with sending Focus to the edit control however I am having problems
with intercepting a WM_Message from the desktop when it brings my application to the
foreground.
Is it the Z-order, EV_WM_Message response, using GetForegroundWindow or something else?
I can utilise the EvGetFocus and EvKillFocus functions but cannot distinguish between
control from within the application and that which comes from the desktop.
This is my first time here. Assistance would make me a regular responder to questions.
|
|
|
|
|
I'm not sure what you need, does WM_ACTIVATEAPP[^] help?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Tried both WM_ACTIVATE and WM_ACTIVATEAPP.
I've set up a status bar at the base of the application requesting both
functions to talk (acknowledge the message) to me.
No response.
Thanks for your response.
|
|
|
|
|
I might instantiate these functions into the dialog and
try letting it call the parent window with NotifyParent
to refresh itself.
Always good to talk to someone.
Thank You
Ric
|
|
|
|
|
Ric Ashton wrote: I've set up a status bar at the base of the application requesting both
functions to talk (acknowledge the message) to me.
How do you mean that?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Within C++ Object Windows
TStatusBar* StatusBar;
char xxx[255];
sprintf(xxx, "Keystroke C Timer = %d", RicsMasterTimer);
if (::StatusBar) {::StatusBar->SetText(xxx);}
The status bar is part of the application window.
|
|
|
|
|
Ah, you are using Object Windows (Borland, right?), i have no experience with that so i can't help you with anything specific, in VC++ i would give the WM_ACTIVATE (or WM_APPACTIVATE) message a handler in my dialog and in that handler i would set focus onto my edit control. Sorry but i don't know how that would work with OW.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
I thank very much for your time.
My application is complex and I will get through the current inconsistency between
operating systems with respect to Focus and Activate.
I would like to ask one more question.
In older computers with sound cards, there is an instant termination of
sound with two direct PlaySound statements. One might hear a click of the
first sound, with the second sound being played in full.
Example
strcpy(bbb, ResidentDir);
strcat(bbb, "\\sound\\alphabet\\cfs.wav"); //changed file structure
PlaySound(bbb, NULL, SND_SYNC|SND_NODEFAULT);
strcpy(bbb, ResidentDir);
strcat(bbb, "\\sound\\alphabet\\ill.wav"); //I love lollipops
PlaySound(bbb, NULL, SND_SYNC|SND_NODEFAULT);
On newer computers with the sound card built into the motherboard, there is an accumulated
delay. If the above code were to be repeated 100 times, it would take some 10 seconds for the
computer to say "I love lollipops". I was curious as to whether there was a primacy on streaming
or an inability to interrupt in the new configurations.
Yours
Ric
|
|
|
|
|
I can't really help you there...do you mean the first PlaySound returns before the sound has been played and then when the second PlaySound kicks in it terminates the first sound with a "click" sound and then starts to play the new one?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Hi,
that seems correct.
If you want better sound control, the general advice is to use DirectSound. I have no experience with it though.
Luc Pattyn [Forum Guidelines] [My Articles]
- 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 the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
I hope this is an easy question. I have ten static text boxes with ids IDC_NAME0, IDC_NAME1, etc. Corresponding mapped variables are m_name0, m_name1, etc.
I want to create a loop so I can easily assign the same text to each box using a m_namex.SetWindowText command.
How can I create an expression to do this?
for(i=0;i<=9;++i) m_name??.SetWindowText("hello");
I'm using VS 6.0, C++, dialog based application.
|
|
|
|
|
Use an array instead of separate variables, so instead of having m_name0, m_name1, ... m_nameX, declare m_names[X] and then do
for (int i = 0; i < X; i++) m_name[i].SetWindowText("hello world");
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Thanks, that was easy enough. I was using class wizard to create the variables and it wouldn't let me specify an array index, so I thought it wouldn't work that way. However I was able to change it in the header file and message map and it worked so go figure! Thanks again
|
|
|
|
|
callmeishmael25 wrote: How can I create an expression to do this?
If the IDs are sequential:
for (i = IDC_NAME0; i <= IDC_NAME9; i++)
SetWindowText(i, "hello");
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Not sure if this is the right forum since it also has to do with ATL but..
I'm programming a shell extension dll (context menu) based off the article "The Complete Idiot's Guide to Writing Shell Extensions" by Michael Dunn. So I made an ATL project with MFC and COM support. At first I started by using SetMenuItemBitmaps() to set the menu item icons, but then I found out that this method doesn't support transparency.
Because achieving transparency for menu icons is apparently far from straightforward, I had the marvelous idea of looking at the Tortoise CVS shell code. I incorporated some of the ideas like using LoadImage() and GDI plus on Vista to blit the icons to a bitmap and make them look good that way, but I also noticed that they didn't use ATL and did reference counting themselves (and as such are also easily able to access the DLL's instance handle).
My problem now is that each LoadImage() call fails with error code 1813 which according to MSDN means "The specified resource type cannot be found in the image file.".
Now my best bet is that I'm somehow using the wrong module handle (the one of the EXE perhaps instead of the DLL), but I've tried everything I can think of to get the correct handle including:
1. Use the m_hInstance member of the global CWinApp instance.
2. Just pass in NULL for LoadImage().
3. Use GetModuleHandle() with the dll name passed in. This returns a handle but it still fails with 1813.
4. Use MFC's AfxFindResourceHandle() to get a handle to the dll instance. This fails with an assertion error in some MFC file saying the current resource handle is not set (so i tried setting it with AfxSetResourceHandle() to the theApp.m_hInstance handle, but that just crashed).
I'm starting to wonder if the people from tortoise intentionally decided not to use ATL so they could get the instance handle from DllMain(). Either way, it seems to me that I've bumped into some internal MFC/ATL funkyness and I can't figure it out.
So if anyone knows more about this or has any suggestions, do tell
Oh yea, note:
For the resource I'm testing with I'm simply using a string id such as "IDI_TORTU" which I then pass to LoadImage().
greets
Kuniva
--------------------------------------------
|
|
|
|
|
Try using the resource ID (numeric) with MAKEINTRESOURCE instead of the "IDI_TORTU" thing... aside of that, you sure you are specifying the right flags to LoadImage, maybe you are trying to load a BITMAP instead of an ICON and it cannot find a BITMAP among the resources with that ID (since it is an ICON) thus the error?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Code-o-mat,
The LoadImage call looks like this:
HICON hIcon = (HICON) LoadImageA(handle, sIcon.c_str(), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
So it is loaded as type IMAGE_ICON, which it is in the resource file (I just copied the tortoise icon).
Hmm I just tried it with a numeric identifier with MAKEINTRESOURCE and that does work however.. I want to use string identifiers like tortoise does because I'll be loading which icon to use from a configuration file (and I don't want to use numbers to indicate icons in that).
I must be doing something wrong with the resources.. :/
Kuniva
--------------------------------------------
|
|
|
|
|
Alternatively you could "convert" the strings you use in the configuration file into numeric IDs in your code (like if (strid == "IDI_TORTU") numid = IDI_TORTU; else ... ). I always used MAKEINTRESOURCE with LoadImage so i'm not sure about string-identification...could it be that the method doesn't actually expects you to specify "IDI_TORTU" but rather the file name the resource was imported from, for example "my_tortu_icon.ico"?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Eureka! : )
No it was nothing like that. Seems all this time I've been looking in the wrong place.
I didn't know that for your resources to have string identifiers, you need to remove the define in whatever your numeric resource header file is maintained by visual studio. I just deleted IDI_TORTU in resource.h and now it works like a charm (doh ).
Thanks for your help, if I hadn't simply tested with MAKEINTRESOURCE I'd still be debugging for instance handles
Kuniva
--------------------------------------------
|
|
|
|
|
We always learn something new...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Hi all. I need to invoke a dll/exe upon selection of controls in flash like checkboxes,radio buttons etc..
By getting the status of the controls I need to perform the actions in my aplication which is developed in VC++ and accordingly I should give responses to flash.
All these process sholud be done inside the flash player only. Suggest me all the possible ways.
Referece materials/Solutions with code are much appreciatable..
thanks,
Praveen
|
|
|
|
|
Does this[^] help?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Lord, if he's confused now, he'll be completely lost reading that guys code. Good luck!
|
|
|
|
|
If I remember correct, FSCommand will help to communicate with Application...
- ns ami -
|
|
|
|
|
you can use FSCommand and socket .
|
|
|
|