|
Flace wrote:
Is there a way to disable perforce integration in visual studio 6?
There is a registry setting to disable any source control system integration.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
Nemanja Trifunovic wrote:
There is a registry setting to disable any source control system integration.
And what is that please?
|
|
|
|
|
Flace wrote:
And what is that please?
Believe me, I would have told you already if I remembered
Each time I (re)install Windows I forget where this setting is, and then spend time trying to find it out
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
What is the difference between LP and DP?.When do I have to use DPtoLP and LPtoDP function?.
NSS
|
|
|
|
|
The difference regards the sense of transformation between the device units and the logical units.
1) You use LPtoDP to map the coordinates of each point, or dimension of a size, from the device coordinate system into GDI’s logical coordinate system. This depends on the current mapping mode and on the settings of the origins and extents for the device’s window and viewport.
2) You use DPtoLP to do the mapping from GDI’s logical coordinate system into the device coordinate system.
SkyWalker
-- modified at 3:30 Monday 10th October, 2005
|
|
|
|
|
Can I call GetClientRect() to retrieve the size of the list window ( a child control to the dialog) in the constructor of the dialog box.
Example:
CMyDialog::CMyDialog()
{
CRect rect;
m_List.GetClientRect(&rect);
}
Normally, the function is invoked in the InitDialog() function?. I am bit confused about this.
thanks for help in advance
NSS
|
|
|
|
|
No,You can call the function only after your control is created.
|
|
|
|
|
Probably you are interested in doing something like this in the constructor:
CListCtrl *pW = (CListCtrl *)GetDlgItem(IDC_LIST1);
CRect rc;
if ( pW )
{
pW->GetClientRect(&rc);
int z = 1;
}
When executing the first line, you come to the following assertion: ASSERT(::IsWindow(m_hWnd)) which actually tells you that the child window is not a window yet.
That is why you have to place the code in OnInitDialog()
SkyWalker
-- modified at 3:10 Monday 10th October, 2005
|
|
|
|
|
|
Thanks for your help.
NSS
|
|
|
|
|
I want a fucntion to generate a random number between 0 and 1, and each time this function is executed, it will give me a diffent value (independent to time).Can you help me?Thanks a lot.
|
|
|
|
|
|
rand()/RAND_MAX.
Not exactly working. Integer arithmetic here.
-- modified at 14:13 Monday 10th October, 2005
|
|
|
|
|
The best you can hope for is a pseudo-random number. Use rand() for this?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I want to get a random number between 0 and 1.Can you help me?Thanks a lot.
|
|
|
|
|
Did you try the rand()[^] function? It returns an int, but you can always divide the resulting int by pow(10, sizeof(int) + 1) to get a number between 0 and 1.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
std::rand() / (double)RAND_MAX gives a uniformly distributed random number in range [0...1]. Following function gives a uniformly distributed value in half-open range [lo…hi).
template <typename T>
inline T random(T lo, T hi)
{
return (T)(lo + (__int64)std::rand() * (hi - lo) / (RAND_MAX + 1));
}
Seppo
-- modified at 9:09 Monday 10th October, 2005
|
|
|
|
|
How about 1 divid by the system generated random number?
So, if the system generated number is
10 => 1/10 = 0.1
100 -> 1/100 = 0.01
& etc.
|
|
|
|
|
Hi,
I have a dialog that I have created through MFC wizard in which I have a CStatic control placed. I do not want minimize/maximize button in the dialog, however I want the window to be maximized when I clicked on minimized dialog and minimized when I click on the activated window icon in the status bar in Windows Explorer.
Can anyone suggest How I can implement this?
I am new to MFC so apologies if this question seems too trivial!!
Thanx in advance.
Mandira T
|
|
|
|
|
Hi Mandira,
I was working around your problem.
I have tried doing it using WM_SIZE message..but am not able to get the exact results.
then i tried doing it using MoveWindow function
void CMinMaxDlgDlg::OnButtonMaximize()
{
// TODO: Add your control notification handler code here MAX
CRect rect;
CWnd* pWnd = GetDesktopWindow();
pWnd->GetClientRect(rect);
MoveWindow(0,0,rect.Width(), rect.Height(),TRUE);
}
this code will make ur dialog box size same as that of desktop window
now if u want to restore it to the original state then u will have to store the original length, width and start x and y coordinates of dialog box.
thn handle it in OnButtonResize() function likt this
OnButtonResize()
{
MoveWindow(startx, starty , initialwidth, initialHeight, TRUE);
}
but am not able to minize it completely
Let me know if this helps you !
Ashwin
|
|
|
|
|
I understand you want to click the title bar to maximize the dialog on the screen, then you want to click the icon in the task bar to retrieve the original size and position of the dialog.
For that you have to do the following:
Declare the following handlers for your dialog class:
====================================================
afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
afx_msg void OnActivateApp(BOOL bActive, HTASK hTask);
Add the following message map entries:
=====================================
ON_WM_NCLBUTTONDOWN()
ON_WM_ACTIVATEAPP()
Call GetStartRectangle() within OnInitDialog()
Declare and define the following:
====================
void CYourDlg::GetStartRectangle()
{
CRect rcArea;
int w, h;
SystemParametersInfo(SPI_GETWORKAREA, 0, &rcArea, 0);
GetWindowRect(&m_rcInitial);
w = m_rcInitial.Width();
h = m_rcInitial.Height();
m_rcInitial.left = (rcArea.left + rcArea.right) / 2 - w / 2;
m_rcInitial.right = m_rcInitial.left + w;
m_rcInitial.top = (rcArea.top + rcArea.bottom) / 2 - h / 2;
m_rcInitial.bottom = m_rcInitial.top + h;
}
void CYourDlg::Maximize()
{
CRect rcArea;
SystemParametersInfo(SPI_GETWORKAREA, 0, &rcArea, 0);
MoveWindow(&rcArea);
}
void CYourDlg::Minimize()
{
MoveWindow(&m_rcInitial);
}
void CYourDlg::OnNcLButtonDown(UINT nHitTest, CPoint point)
{
if ( nHitTest == HTCAPTION ) Maximize();
CDialog::OnNcHitTest(point);
}
void CYourDlg::OnActivateApp(BOOL bActive, HTASK hTask)
{
Minimize();
}
SkyWalker
-- modified at 5:47 Monday 10th October, 2005
|
|
|
|
|
Hello:
I am a little project where I have to take RichText(RTF) input, and then draw it out using GDI+. The user able to change text format in middle of the text string just like VISIO 2003. The RTF able to rotate and translate using GDI+. If anyone know about any article or code snipe that I could look at it.
Thank You.
|
|
|
|
|
Is it good programming, blocking of thread with event->Lock() instead of using
::WaitForSingleObject() function.
NSS
NSS
|
|
|
|
|
sthalasayanam wrote:
event->Lock()
Is a MFC way to force Thread in Waiting state and..
sthalasayanam wrote:
::WaitForSingleObject() function.
It Is win32 way to Force Wait for thread....
About good Programming practice.. it depends on company to company... as both are equally good.
"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
|
|
|
|
|
Well, the ::WaitForSingleObject API function is more versatile, in the sense that it accepts a variety of handles and works for all of them.
That said, if all you want is event based waiting, you might as well use CEvent and Lock.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|