|
I am writing an application that upon the user pressing a funciton key the applicaiton is dispalyed. Even if the user is using another program and this key is pressed.
I have tried using the following functions but if I have notepad(or other app) maximized and press the button my appication does not come to top.
ShowWindow
BringWindowToTop
SetWindowPos
I have confirmed the hot key is being recognized by poping up a dialog box when it is pressed. I have confirmed the correct handle by using SetWindowPos to move the window. Is there another approach/function I should be using
Thank you,
SAK
|
|
|
|
|
One solution is ShowWindow().
ShowWindow(SW_RESTORE);
Kuphryn
|
|
|
|
|
I've made a horizontal scrollbar control using CreateWindowEx, and on the WM_HSCROLL event in the parent window I do this:
if (flag == SB_LEFT)<br />
{<br />
curPos -= 1;<br />
}<br />
<br />
else if (flag == SB_RIGHT)<br />
{<br />
curPos += 1;<br />
}<br />
<br />
else if (flag == SB_LINELEFT || flag == SB_PAGELEFT)<br />
{<br />
curPos -= 1;<br />
}<br />
<br />
else if (flag == SB_LINERIGHT || flag == SB_PAGERIGHT)<br />
{<br />
curPos += 1;<br />
}<br />
<br />
else if (flag == SB_THUMBTRACK || flag == SB_THUMBPOSITION)<br />
{<br />
curPos = position;<br />
}
Then using SetScrollPos(hWndScroll, SB_CTL, curPos, TRUE) I try to let the scrollbar be updated, but it doesn't seem to work. any ideas?
LPCTSTR Dutch = TEXT("Double Dutch ");
|
|
|
|
|
Hi.
I have a faulty app that I should restart whenever it crashes.
I can easily see when it's dead, since it creates a named mutex that disappear with the app.
My problem is that if the app crashes and shows a MessageBox
as this example:
The instruction at "0x004015b0" referenced memory at "0x00000000". The memory could not be "written".
Click on OK to terminate the program
Click on CANCEL to debug the program
Is there any way to avoid this? I can't modify the darned app's source code.
thanks in advance,
bye
M.
|
|
|
|
|
|
Thank you very much indeed, your answer is perfect for our needs.
marco
|
|
|
|
|
I have read many tutorial article here and now realized a mouse hook,Now I can get windows handle which mouse move over,but I don’t know how to get mouse right button click event.I want to prevent a special window's mouse right button click event,how I do?Please help me.
|
|
|
|
|
The subject says it all,
how can i receive all messages sent in system - like SPY does ?
Thank you very much!
|
|
|
|
|
|
Thank you, i'll take a look!
|
|
|
|
|
Hi
I have created a Dialog based application using VC++ 6.0. I have set the main dialog to NOT have a title bar and system menu. Unfortunately, this also remove the icon in the Windows taskbar when the application is running. Is there a way I can get round this problem? My endusers demand that the icon be seen next to the application name in the taskbar.
Thanks in advance
|
|
|
|
|
I removed the title bar and system menu in a test app I just wrote (I did it in the resource editor), and the icon still appeared on the task bar. All I had to do extra was make sure I called SetWindowText on the dialog with some meaningful text so the taskbar button wasn't blank.
Chris Richardson Terrain Software
|
|
|
|
|
Thanks for your quick reply.
I already did the SetWindowText call. Unfortunately, the icon in the taskbar only shows the text, not the picture (icon?) next to it (like MS Word or Exchange etc.). It is documented to only show the text if I have remove the System Menu. That's why I am looking for a workaround. Also, while the icon may be seen when you run your application in MSVC, it will not show the picture in the icon on another PC.
|
|
|
|
|
Hmm, sounds pretty strange. What styles are you using on your dialog? Also, if it will show on your PC but not on another PC this sounds like some strange difference in behavior between the two operating system setups.
Chris Richardson Terrain Software
|
|
|
|
|
|
Hi All
i have the following code which im using to find particualr
words within a string (m_tts_message), however the below
only works when there is only one string to search for, in this case its "truant", however i want it to search m_tts_message for several words not just one.
can ne1 help
thakns
si
char *pdest;
char str[] = "truant";
int result;
pdest = strstr( m_tts_message, str );
result = (int)(pdest - m_tts_message + 1);
if ( pdest != NULL )
AfxMessageBox("found");
else
AfxMessageBox("not found");
|
|
|
|
|
You said CString (which is a MFC and also a ATL classs) when instead you used char*.
With CString, it would look look somewhat like this:
CString m_tts_message("truantjflsdlflsdfjtruantjdsfölsdlkjfdlskflkjstruantkgökfkfksdöf");
CString str ("truant");
int found = 0;
int result = m_tts_message.Find(str, 0);
while (result != -1)
{
if (result>-1)
found++;
result = m_tts_message.Find(str, result+1);
};
if ( found>0 )
AfxMessageBox("found");
else
AfxMessageBox("not found"); }
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
hi, thanks for the reply
i think im confusing you,
if m_tts_message contains "your child is absent from school and is playing truant"
m_tts_message contains a message which schools will send to parents
of there child, however i need to restrict them from using certain words
or phrases theres about 20 different words which cannot be used
i need to scan that (m_tts_message) looking for any of the reseverd words or phrases; which cannot be used
so in the above case i would be looking for the words "truant" and "absent" to see if either of them can be found
so consider the problem with the reseverd words/phrases: truant| absent
not in school|not at school|truant|truanting|truancy
thanks is advance
si
|
|
|
|
|
si_69 wrote:
..need to restrict them from using certain words..
Such as f*beep*uck, cu*beep*nt and so on?
You could make a std::vector<std::string> of the list of forbidden words and use your algorithm size() times, keeping track of which word was found (and maybe where it was found).
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
Code looks okay. Post the code that does multiple searches.
Kuphryn
|
|
|
|
|
You need to do a seperate search for each word.
|
|
|
|
|
I have develop an SDI application where I have more that one
CView derived class and I switch them using the following
code:
CView* CMyDoc::SwitchToView(CView* pNewView)<br />
{ <br />
CFrameWnd* pMainWnd = (CFrameWnd*)AfxGetMainWnd();<br />
CView* pOldActiveView = pMainWnd->GetActiveView();<br />
ASSERT(pOldActiveView != NULL);<br />
ASSERT_VALID(pOldActiveView);<br />
<br />
ASSERT(pOldActiveView->GetDocument() == this);<br />
<br />
if(pNewView == pOldActiveView)<br />
{<br />
return NULL;<br />
}<br />
<br />
::SetWindowLong(pOldActiveView->m_hWnd, GWL_ID, 0);<br />
::SetWindowLong(pNewView->m_hWnd, GWL_ID, AFX_IDW_PANE_FIRST);<br />
<br />
pNewView->ShowWindow(SW_SHOW);<br />
pOldActiveView->ShowWindow(SW_HIDE);<br />
<br />
AddView(pNewView); <br />
RemoveView(pOldActiveView);<br />
pMainWnd->SetActiveView(pNewView);<br />
pMainWnd->RecalcLayout();<br />
<br />
return pOldActiveView;<br />
}
The problem is that windows messages are sent (by the framework)
only to the Default CView derived class (the one created with
Doc and Mainframe classes).
When a change View... the news one doesn't receive any windows
messages.
Which could be the problem ???
Thanks a lot!
|
|
|
|
|
Hi,
Can anybody help me with my problem?
How to load RTF file with pictures in CRichEditCtrl?
Thanks in advance !
|
|
|
|
|
Are you wanting to save the contents of a CRichEditCtrl to an RTF file?
|
|
|
|
|
Ok, here is what I know how to do and what I need to do:
I know how to insert picture (BMP) file in my CRichEdit.
I also know how to save the contents of the CRichEditCtrl as RTF file.
I need to load a RTF file with pictures (BMP) in it, in my CRicheEdit control,
but I don't know how to do that.
Can you help me?
Thanks!
Yasen
|
|
|
|