|
In a dialog based application, I draw a rectangle with
CRectTracker. But when i close a sub-window, the part of the drawed rectangle (the part of the covered) also disappeared. Why ?
The following is my code:
BOOL CMYDlg::PreTranslateMessage(MSG* pMsg)
{
switch (pMsg->message)
{
case WM_LBUTTONDOWN:
{
if (pMsg->hwnd == GetSafeHwnd())
{
CPoint pt;
pt.x = GET_X_LPARAM(pMsg->lParam);
pt.y = GET_Y_LPARAM(pMsg->lParam);
if(GetAsyncKeyState(VK_SHIFT) < 0)
{
CRect re(pt, pt);
CRectTracker rt(re, CRectTracker::solidLine | CRectTracker::resizeOutside);
if (rt.TrackRubberBand(this, pt, TRUE))
{
CDC* pDC = GetDC();
rt.Draw(pDC);
CSetRect dlg;
dlg.m_rectleft = rt.m_rect.left;
dlg.m_rectright = rt.m_rect.right;
dlg.m_recttop = rt.m_rect.top;
dlg.m_rectbottom = rt.m_rect.bottom;
if(dlg.DoModal() == IDOK)
{
OnSaveRectInfo(dlg.m_rectleft, dlg.m_rectright, dlg.m_recttop,dlg.m_rectbottom);
}
}
return TRUE;
}
break;
default: break;
}
return CDialog::PreTranslateMessage(pMsg);
}
xyz
|
|
|
|
|
IMHO, you are doing far too much work in PreTranslateMessage. if you want to handle a mouse down event, override the appropriate function (OnButtonDown, i think); if you want to paint something, override OnPaint. PreTranslateMessage isn't supposed to be used as a place to do Win32-style message loop programming.
-c
<font size=-2>
o(int O){putchar(O);}main(){float l[8],O,I=.05;char _;for(l[6]=15;l[6]<':';o
(10),l[5]=-'$'*I+l[6]++*I)for(l[7]=-5;l[7]<'@';l[4]=-'('*I+l[7]++*I,o(_?'?':':'))for
(*l=O=0,_=1;++_&&((l[2]=*l**l)+(l[3]=O*O)<4);O=*l*O+l[5]+O**l,*l=l[2]-l[3]+l[4]);}</font>
|
|
|
|
|
I'm trying to get the profiler working ( again ! )on my project but as usual with the profiler, it does not work very well ...
any idea why I get this error ?
PREP : fatal error PRF1011: cannot open file c:\project\my_project\full_profile_release\my_project.pbo
and from MSDN, prf1011 doesn't give more info ...
who/what is supposed to generate that file ? isn't supposed to be automatic when
started from the IDE ?
I also tried using the shell ( cmd ) to run the profile ( with the ftime.bat ) but , bummer, it doesn't work ....
any ideas
Thanks.
Max.
|
|
|
|
|
Have you enabled generating the map file on your release build?
If i remember right, the initial PREP phase requires the .map files to generate the .pbi which PROFILE processes to create the .pbo files. Finally, PREP is run again with the /M switch to consolidate all the .pbo files into a single .pbt file.
I've played with the command line version a while ago & this is the template FTIME.bat that i used to get it to work.
PREP /OM /FT /EXC nafxcwd.lib /INC File1.cpp /INC File2.cpp MyApp
if errorlevel == 1 goto done
PROFILE MyApp
if errorlevel == 1 goto done
PREP /M MyApp
if errorlevel == 1 goto done
PLIST /ST /T MyApp >MyApp.txt
:done
Chen Venkataraman
|
|
|
|
|
Hi all
In my application I'm having two toolbars.
When I create second one, framework inserts it in new row, but I want it
to be placed on the right of the first one.
I tried to use DockControlBar() providing lpRect parameter, but it makes no difference.
Of course I can drag second toolbar with mouse, but I don't know how to do this
programatically.
Thx in advance
|
|
|
|
|
|
I am trying to automate an application which contains tabular data. This data when sent to a Word application manages to push the table onto the next page, but not in PowerPoint. I end up having a huge table which cannot be viewed entirely in a single slide.
Is there any way to make the automation controller smart enough to split the table during export?
Does anyone have any other solution?
|
|
|
|
|
Does anybody knows how to change text label (caption) of the radio buttons ?
Good sample will be very nice to see .. !
thanks a lot !
|
|
|
|
|
Suppose you have a radio button (id is IDC_RADIO1) and another radio button (IDC_RADIO2). You could code something like this:
void CMyTestDlg::ChangeCaption()
{
CWnd* pWnd = GetDlgItem(IDC_RADIO1);
pWnd->SetWindowText("Choice_001");
pWnd = GetDlgItem(IDC_RADIO2);
pWnd->SetWindowText("Choice_002");
}
Maxwell Chen
|
|
|
|
|
GetDlgItem(IDC_RADIO_WHATEVER)->SetWindowText("New Label");
|
|
|
|
|
Thanks a lot !
it works perfect .
And another one question - how can i to show / hide Radio buttons elements on the dialog ?
thank you !
|
|
|
|
|
GetDlgItem(IDC_RADIO_BUTTON)->ShowWindow(false);
I think this is the way I normally do it.
Best Regards
Søren Madsen
Denmark
|
|
|
|
|
Hello!
I'm trying to record a metafile under Gdi+ somehow into MEMORY, but all the constructors for Gdiplus::Metafile require a filename!
There is however one constructor which allows the metafile to be recorded into an IStream interface. I was thinking that perhaps such an object could be written that would stream the data into a memory buffer via an IStream interface.
<br />
Metafile::Metafile(IStream* stream, HDC referenceHdc, Rect& frameRect, MetafileFrameUnit frameUnit, EmfType type, WCHAR* description)<br />
<br />
Creates a Metafile object for recording to an IStream interface.<br />
Does anyone know how this is possible? Perhaps some atl / com code? I need this for a Visual C++ 6.0 Mfc app.
Thanx a bunch! I really appreciate your help .
Cheers,
swinefeaster
Check out Aephid Photokeeper, the powerful digital
photo album solution at www.aephid.com.
|
|
|
|
|
Hi ya all!
The following code i supposed to create a window inside another window.
m_Page.CreateEx(WS_EX_LEFT | WS_EX_TOPMOST,
AfxRegisterWndClass(CS_CLASSDC),
_T(""), WS_VISIBLE | WS_CHILD, rcClient.left, rcClient.top,
rcClient.Width(), rcClient.Height(), m_hWnd, NULL);
The window is created at program start (I'm able to paint in it), but at close I get;
"Unhandled exception at 0x77f7f570 in kalender.exe: User breakpoint."
Which point to;
"77F7F570 int 3" in Disassembly
If the mousepointer is in this window at program start it show a hourglass, until the pointer is moved outside this window.
Thankfull for all your help
/DrZOO
___________________
Chics are for fags!
|
|
|
|
|
Hi There.
I have a very easy question Do there exists any API function or so, in MFC/Windows that can return with a language string, if it receives a language ID? For instance:
LanguageID2String(0x09) will then return "English"
I know that there must be a function like this, but I can't find it. Can you help me?
Thanks in advance,
Best Regards
Søren Madsen
Denmark
|
|
|
|
|
IMultiLanguage *pML;
HRESULT hr = CoCreateInstance(CLSID_CMultiLanguage, NULL, CLSCTX_ALL, IID_IMultiLanguage, (void**) &pML);
hr = pML->GetRfc1766Info(0x09, &info);
You may enumerate all locales with:
IMultiLanguage *pML;
HRESULT hr = CoCreateInstance(CLSID_CMultiLanguage, NULL, CLSCTX_ALL, IID_IMultiLanguage, (void**) &pML);
IEnumRfc1766 *pEnumerator;
hr = pML->EnumRfc1766(&pEnumerator);
RFC1766INFO info;
ULONG nRet;
while (SUCCEEDED(hr))
{
hr = pEnumerator->Next(1, &info, &nRet);
if (SUCCEEDED(hr))
{
CString str(info.wszLocaleName);
TRACE(str + "\n");
}
}
Hope that helps.
|
|
|
|
|
If you have IE 5.5 or later, you may use HRESULT LcidToRfc1766(LCID locale, LPTSTR pszRfc1766, int nChar); The previously posted example should work with IE 4.0 according to MSDN.
|
|
|
|
|
Hi Niklas
Thank you very much for your help, and example. I really looks nice, and I am sure that it will help my further in the project.
Best Regards
Søren Madsen
Denmark
|
|
|
|
|
There are always simpler ways to do things Either one of
::GetLocaleInfo(0x09, LOCALE_SENGLANGUAGE, szBuf, 256);
::GetLocaleInfo(0x09, LOCALE_SLANGUAGE, szBuf, 256); will do, depending on what info you need. I've had this thing on my mind all day, so I had to investigate it further. I knew there must be something for this in the windows API. Well, it wasn't harder than this
|
|
|
|
|
When trying to use my ActiveX control in Visual C++, I noticed that when inserting the control in the dialog the control will not be created which causes the m_hWnd to be NULL which causes problems in my control behavior at design time. What shall I do to overcome this problem? Any ideas?
Daed
|
|
|
|
|
Hi,
Can somebody give me code for VC++ and linux (C) where
my linux module recv a file and VC++ module sends a file.
I've developed it but the problem is that if i transfer
JPG files.. the files are getting distorted..
Any hints and snipplets would be a great help
Thanx
|
|
|
|
|
I´m having problems getting the my process handle, using GetCurrentProcess() I always
get 0xfffffff... back. I need to get my own process handle to pass on to a watchdog process to monitor, has anyone any idea how to get to grips with this problem ?
ps, I´m using ATL/WTL and API NO MFC
|
|
|
|
|
The return value is a pseudo handle , to get the real handle use GetCurrentProcess() with DuplicateHandle() or call to OpenProcess()
|
|
|
|
|
Thanks, I used the following code
HANDLE hHandle;
DuplicateHandle(GetCurrentProcess(), GetCurrentProcess(), GetCurrentProcess(), &hHandle, PROCESS_ALL_ACCESS | STANDARD_RIGHTS_REQUIRED |THREAD_ALL_ACCESS, FALSE,NULL);
CloseHandle(hHandle);
That worked...
|
|
|
|
|
The 0xff thing is correct as in the doc however u may want to use the PID instead i.e. GetCurrentProcessId()
Until the process terminates, the process identifier uniquely identifies the process throughout the system
|
|
|
|