|
Have you considered SetWindowPos() ?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
You can use SetWindowPos to move, resize and change the z-index of a window, SetWindowPos[^]
So you could use this:
SetWindowPos(targetWindow, switcherHandle, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
To bring the window to the front, by passing the handle to your switcher window as the second parameter the target application should appear just behind it. Rather than at the front of all windows.
|
|
|
|
|
Thanks, So I have to use this instruccion SetWindowPos(targetWindow, switcherHandle, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); on my "Switcher" dialog, ok, my last doubt is how can I get the handler to the target window from the "Switcher" dialog?
|
|
|
|
|
If you know the title of the window, or its class name then you can use FindWindow[^].
If you don't have the name of the window, but do have a HINSTANCE then you can search through all of the windows until you find the one you need:
HWND tmpWnd;
bool foundWindow = false;
tepWnd = FindWindow(NULL, NULL)
while(tmpWnd != NULL)
{
HINSTANCE hInstance = ProcIDFromWnd(tmpWnd);
if(hInstance == windowInst)
{
foundWindow = true;
break;
}
else
{
tmpWnd = GetWindow(tmpWnd, GW_HWNDNEXT);
}
}
Without either a HINSTANCE the class name, or the window name then I don't think there's much you could do.
|
|
|
|
|
Ok, it's working for the app1 that I know his title, let say from the "Switcher" app it's possible bring the other app1(the one i know his title) behind the Switcher, but with the other app2 , (wich is no-modal dialog) it doesn't work , i do not know the name of his class and the dialog it has not title, so i went whith the code that you wrote, but compiler complains with ProcIDFromWnd, it says that is undeclared identifier, it seems that is not a valid intruction for VC++ 6 , ??
Anyway , since in the final projet will be runnig only these three apps, i thoth that the Switcher can bring the app 1(the one working) behind it and send it to bottom when the user wants to see the app2, mfc library says that it's possible to use the parameter HWND_BOTTOM instead hWndSwitcher in SetWindowPos(hWndTarget, hWndSwitcher, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); to do that, but it's doesn't work neither. What do you think?
|
|
|
|
|
I'm not sure why SetWindowPos wouldn't work, unless you have the wrong hWnd, but as for finding a window by its HINSTANCE this code should actually work. The sample I originally found was in VB so I guess that ProcIDFromWnd is specific to that, GetWindowThreadProcessId seems to be what we really need.
HWND tmpWnd;
bool foundWindow = false;
tepWnd = FindWindow(NULL, NULL)
DWORD procID = GetProcessId(hInstace);
while(tmpWnd != NULL)
{
DWORD id = 0;
GetWindowThreadProcessId(tmpWnd, &id);
if(id == procID)
{
foundWindow = true;
break;
}
else
{
tmpWnd = GetWindow(tmpWnd, GW_HWNDNEXT);
}
}
Bear in mind that this code would find all windows that a process owns, so if it has more than one then you'll have to try and figure out which one you really need.
|
|
|
|
|
Now i get these error messages from compiler:
error C2065: 'GetProcessID' : undeclared identifier
error C2065: 'hInstace' : undeclared identifier
I can't find a the equivalent instruction in VC++6 for GetProcessID
|
|
|
|
|
Well, the function does exist MSDN[^]
hInstace is just the handle for the process that started the window that you want to move, if you don't have that and want to find and move a window that has no title that you don't have a class name for, then your last option would be to look through all of the running processes and find the one you need, only then would you be able to look through all of the windows in search of the one the process opened.
|
|
|
|
|
Three parts:
-----------------
| | |
| | |
|---------------|
| |
-----------------
I only can split one frame to two parts, the top and the bottom. But when drag this form, the form is ghost image.
Is there example to split frame?
modified 2-Apr-12 13:12pm.
|
|
|
|
|
Lots of articles here on CodeProject showing how to use splitter windows. Try the Article Search in the menu above.
I must get a clever new signature for 2011.
|
|
|
|
|
Does anyone use CListCtrl's with multiple selection (i.e., without LVS_SINGLESEL)? If yes, could you post here or send me an email about why you do this, instead of (for example) using checkboxes to mark multiple items?
Thanks!
|
|
|
|
|
It is much easier to click CTRL+A or hold down the SHIFT key while using the arrow keys, than having to move up and down press the "space"-key to flip each item checkbox.
Many times one would combine selection together with checkboxes, where one can flip the checkboxes of all the selected items.
|
|
|
|
|
yeap many times, please pm me your email id, i would send it to you!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
There's an email link in my post.
|
|
|
|
|
Hi All,
I want to Use the SQLFetchScroll to Move the Record to First Position.
There is no Article which gives clear clarity of this Usage.
Pls help me out.
Thanks & Regards,
Uday
|
|
|
|
|
There is a good description on MSDN[^]. I haven't tried, but I would guess you use FetchOrientation = SQL_FETCH_FIRST, and FetchOffset = 0 to get the first record.
|
|
|
|
|
Hi,
Im having MDI application.In that for only one view, iam adding menu.
So i reffered one article form MSDN and i create the menu for that particular view.
http://support.microsoft.com/kb/118435[^]
By using this document i coded and i got my menu also.
But what i need is?
Actually for that particular child window im setting size of the window as 0,0,1500,700.
When i set this,the child window menu is attached with mainframe,only the window is getting this postion.
How can i change this.
I want to move this menu from mainframe to the childwindow(below the caption bar).
Pls help.
Anu
|
|
|
|
|
In google chrome they have checksum value for bookmark file.if i add any bookmark manually i need to change checksum value otherwise browser don't display bookmarks...
|
|
|
|
|
Well, Chrome is open source. Presumably the algorithm is in the code somewhere.
Check out http://dev.chromium.org/developers/how-tos/get-the-code[^].
There is a link to search the code on that page, but I couldn't find it, but is is there somewhere. Also Chrome calls bookmarks favourites.
|
|
|
|
|
When I try to save a text file with non-English text in Notepad, I get an option to choose between Unicode, Unicode Big Endian and UTF-8. What is the difference between these formats?
which of these formats is better?
(Assume that the text can be in languages like Chinese or Japanese, in addition to other languages.)
please tell me which option is better and why?
thanks in advance.
|
|
|
|
|
|
What i know is Unicode is UTF-16 and it is of two types big-endian and little-endian.
The difference between the Unicode and UTF-8 is explained in link below:
->[^]
You can save the file in all format but it is better if you are choosing UTF-8.
I think you already know the DOM character. You have to write this DOM character at first and than your data, so that your file is automatically saved in UTF-8 or Unicode format.
Bytes Encoding Form
00 00 FE FF UTF-32, big-endian
FF FE 00 00 UTF-32, little-endian
FE FF UTF-16, big-endian
FF FE UTF-16, little-endian
EF BB BF UTF-8
I use the UTF-8 format because Java client use my text file and it only support UTF-8 not unicode.
[EDIT] One more thing if you have any doubt about Unicode than always prefer unicode.org [/EDIT]
I believe in LOVE AT FIRST SIGHT...
Bcoz I have loved my Mother...
even since I opened my eyes...(ICAN)
|
|
|
|
|
Shilpi Boosar wrote: What i know is Unicode is UTF-16 and it is of two types big-endian and little-endian.
Unicode basically is an enumeration of characters in many languages.
Character sets are representations using bytes of most (only most these days) of all of the characters in the total enumeration.
UTF16 is a short hand to refer to a character set that represents each code point (often but not always a single character) as 16 bits.
Big endian and little endian is a separate issue which involves when a computer system represents a single multi-byte value with the most significant byte first or last. This can apply to numerics as well as character representations.
Shilpi Boosar wrote: I think you already know the DOM character. You have to write this DOM character at first and than your data, so that your file is automatically saved in UTF-8 or Unicode format.
The Byte Order Mark or BOM is an optional part of a character file/stream. It does not determine the make up of the character set used after that, but a processor can use it to determine how to correctly consume the source.
However some processors will not read the BOM at all so one must test with it to insure it works.
Shilpi Boosar wrote: I use the UTF-8 format because Java client use my text file and it only support UTF-8 not unicode.
Incorrect.
UTF8 is as valid as a unicode character set as any other unicode character set.
|
|
|
|
|
1) When you save your text file as unicode than the first two character is BOM character i.e. 255 244 (UTF-16 Little endian).
2) When you save your text file as UTF-8 than the first three character is 0xEF,0xBB,0xBF
Programaticallly when I save file as unicode or UTF-8 than I must add these character first in my file. If I am not wrong than these are BOM character as per the Unicode Official site.
3)
jschell wrote: UTF8 is as valid as a unicode character set as any other unicode character set.
Absolutely right. I just explain him my point that if java client is using utf-8 file than only it reads the file properly else not.
I believe in LOVE AT FIRST SIGHT...
Bcoz I have loved my Mother...
even since I opened my eyes...(ICAN)
|
|
|
|
|
Shilpi Boosar wrote: 1) When you save your text file as unicode than the first two character is BOM character i.e. 255 244 (UTF-16 Little endian).
I never save files with BOMs. On occasion I have had to go out of my way to insure that it didn't show up in XML streams because some processors wont handle them. That is probably because I only use UTF8 streams though.
Shilpi Boosar wrote: 2) When you save your text file as UTF-8 than the first three character is 0xEF,0xBB,0xBF
Actually with UTF8 you should never use a BOM. UTF8 is a single byte encoding so by definition there can be no ordering.
Not to mention that the unicode site specifically says to not do that. Search for "byte order mark" in the following.
http://unicode.org/faq/utf_bom.html[^]
|
|
|
|