|
dellthinker wrote: int main(i)
What's this?
dellthinker wrote: printf("Failed because: %s", GetLastError());
Should be:
printf("Failed because: %lu", GetLastError());
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Is "notpad.exe" the app you want to run?
Also you need to pass something to those last two parameters, especially the
last one, since there's some handles returned that need to be freed.
STARTUPINFO StartupInfo;
memset(&StartupInfo, 0, sizeof(STARTUPINFO));
StartupInfo.cb = sizeof(STARTUPINFO);
PROCESS_INFORMATION ProcessInformation;
if (0 == ::CreateProcess(_T("C:\\Windows\\system32\\notepad.exe"),
NULL,
NULL,
NULL,
FALSE,
NORMAL_PRIORITY_CLASS,
NULL,
NULL,
&StartupInfo,
&ProcessInformation
))
{
TRACE1("Failed because: %lu", ::GetLastError());
}
else
{
::CloseHandle(ProcessInformation.hProcess);
::CloseHandle(ProcessInformation.hThread);
}
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
Hi for all
I'm developing a single MDI app. I have the following matter:
When I click the close button on the parent window, teorically it will send a WM_CLOSE and process the PostQuitMessage(0). But this is not occuring.
What I really want to know is how can I close and MDI app carrectly.
Look at the code below. This is the code of a class that I've create to create windows:
<br />
<br />
WPARAM TemplateWindow::MessageLoop()<br />
{<br />
while(!m_bQuit)<br />
{<br />
if(PeekMessage(&msg, m_hwnd, NULL, NULL, PM_REMOVE))<br />
{<br />
if(msg.message == WM_QUIT)<br />
{<br />
if(m_uiType == MDI)DestroyWindow(m_hwndFrame);<br />
m_bQuit = true;<br />
break;<br />
}<br />
else<br />
{<br />
if(m_uiType == MDI)<br />
{<br />
if(!TranslateMDISysAccel(m_hwndFrame, &msg))<br />
{<br />
TranslateMessage(&msg);<br />
DispatchMessage(&msg);<br />
}<br />
}<br />
if(m_uiType == SDI)<br />
{<br />
TranslateMessage(&msg);<br />
DispatchMessage(&msg);<br />
}<br />
}<br />
}<br />
else<br />
if(m_uiChildCount > 0)<br />
{<br />
SendMessage(childsInfo[0].hwnd, WM_PAINT, NULL, NULL);<br />
<br />
}<br />
SwapBuffers(m_hdc);<br />
}<br />
return msg.wParam;<br />
}<br />
This is my code in the callback of the main window:
<br />
LRESULT CALLBACK MainWindowCallback(HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam)<br />
{<br />
HMENU hMainMenu;<br />
hMainMenu = CreateMenu();<br />
static int siRuler = IDM_NEWRULER, siText = IDM_NEWTEXT, siNodule = IDM_NEWNODULE, siPath = IDM_NEWRULERPATH;<br />
switch(uiMessage)<br />
{<br />
case WM_CREATE:<br />
{<br />
...<br />
break;<br />
}<br />
case WM_CLOSE:<br />
{<br />
delete TextMenu;<br />
delete RulerMenu;<br />
delete PathMenu;<br />
delete NoduleMenu;<br />
delete ProceedingMenu;<br />
delete ScreenShotMenu;<br />
PostQuitMessage(0);<br />
break;<br />
}<br />
...<br />
default: return DefFrameProc(hwnd, g_hwndClient, uiMessage, wParam, lParam);<br />
}<br />
}<br />
The WM_CLOSE message is processed, BUT the PostQuitMessage(0) not. It process some part of this function. I'm debugging the app and when it enters in this part:
7E419483 call 7E418860
The app doesn't process, it doesn't freeze, just doesn't continue to process other register.
Anyone can help.
|
|
|
|
|
You post the quit message before you destroy the window
and exit the message loop before the window is destoyed.
From WM_CLOSE, you should call DestroyWindow(). Then when you get
the WM_DESTROY message, call PostQuitMessage.
Also, your message loop is really inefficient. You should use GetMessage(), not PeekMessage().
Also, why are you sending invalid WM_PAINT messages directly to windows? You should never
send a WM_PAINT message.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark, the window is destroyed, but when I look in the task manager the process continues in there. Do I need to close the mdi childs first? One of them is create with the RichEdit style. Is there a relation between the loaded dll("RichEd20.dll") and this fact?
I putting the PeekMessage because in the RenderHwnd(an HWND that modified to receive OpenGL), I have some images that should be show in this window.
I'm sending the WM_PAINT because if I don't do this, the RenderHwnd remains static, the WM_PAINT message is just processed if I move the window. Because this fact occurs, I send the WM_PAINT.
|
|
|
|
|
There's MANY messages that need to be processed before the windows are completely destroyed.
You are exiting your message loop before these are processed.
As far as the process not ending, I have no idea what you do after your message loop terminates.
Again, you should NEVER send a WM_PAINT yourself. There are other ways to properly mark a window
for repainting. See InvalidateRect(), UpdateWindow(), RedrawWindow(), etc.
Your message loop is VERY inefficient (well, it should be efficient at using all your CPU cycles).
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Right, can you say what messages I need to handle to increase the code?
|
|
|
|
|
Except for messages you need to handle, the default window proc is fine.
The point is they'll never get processed if you exit your message loop.
Here's an example of what I'm talking about - problems/changes marked in red.
Note where I put PostQuitMessage() and where DestroyWindow() is called.
WPARAM TemplateWindow::MessageLoop()
{
<font color="Red"> while(GetMessage(&msg, m_hwnd, NULL, NULL))
</font> {
if(m_uiType == MDI)
{
if(!TranslateMDISysAccel(m_hwndFrame, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
if(m_uiType == SDI)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
<font color="Red">
}</font>
return msg.wParam;
}
LRESULT CALLBACK MainWindowCallback(HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam)
{
HMENU hMainMenu;
hMainMenu = CreateMenu(); <font color="Red">
static int siRuler = IDM_NEWRULER, siText = IDM_NEWTEXT, siNodule = IDM_NEWNODULE, siPath = IDM_NEWRULERPATH;
switch(uiMessage)
{
case WM_CREATE:
{
...
<font color="Red">
break;
}
case WM_CLOSE:
{
delete TextMenu;
delete RulerMenu;
delete PathMenu;
delete NoduleMenu;
delete ProceedingMenu;
delete ScreenShotMenu;
<font color="Red">
return DefFrameProc(hwnd, g_hwndClient, uiMessage, wParam, lParam);</font>
}
<font color="Red">case WM_NCDESTROY:
PostQuitMessage(0);
break;</font>
...
<font color="Red">default:
break;</font>
}
<font color="Red">return DefFrameProc(hwnd, g_hwndClient, uiMessage, wParam, lParam);
}</font>
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Well Mike, I made the changes that you said to me, nut unhapilly it doesn't work. Any other suggestion?
Thanks for the support man.
|
|
|
|
|
I'm Mark
How far is it getting? If you set a breakpoint in your WM_CLOSE handler, does it get there?
How about WM_NCDESTROY?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Either the WM_CLOSE and the WM_NCDESTROY stops on the place that I show to you.
The code below is the code when it's debugged.
<br />
7E41DACF push 0<br />
7E41DAD1 push 0Ch<br />
7E41DAD3 pop edx<br />
7E41DAD4 lea ecx,[ebp-0Ch]<br />
7E41DAD7 mov dword ptr [ebp-0Ch],edi<br />
7E41DADA call 7E4194A4 <==that is the place where it stops<br />
<br />
This thing is confusing my brain.
|
|
|
|
|
Heh. I have NO idea where that assembly code is
Can you post the code for your current message loop and your
window procedures for the frame and the child windows?
I'd be happy to look at it, but witout it I can only guess.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Sure, I post now.
The first code is for the message loop:
<br />
WPARAM TemplateWindow::MessageLoop()<br />
{<br />
while(!m_bQuit)<br />
{<br />
if(PeekMessage(&msg, m_hwnd, NULL, NULL, PM_REMOVE))<br />
{<br />
if(msg.message == WM_QUIT)<br />
{<br />
if(m_uiType == MDI)DestroyWindow(m_hwndFrame);<br />
m_bQuit = true;<br />
break;<br />
}<br />
else<br />
{<br />
if(m_uiType == MDI)<br />
{<br />
if(!TranslateMDISysAccel(m_hwndFrame, &msg))<br />
{<br />
TranslateMessage(&msg);<br />
DispatchMessage(&msg);<br />
}<br />
}<br />
if(m_uiType == SDI)<br />
{<br />
TranslateMessage(&msg);<br />
DispatchMessage(&msg);<br />
}<br />
}<br />
}<br />
else<br />
if(m_uiChildCount > 0)<br />
{<br />
SendMessage(childsInfo[0].hwnd, WM_PAINT, NULL, NULL);<br />
}<br />
SwapBuffers(m_hdc);<br />
}<br />
return msg.wParam;<br />
}<br />
And the following codes is the callback for my windows. Look at the codes. Again, thanks for your help.
<br />
#ifndef CALLBACKS_H<br />
#define CALLBACKS_H<br />
#include <windows.h><br />
#include <stdio.h><br />
#include <RichEdit.h><br />
#include <time.h><br />
<br />
WindowInfo windowInfos;
GLUquadricObj * Cilinder;<br />
unsigned int uiList = 0;<br />
int iValueSelected = -1;<br />
<br />
HINSTANCE hRichEdit;
<br />
HWND g_hwndClient, FrameHwnd, RenderHwnd, InstructHwnd, DialogHwnd;<br />
<br />
LRESULT CALLBACK MainWindowCallback(HWND, UINT, WPARAM, LPARAM);<br />
LRESULT CALLBACK InstructorWindowCallback(HWND, UINT, WPARAM, LPARAM);<br />
LRESULT CALLBACK RenderWindowCallback(HWND, UINT, WPARAM, LPARAM);<br />
LRESULT CALLBACK DialogWindowCallback(HWND, UINT, WPARAM, LPARAM);<br />
<br />
static bool bShow = false, bTrue = false;<br />
<br />
<br />
LRESULT CALLBACK InstructorWindowCallback(HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam)<br />
{<br />
HWND textBox = NULL, editBox = NULL;<br />
HFONT textFont = 0;<br />
switch(uiMessage)<br />
{<br />
case WM_CREATE:<br />
{<br />
RECT richEditSize;<br />
hRichEdit = LoadLibrary("RichEd20.dll");<br />
InstructHwnd = hwnd;<br />
GetClientRect(hwnd, &richEditSize);<br />
HINSTANCE hInst = ((LPCREATESTRUCT)lParam)->hInstance;<br />
if(hRichEdit != NULL)<br />
{ <br />
editBox = CreateWindowEx(WS_EX_CLIENTEDGE, TEXT("RICHEDIT20A"), "", WS_CHILD|WS_VISIBLE|WS_VSCROLL|WS_HSCROLL|ES_AUTOHSCROLL|ES_AUTOVSCROLL|ES_MULTILINE, 0, 0, richEditSize.right, richEditSize.bottom, hwnd, HMENU(IDC_EDITBOX), hInst, NULL);<br />
if(editBox != NULL)<br />
{<br />
HDC editHdc = GetDC(editBox);<br />
int iSize = -MulDiv(10, GetDeviceCaps(GetDC(hwnd), LOGPIXELSY), 72);<br />
textFont = CreateFont(iSize, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY, FF_DONTCARE|DEFAULT_PITCH, "Courier");<br />
if(textFont == 0)<br />
{<br />
MessageBox(NULL, "Fonte não criada", "Erro", MB_OK|MB_ICONERROR);<br />
break;<br />
}<br />
SetBkMode(editHdc, TRANSPARENT);<br />
SelectObject(editHdc, textFont);<br />
ShowWindow(editBox, SW_SHOW);<br />
ReleaseDC(editBox, editHdc);<br />
SendMessage(editBox, WM_SETFONT,(WPARAM)textFont, (LPARAM)TRUE);<br />
}<br />
}<br />
HMENU hSysMenu = GetSystemMenu(hwnd, false);<br />
EnableMenuItem(hSysMenu, SC_CLOSE, MF_GRAYED|MF_BYCOMMAND);<br />
if(DialogHwnd != NULL)ShowWindow(DialogHwnd, SW_HIDE);<br />
break;<br />
}<br />
case WM_GETMINMAXINFO:<br />
{<br />
RECT instructSize;<br />
GetClientRect(GetParent(hwnd), &instructSize);<br />
MINMAXINFO * minMax = (MINMAXINFO*)lParam;<br />
minMax->ptMinTrackSize.x = instructSize.right;<br />
minMax->ptMinTrackSize.y = (instructSize.bottom/5);<br />
break;<br />
}<br />
case WM_INSTRUCTOR:<br />
{<br />
<br />
CHARFORMAT2 textFormat;<br />
textFormat.cbSize = sizeof(CHARFORMAT2);<br />
textFormat.dwMask = CFM_COLOR|CFM_FACE|CFM_CHARSET;<br />
textFormat.dwEffects = 0;<br />
textFormat.bCharSet = ANSI_CHARSET;<br />
strcpy(textFormat.szFaceName, "Courier");<br />
HWND editHw = GetDlgItem(hwnd, IDC_EDITBOX);<br />
int iLength = GetWindowTextLength(editHw);<br />
SendMessage(editHw, EM_SETSEL, (WPARAM)iLength, (LPARAM)iLength);<br />
SendMessage(editHw, EM_SETCHARFORMAT, (WPARAM)SCF_SELECTION, (LPARAM)&textFormat);<br />
<br />
SendMessage(editHw, EM_REPLACESEL, (WPARAM)FALSE, lParam);<br />
int iLineCount = (int)SendMessage(editHw, EM_GETLINECOUNT, NULL, NULL);<br />
SendMessage(editHw, EM_LINESCROLL, NULL, (LPARAM)(iLineCount-(iLineCount-1)));<br />
int iLines = 0;<br />
while(iLines < iLineCount - 1)<br />
{<br />
char cString[256];<br />
SendMessage(editHw, EM_GETLINE, (WPARAM)iLines, (LPARAM)cString);<br />
iLines++;<br />
}<br />
break;<br />
}<br />
case WM_MOVE:<br />
{<br />
RECT instructSize;<br />
GetClientRect(GetParent(hwnd), &instructSize);<br />
SetWindowPos(hwnd, HWND_TOPMOST, 0, instructSize.bottom-(instructSize.bottom/5), 0, 0, SWP_NOZORDER);<br />
break;<br />
}<br />
case WM_NCACTIVATE:<br />
{<br />
return DefMDIChildProc(hwnd, uiMessage, true, lParam);<br />
}<br />
default: return DefMDIChildProc(hwnd, uiMessage, wParam, lParam);<br />
}<br />
}<br />
<br />
<br />
LRESULT CALLBACK RenderWindowCallback(HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam)<br />
{<br />
static POINT currentPosition, oldPosition, mousePos;<br />
static unsigned int uiTex[20];<br />
static float fTest = -0.3;<br />
static bool bMousing = false;<br />
static unsigned int uiCount = 0;<br />
RECT windowRect;<br />
switch(uiMessage)<br />
{<br />
case WM_CREATE:<br />
{<br />
RenderHwnd = hwnd;<br />
windowInfos.hwnd = hwnd;<br />
GetClientRect(hwnd, &windowRect);<br />
windowInfos.hdc = GetDC(windowInfos.hwnd);<br />
OpenGLInitialization::EnableGL(windowInfos.hwnd, &windowInfos.hdc, &windowInfos.hrc);<br />
OpenGLInitialization::InitializeGL();<br />
OpenGLInitialization::SetFieldOfView(windowRect);<br />
currentPosition.x = oldPosition.x = NULL;<br />
currentPosition.y = oldPosition.y = NULL;<br />
fXNeedle = fYNeedle = fZNeedle = 0.0f; HMENU hSysMenu = GetSystemMenu(hwnd, false);<br />
EnableMenuItem(hSysMenu, SC_CLOSE, MF_GRAYED|MF_BYCOMMAND);<br />
break;<br />
}<br />
case WM_PAINT:<br />
{<br />
PAINTSTRUCT ps;<br />
HDC hdc = BeginPaint(hwnd, &ps);<br />
GetClientRect(hwnd, &windowRect);<br />
OpenGLInitialization::SetFieldOfView(windowRect);<br />
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);<br />
glMatrixMode(GL_PROJECTION);<br />
glPushMatrix();<br />
glLoadIdentity();<br />
gluOrtho2D(0, windowRect.right, windowRect.bottom, 0);<br />
glPopMatrix(); <br />
glMatrixMode(GL_MODELVIEW);<br />
glPushMatrix();<br />
glLoadIdentity();<br />
glPopMatrix();<br />
EndPaint(hwnd, &ps);<br />
SwapBuffers(hdc);<br />
break;<br />
}<br />
case WM_MOVE:<br />
{<br />
RECT renderRect;<br />
GetClientRect(GetParent(hwnd), &renderRect);<br />
SetWindowPos(hwnd, HWND_TOPMOST, renderRect.left, renderRect.top, 0, 0, SWP_NOZORDER);<br />
break;<br />
}<br />
case WM_GETMINMAXINFO:<br />
{<br />
RECT renderRect;<br />
GetClientRect(GetParent(hwnd), &renderRect);<br />
MINMAXINFO * minMax = (MINMAXINFO*)lParam;<br />
minMax->ptMinTrackSize.x = renderRect.right;<br />
minMax->ptMinTrackSize.y = renderRect.bottom-(renderRect.bottom/5);<br />
break;<br />
}<br />
case WM_LBUTTONDOWN:<br />
{<br />
if(!bMousing)<br />
{<br />
currentPosition.x = oldPosition.x = LOWORD(lParam);<br />
currentPosition.y = oldPosition.y = HIWORD(lParam);<br />
bMousing = true;<br />
}<br />
else<br />
{<br />
currentPosition.x = LOWORD(lParam);<br />
currentPosition.y = HIWORD(lParam);<br />
bMousing = false;<br />
}<br />
break;<br />
}<br />
case WM_NCACTIVATE:<br />
{<br />
return DefMDIChildProc(hwnd, uiMessage, true, lParam);<br />
}<br />
default: return DefMDIChildProc(hwnd, uiMessage, wParam, lParam);<br />
}<br />
}<br />
<br />
<br />
LRESULT CALLBACK MainWindowCallback(HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam)<br />
{<br />
HMENU hMainMenu;<br />
hMainMenu = CreateMenu();<br />
static int siRuler = IDM_NEWRULER, siText = IDM_NEWTEXT, siNodule = IDM_NEWNODULE, siPath = IDM_NEWRULERPATH;<br />
switch(uiMessage)<br />
{<br />
case WM_CREATE:<br />
{<br />
fXNeedle = fYNeedle = 0.0f;<br />
fZNeedle = -0.3f;<br />
FrameHwnd = hwnd;<br />
RulerMenu = new DynamicMenu();<br />
TextMenu = new DynamicMenu();<br />
PathMenu = new DynamicMenu();<br />
NoduleMenu = new DynamicMenu();<br />
ProceedingMenu = new DynamicMenu();<br />
ScreenShotMenu = new DynamicMenu();<br />
ImageListMenu = new DynamicMenu();<br />
AppendMenu(hMainMenu, MF_STRING|MF_POPUP, 0, NULL);<br />
SetMenu(hwnd, hMainMenu);<br />
break;<br />
}<br />
case WM_CLOSE:<br />
{<br />
delete TextMenu;<br />
delete RulerMenu;<br />
delete PathMenu;<br />
delete NoduleMenu;<br />
delete ProceedingMenu;<br />
delete ScreenShotMenu;<br />
return DefFrameProc(hwnd, g_hwndClient, uiMessage, wParam, lParam);<br />
}<br />
case WM_NCDESTROY:<br />
{<br />
PostQuitMessage(0);<br />
break;<br />
}<br />
case WM_GETMINMAXINFO:<br />
{<br />
MINMAXINFO * mainWindowSizes = (MINMAXINFO*)lParam;<br />
mainWindowSizes->ptMinTrackSize.x = WIDTH;<br />
mainWindowSizes->ptMinTrackSize.y = HEIGHT;<br />
break;<br />
}<br />
case WM_KEYDOWN:<br />
{<br />
switch(wParam)<br />
{<br />
case VK_ESCAPE:<br />
{<br />
FreeLibrary(hRichEdit);<br />
PostQuitMessage(0);<br />
break;<br />
}<br />
}<br />
break;<br />
}<br />
case WM_COMMAND:<br />
{<br />
break;<br />
}<br />
default: break;<br />
}<br />
return DefFrameProc(hwnd, g_hwndClient, uiMessage, wParam, lParam);<br />
}<br />
<br />
#endif CALLBACKS_H<br />
|
|
|
|
|
Honestly, there's so many problems here it could take hours to reply.
Many of the window messages are not handled correctly, proper return values aren't considered.
You don't seem to want to fix your message loop - again, the way you have it now is BAD.
It's going to perform terribly, and slow the rest of the system down.
This has nothing to do with opengl. It has everything to do with fundamental Windows messaging.
I would recommend getting a basic MDI app up and running. Just a frame window, an MDI client,
and child windows. You should be able to create windows, destroy windows, and cleanly terminate
the application. The few messages related to these tasks should be handled properly, with the
unhandled messages being handled by the default window procedure.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
man, I would be very happy if you point me out some errors about the messages that are not handled correctly. I'm a little bit new in MDI with Win32.
The strange is in my machine, this code works fine. But in other 2 machines not.
|
|
|
|
|
I posted a project (zipped) here[^]
The project is for VS 205 - if you're using a lower version and you want to run the code
in the debugger, , you can just extract the 3 header files, 2 cpp fles, 1 rc file, and 2 ico files
and put them in an empty project created with your VS.
It's a simple Win32 MDI app with the frame/MDI client and one child window class.
The project started as a Win32 wizard-generated project and I changed the appropriate
window stuff to MDI.
All the code's in one CPP file. I added comments in the window procedures (callbacks).
Some of the key things are:
Make sure you return the proper value after handling messages - many are the same, some are different.
Make sure you call the default window procedure for certain messages that require it in MDI -
They are documented here[^]
Proper DestroyWindow()/PostQuitMessage sequence
Also shown is a proper message loop. Once you get your windows working properly I should
be able to help you get your painting and redrawing up and running. You definitely don't need to spin in
a loop, nor do you want to - you'll get really bad graphics and system performance
I think you'll be much happier using all those CPU cycles for drawing instead of spinning in a loop doing nothing.
Feel free to email me as well as posting here - just click the email link at the bottom of my posts.
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks for your post man. I'll look the code.
|
|
|
|
|
The Microsoft version CRT Library routine, _finite(double)[^], seems not working.
int _finite(
double x
);
Return Value:
_finite returns a nonzero value if its argument x is not infinite;
that is, if – INF < x < + INF.
It returns 0 if the argument is infinite or a NAN. So I tried this function by:
double n = 1.0 / 3.0;
int v = _finite(n); While debugging it, the value of n is 0.3333333333333340.
And _finite(n) returns 1.
-- move at 11:34 Tuesday 14th August, 2007
Maxwell Chen
|
|
|
|
|
I think this forum is oriented towards "General discussions, site bug reports and suggestions about the site. "
Your query should go into C++ forums right?
|
|
|
|
|
Oops!
Maxwell Chen
|
|
|
|
|
Maxwell Chen wrote: 0.3333333333333340
That looks finite to me.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
1.0 / 3.0 should be 0.3333333333333333333333333333.......
Anyone knows where to switch something for that?
Maxwell Chen
|
|
|
|
|
It should be, yes, but a floating point variable has a limit on precision.
What are you trying to do?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: has a limit
We don't need no stinkin limits!
Mark Salsbery wrote: What are you trying to do?
He's fishing. Send him here.[^]
|
|
|
|
|