|
Let CPopDlg is PopUp Window for your Dialog class with Dialog Template(IDD_POPUP ), make a EditBox on that Popup and Make it Variable Public viz. m_strPopupEdit (type CString );
now onCLick Event of Button on Dialog Box
this->UpdateData();
CPopDlg dlg;
<code>dlg.m_strPopupEdit=this->m_edit1</code>
dlg.Create(IDD_POPUP, this);
dlg.ShowWindow(SW_SHOW);
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
i'm trying to enumerate the same application that appear on the ALT-TAB or on the Applications Tab of the TaskManager.
but as you know the EnumDesktopWindows "give" me more windows than the ones i need.
the problem is that i am having a hard time filtering the windows
does anyone know the way to filter (discard) the windows that i get in order to have only the ones in ALT-TAB?
"There is no sin in making an error - we all do, and that's how we learn. Sin lies in letting stand an error, once we discover it, without correcting it." Roger Wright
|
|
|
|
|
After You get Handle Of Desktop Window Use Api IsWindowVisible api to determine that Window is Visible on Desktop or NOT.
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
Dear all,
What is the fastest way to locate the focused item in CListCtrl object?
BRs
|
|
|
|
|
GetSelectionMark().
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Thanks Tom,
While waiting for your replies, I found a solution. That is GetNextItem(-1, LVIS_FOCUSED)
Thanks anyway.
BRs
|
|
|
|
|
Just wandering why the CListCtrl::GetFirstSelectedItemPosition() is not good enough ?
|
|
|
|
|
Because I wanted to find the focused item, not selected item. By using GetNextItem(), I can directly locate the focused item and that's what I needed.
BRs
|
|
|
|
|
hi
Does anyone know how to create html file from a c++ program (MFC)? I am working on a program where i have to generate a report from some database and should be able to print it. so i was thinking of creating report in html file which will be easier to format and print too. but i looked everywhere for some tutorials or any articles... no luck ..
have anyone done something similar? can someone help???
links for tuts or projects anything
thanks
zlich
|
|
|
|
|
The most basic way is to open a text file, write out HTML to it, and close it. If you don't know how to write HTML though, this isn't going to be too easy... but then, neither is anything else i could suggest. Some reporting packages will output to HTML, but if you're using a reporting package then you already have formatting/printing built-in.
Shog9
I'm not the Jack of Diamonds... I'm not the six of spades.
I don't know what you thought; I'm not your astronaut...
|
|
|
|
|
that.s not a very big task,just create the file name by using the .htm or .html extension,n then everything is as simple as creating a html page.for html you could check any site(lots of examples are available).
|
|
|
|
|
I'm trying to convert a Ctring that I read from an edit box into a float.
Here's the code I've got;
CString result;<br />
double d1;<br />
<br />
GetDlgItemText(IDC_EDIT1, result);<br />
char *txt = (char *) (LPCTSTR) result;<br />
d1 = atof(txt);<br />
When I display txt I do see the correct decimal number, unfortunately d1 is truncated after to the first digit. I.e. if I enter 26.5 in the edit box (IDC_EDIT1), txt is 26.5 but d1 is only 2.
What I am doing wrong here?
Is there any easier way of reading a float from an edit box?
Cheers,
Pat.
|
|
|
|
|
Try something along the lines of
sscanf(txt, "%f", d1);
txt is your string, d is your floating point.
|
|
|
|
|
Well you could always set a member variable for IDC_EDIT1 to a value as float. Thne no conversions would need to be made.
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Thanks! I had done it originally but completely forgot to update the data, so it wouldn't work. It does now!!!
Cheers,
Pat.
|
|
|
|
|
Just for the sake of completness, I decided to throw this in after so many weeks:
Boost.org has its lexical cast http://www.boost.org/libs/conversion/lexical_cast.htm[^] which comes in handy whenever you are tempted to use those grizzled and outdated old C-library functions.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
i personally prefers sscanf_s function,its more reliable
|
|
|
|
|
How would I go about tracking mouse movement outside the window?
Currently OnMouseMove would only track the mouse within the windows.
|
|
|
|
|
- call GetCursorPos() in a loop (easy, but very bad idea)
- write a hook
- use DirectInput
there should be other possibilities, but those are the ones I remember right now.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Calling the SetCapture(HWND hWnd) API function will exclusivley send all mouse events to 'hWnd' regardless of whether they occur within the window or outside. Remember to call ReleaseCapture when done.
|
|
|
|
|
Hi people,
Maybe someone can help me. I have a CDialog derived class in a CToolbar, but I can't get the toolbar to resize to accomodate the dlg. Does anyone have an idea?
|
|
|
|
|
I've created a UI thread and I want my main app to send a message to it. So in my main app I make a call to PostThreadMessage.
In the message map of my UI thread I have:
<br />
BEGIN_MESSAGE_MAP(CMyThread, CWinThread)<br />
ON_THREAD_MESSAGE(UWM_STOPTHREAD, OnStopThread)<br />
END_MESSAGE_MAP()<br />
However when I post my message to the thread it never reaches the OnStopThread function that I created. Also I get an error if my function is set like this:
<br />
LRESULT CMyThread::OnStopThread(WPARAM wParam, LPARAM lParam)<br />
{<br />
AfxMessageBox("OnStopThread");<br />
m_sConnectSocket.Close();<br />
PostMessage(myHandle->m_hWnd,UWM_DISCONNECTED, 0, (LPARAM)&thdID);<br />
ExitInstance();<br />
return true;<br />
Where it returns an LRESULT. If I take this out and make it a void then it compiles fine but still does not work.
Here is the error I'm getting:
MyThread.cpp(55) : error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall CMyThread::* )(WPARAM,LPARAM)' to 'void (__thiscall CWinThread::* )(WPARAM,LPARAM)'
I'm thinking of just putting a PeekMessage in the PreTranslateMessage and do my calls from here, but from what I've read on flounder.com, this is not a good idea.
Any suggestion please
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Tom,
here are two extracts from one of my class (I have removed all unrelated code) that does similar things and works well. Just verify you've got all declarations and definitions right. May be this will help.
Regards,
Serge Krynine
Header File:
class CLogDocument : public CWinThread
{
DECLARE_DYNAMIC(CLogDocument)
enum EThreadMessage
{
WM_ON_LOG_MESSAGE = WM_USER + 1000
};
afx_msg void OnLogMessage(WPARAM nWparam, LPARAM nLparam);
DECLARE_MESSAGE_MAP()
}; // class CLogDocument
Source File:
///////////////////////////////////////////////////////////////////////
IMPLEMENT_DYNAMIC(CLogDocument, CWinThread)
///////////////////////////////////////////////////////////////////////
BEGIN_MESSAGE_MAP(CLogDocument, CWinThread)
ON_THREAD_MESSAGE(EThreadMessage::WM_ON_LOG_MESSAGE, OnLogMessage)
END_MESSAGE_MAP()
///////////////////////////////////////////////////////////////////////
CLogDocument::~CLogDocument()
{
CWinThread::PostThreadMessage(WM_QUIT, 0, 0);
}
///////////////////////////////////////////////////////////////////////
bool CLogDocument::LogMessage(CString const& rstrMessage)
{
DWORD nResult = CWinThread::PostThreadMessage(EThreadMessage::WM_ON_LOG_MESSAGE,
reinterpret_cast<wparam>(pstrMessage),
NULL);
}
///////////////////////////////////////////////////////////////////////
void CLogDocument::OnLogMessage(WPARAM const nWparam, LPARAM const /*nLparam*/)
{
}
|
|
|
|
|
I have mine setup the same way, but it still does not work. The only difference is the way I'm posting my message to my thread...could that be it?
<br />
if (!PostThreadMessage((DWORD)hdi.lParam, UWM_STOPTHREAD, 0 , 0))<br />
{<br />
CString MyMsg;<br />
MyMsg.Format("Error posting message to thread: %s", m_lClientConn.GetItemText(i, 3));<br />
AfxMessageBox(MyMsg);<br />
}<br />
I'm going to try it your way and see if it makes a difference.
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Hi.
In a CScrollView as far as I realised the GetClientRect returns the size of the physical page of the view. Howe can I alter programatically that size? How can I expand the client area to fit a larger design? What will happen with the co-ordinate system and how do I correct it?
Pls help as I am desperate to deliver something Thanks
|
|
|
|