|
Dear friends,
I've a simple MFC application that only consists of a main window. What my application does is that, it launches MS-Word and makes MS-Word window as a child window of my main window.
When the focus is in MS-Word Window, 'operating system' makes its parent window (i.e my main window) as inactive and turns is titlebar as grey. It is so because, though MS-Word window is a child window of my main window, it runs in a separate process.
My main window only becomes active when i click on it. Now the problem is that i want to programatically activate my main window when user is typing in MS-Word window and presses Ctrl+P. My application uses Key board hooking to detect Ctrl+P.
The question is that how do i activate my main window????
I first tried SetActiveWindow API, but it didn't work MSDN doc says abt this API that :
The SetActiveWindow function activates a window, but not if the application is in the background
Obviously my application is in background when focus is in MS word window, so may be thats why this API is not working.
I also tried SetWindowPos and SetForegroundWindow but no result.
Can you suggest me that how do i activate my main window and bring it in the foreground with input focus.
Imtiaz
|
|
|
|
|
I think we have to send some post/send message but i don't know what it is
regards
.GAN.
|
|
|
|
|
Do you need to m_ListCtrl.SetItemState(with LVIS_SELECTED);
|
|
|
|
|
Look at here[^]. I think you'll find what you need.
Marc.
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
Hi to all,
In my program, I am only running a thread, that will open media file in read mode, read data from that file every sec & perform the operation on that every sec.
But when I run multiple instances (let 100 instances) of that thread to read same media file (i.e every sec I read same data in each instance of thread), it creates a problem. ( I think due to limitation of reading speed for Harddisk)
So, How I can read media file only once & get data available to thread instances for performing the operation on that data?
Plz , help me.
Thanks & Best Regards,
Aniket Salunkhe
|
|
|
|
|
i have a spellchecker and i want the following operation
when i choose some text my mouse (active selection od mouse )
what text have to check up with spellchecker text for that i feel
the selected text is copy and paste to text box of spellchecker and compare it
so plz suggest me the code
janan
|
|
|
|
|
The general solution to this is non-trivial (do a google on "screen readers" for more info). The reason is that the 3 major browsers all have different object models, so getting text from a browser window, or form, is quite difficult. Getting text from a "standard" windows app is not that difficult, but then you also have to consider .Net apps, whose on-screen elements are not based on standard HWNDs.
So for standard apps:
1. find the window, using something like WindowFromPoint()
2. determine type of window, using GetClassName()
3. use (2) and GetWindowText() to try to get the selected text
|
|
|
|
|
Hello.
I am creating an aplicaion in which I want some of the controls from TOOL BAR to be disabled by default. And I want them to be enabled when user takes some specific action.
How can I make the tool bar controls GRAYED or disabled by default?
Thanks and Regards
Rakesh
|
|
|
|
|
If u want to enable or disable the button from toolbar then use EnableButton().
e.g
CToolBar m_wndToolBar;
...
..
..
CToolBarCtrl& tbctrl = m_wndToolBar.GetToolBarCtrl ();
if(..)
tbctrl.EnableButton (ID_FILE_NEW,TRUE); // to enable
else
tbctrl.EnableButton (ID_FILE_NEW,FALSE); // to disable
Regards
Amar
|
|
|
|
|
See here if its good for you
<br />
m_wndToolBar.GetToolBarCtrl().SetState(ID_FILE_NEW,TBSTATE_ENABLED);<br />
m_wndToolBar.GetToolBarCtrl().EnableButton(ID_FILE_NEW,FALSE);<br />
|
|
|
|
|
Hi all,
In an SDI APP i am using a modeless dlg. I am creating the dlg in view class.
In view class im using a LinkList .
Now the Problem is i need to access the LinkList from the dlg . while Accessing the LinkList fn(append, del,...) I got an run time access violation
and then the application terminates.
How to resolve this problem.
any body knows...
by
GAN.
|
|
|
|
|
Try passing a pointer of your application to the dialog.
In the dialog you can create a pointer of your parent class and access the variables/member functions of the parent class with the help of that pointer.
You can do this:
in the dialog declare a pointer of view in the header file
CMyParentView *pView;
Now when you are creating the dialog
CMydialog* pMyDlg=new CMyDialog();
pMyDlg->pView=this;
pMyDlg->DoModal(); // Or in whatever manner you are creating the dialog.
In the dialog you can then access the member variables of the view like
pView->myLinkedList.///////Somecode or function here
Try this.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
thank you for suggession
when including view.h in dlg.h it got some error
so i shifted mylinklist to doc class
now it workes well
thank u once again for ur reply
|
|
|
|
|
|
Assume that each line of file have data as
aaaaa,bbbbb,ccccc,ddddd,eeeee,............
if want to keep the data of each part to variable such as
str1=aaaaa;
str2=bbbbb;
.......
What is the function or class that support this issue.
If not,Please give me a concept for write it.
Thanks
|
|
|
|
|
Read the data into a CString variable and then tokenize the string using
CString::Tokenize() using "," that seperates the values from each other.
Store each string in different one
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
The concept is called tokenization[^]. Take a look at the strtok function. It is easy to write one, at least to cope with the simple case described here.
The idea is search the source string for the first occurance of the separator. Your first part is the substring from the start until the character before the first separator. The "new start position" is now the character after the separator. Repeat the search from the new start position for the next separator.
Graham
My signature is not black, just a very, very dark blue
|
|
|
|
|
See
CString strextra;
int nPos=0;
CStringArray array;
CString str="aaaa,bbbb,cccc,dddd,eeee,ffff";
if(str[str.GetLength()-1]!=',')
str.Insert(str.GetLength(),",");
while (str.GetLength()!=0)
{
nPos = str.Find(",");
strextra= str.Left(nPos);
array.Add(strextra);
str.Delete(0,nPos+1);
}
</code>
|
|
|
|
|
Hi all,
I am in a task of making a Registry Cleaner.
But I hve some questions to be answered about this project. Those are
1) What are the steps involved in Registry Cleaning ?
2) What all can be cleaned ?
3) What all should not be done ?
4) How do we clean a particular Key ?
5) What are the different operations involved ?
6) Do we have the technology to implement all the operations ?
7) Can we automate all the operation if you have a database of
things to be cleaned?
8) Where do we get the list of database of things to be cleaned ?
Please Help me.
Thanks in Advance
George K Jolly <georgekjolly@yahoo.com>
|
|
|
|
|
Seehere[^]if its good for you
|
|
|
|
|
hello everyone,
I have a small problem in VC++.i want to get the index value for the tree item of a tree control.i have used the class CTreeCtrl class but i couldn't find any method which returns the index value.
so quickly help me with a solution
sathish
|
|
|
|
|
See CTreeCtrl::GetSelectedItem
|
|
|
|
|
I think there is no functions are avaliable for that.
You should iterate your tree items with GetNextItem() method.
Just try...
|
|
|
|
|
A tree control item doesn't have an index, since the tree doesn't represent a simple linear list. Each item in the tree has a handle. Using that handle, there are methods provided by the CTreeCtrl that you can use to change the item itself, get the child items, and so on.
Software Zen: delete this;
|
|
|
|
|
GetChildItem and related SiblingsApi
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|