|
There are the code of the CAirrfView.cpp and CAirrfView.h.
In the CAirrfView.cpp file:
CAirrfView::CAirrfView()
{
m_MaxScreen=20000;
m_Screen=new ScreenStruct[m_MaxScreen];
m_Screen[0].sx=m_xStart;
m_Screen[0].sy=m_yStart;
m_Screen[0].blc=blc;
}
CAirrfView::~CAirrfView()
{
delete m_Screen;
}
.....
void CAirrfView::GraphAll()
{
float minx,miny,maxx,maxy,bl1;
CAirrfDoc* pDoc =(CAirrfDoc*) GetDocument();
minx=(float)1E20;miny=(float)1E20;maxx=-(float)1E20;maxy=-(float)1E20;
SetCapture();
SetCursor(LoadCursor(NULL,IDC_WAIT));
BOOL pb=pDoc->GetRect(&minx,&miny,&maxx,&maxy);
SetCursor(LoadCursor(NULL,IDC_ARROW));
ReleaseCapture();
if(!pb)
{
m_xStart=0;
m_yStart=0;
blc=1.0;
return;
}
else
{
bl1=(maxx-minx)/(m_wScreen-20);
blc=(maxy-miny)/(m_hScreen-20);
if(bl1>blc)
blc=bl1;
m_xStart=minx-10*blc;
m_yStart=miny-10*blc;
}
p_Screen[pDoc->m_CurrentScreen1].sx=m_xStart;
p_Screen[pDoc->m_CurrentScreen1].sy=m_yStart;
p_Screen[pDoc->m_CurrentScreen1].blc=blc;
pDoc->m_CurrentScreen=pDoc->m_CurrentScreen1;
Invalidate();
}
in the CAirrfView.h file:
typedef struct
{
float blc;
float sx;
float sy;
}ScreenStruct;
class CAirrfView : public CView
{
ScreenStruct *m_Screen;
ScreenStruct *p_Screen;
int m_MaxScreen;
float m_xStart,m_yStart,blc,bl1;
void GraphAll();
};
Thank you.
|
|
|
|
|
it compiles and works fine
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
this is not answering your problem, but in your destructor, you should use delete[] instead of simple delete
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Im on a project wherein i have to lock a file & restrict its access on a certain interrupt from a port ?
I need someone to help me out with this , Any info on this topic would be of great help !!!!!!!!!!! Information could be in the form of Source Code , references ,any comment.............
Thank You
|
|
|
|
|
some ont know how i can add events in JournalPlaybackProc to simulate events in an hook ?
i have try this but it s only modify the event !
extern "C" __declspec(dllexport) LRESULT CALLBACK GetMsgProc(INT nCode,
WPARAM wParam,
LPARAM lParam)
{
MSG* pCwp = (MSG*)lParam;
pCwp->pt.x= 589;
pCwp->pt.y= 654;
lParam = (LPARAM)pCwp;
}
return CallNextHookEx( hHook, nCode, wParam, lParam );
}
|
|
|
|
|
Hello
I want to load MS Powerpoint dynamically into my dialoguebased MFC programm.
What control should I use and how to do this....? Any example or any link that can give me some material for this ?
Thankx and Regards
Amarelia Maehsh
Gujarat
India
|
|
|
|
|
I am not sure what you mean by load PowerPoint into your app...but this will launch Powerpowerpoint....Note you may have to look into the Registry where Excel is installed.
try
{
STARTUPINFO start;
PROCESS_INFORMATION processinfo;
char temp[300];
CString strMessage = "Unable to launch the editor ",
strDefEditor,
strFileName;
pFrameWnd = dynamic_cast<cmainframe*> (AfxGetApp()->m_pMainWnd);
if (pFrameWnd)
{
//strEditor contains path to PowerPoint
strDefEditor = pFrameWnd->m_DlgOptions.m_strEditor;
}
strcpy (temp, strDefEditor);
strcat(temp, " \"");
strFileName = GetPathName();//ocument()->m_strL>GetPathName() ;//m_DlgDataSave.m_strFilePath + m_DlgDataSave.m_strFileName;
//SaveFile(&strFileName);
strcat(temp, strFileName);
strcat(temp,"\"");
start.cb = sizeof start;
start.lpReserved = NULL;
start.lpDesktop = NULL;
start.lpTitle = NULL;
start.cbReserved2 = 0;
start.lpReserved = NULL;
start.dwFlags = STARTF_USESHOWWINDOW;
start.wShowWindow = SW_SHOW;
if ( !::CreateProcess( NULL,
temp,
NULL,
NULL,
TRUE,
0,
NULL,
NULL,
&start,
&processinfo))
{
strMessage += "\"" + strDefEditor + "\".";
if (pFrameWnd)
pFrameWnd->MessageBox(strMessage, "Error launching editor", MB_OK);
}
else
{
// Close the data file to prevent access problems
//m_pDoc = (CESCDoc*) GetActiveDocument();
//m_pDoc->OnCloseDocument();
// OnCloseDocument();
}
}
catch(...)
{
pFrameWnd = dynamic_cast<cmainframe*> (AfxGetApp()->m_pActiveWnd);
if (pFrameWnd)
pFrameWnd->MessageBox( "Unable to open the file in Excel.",
MAIN_ERROR_MSG,
MB_ICONEXCLAMATION);
}
-Anil
|
|
|
|
|
can it be done with OLE?
V
|
|
|
|
|
Hello,
How can I get a notification to my program when another window (for eg. windows' calculator) is created or activated by the user?
Thank you for any valuable help.
|
|
|
|
|
One way is to set timer of few milliseconds. On its callback write code to like this,
FindWindow()//i dont remember exact API, but it finds window by title
|
|
|
|
|
System wide hook. Look throu the articles at CP.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Thank you all.
I will try...
|
|
|
|
|
More Accurate :- System Wide Hook of Type WH_CBT ....
"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
|
|
|
|
|
|
IShellFolder * psfDesktop = NULL;
SHGetDesktopFolder (&psfDesktop);
LPITEMIDLIST pidl = NULL;
#ifdef _UNICODE
psfDesktop->ParseDisplayName (NULL, 0, strArray.GetAt (0).GetBuffer(0), NULL, &pidl, NULL);
#else
OLECHAR * olePath = NULL;
olePath = (OLECHAR *) calloc (strArray.GetAt (0).GetLength () + 1, sizeof (OLECHAR));
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, (char*)strArray.GetAt (0).GetBuffer(0), -1, olePath, strArray.GetAt (0).GetLength () + 1);
psfDesktop->ParseDisplayName (NULL, 0, olePath, NULL, &pidl, NULL);
free (olePath);
#endif
just be patient to have a look. without unicode configuration,everything is good. But if I compiled with _UNICODE defined, after "ParseDisplayName (NULL, 0, olePath, NULL, &pidl, NULL);" ,pidl is always null.
what's the matter????
Thank u every one here.
|
|
|
|
|
CString::GetBuffer returns LPTSTR , which is either a char* or a wchar_t* , depending on the unicode setting. You are testing for the definition of _UNICODE , while LPTSTR depends on the definition of UNICODE (notice the lack of underscore). When you define _UNICODE, are you defining UNICODE, and removing the definiton of MBCS too?
That being said, I'd suggest writing that piece as follows:
BSTR bstrName = strArray.GetAt(0).AllocSysString();
psfDesktop->ParseDisplayName(NULL, 0, bstrName, NULL, &pidl, NULL);
::SysFreeString(bstrName);
The above should work both for Unicode and MBCS builds.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
I want to typecast a 32-bit float to a 64-bit double.
When I do, the most significant bits of the mantissa are correct (ie. the original 'float' variable), but the additional mantissa bits provided by the double look like they have not been initialised properly (ie. The complier has provided a 'double' that is no more accurate than the original 32-bit float).
I have had same results using Visual C++6.0 and VisualC++2005beta2
I have searched the MSDN for some light on this, and have found little.
Anyone have any suggestions/recommendations/standard practice to deal with this...
//=========================================================
//Here is some code that demonstrates the problem...
//Step through it with a debugger and examine the values stored in fdArray[]
//=========================================================
int main(void)
{
int i;
float fFloat;
float fArray[] = {0.1,0.2,0.3,0.4};
double fdArray[] = {0.0,0.0,0.0,0.0};
for(i=0;i<4;i++)
{
fFloat = fArray[i];
fdArray[i] = (double) fFloat;
}
return 0;
}
|
|
|
|
|
chris_mclean wrote:
(ie. The complier has provided a 'double' that is no more accurate than the original 32-bit float).
I wouldn't expect anything less - it's not like you provided any extra info, is it ? And C++ doesn't initialise anything - declare an int and don't give it a value, see what it's value is.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
What do you mean exactly?
You have an array of floats and you copy/convert them to an array of doubles. If you print both arrays out, they should print the same thing. The array of doubles should only print the values assigned to it, and since those values where copied from floting point values, they can be no more accurate than the souce.
Think of anouther example.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
I wasn't thinking and got 'trapped' by a stupid though process.
I presumed that when the complier typecast from float to double, that it would attempt to represent the floating point value as "accurately as possible" using a double.
eg. if the float value was 1.2345678 then the 'typecast' would magically 'convert' the variable to 1.234567800000000 etc.. (which it doesn't).
Thanks for your comments nevertheless.
|
|
|
|
|
:-DWe all fall into that trap. If it actualy printed all the 0s, then we would spend all day watching 0s scroll on our screen.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
As the others mentioned it doesn't create data.
Just for kicks take a look at exactly what it is doing.
Let's use 0.1 as our test number.
(Hex in raw byte order)
0.1 float is 0x3dcccccd
0.1 double is 0x3fb999999999999a
What happens when you cast from a float to a double:
0x3dcccccd -> 0x3fb99999a0000000 - contrast with ...
0x3fb999999999999a - most accurate representation
As you can see it does zero out the unknown part.
The ieee float format uses a 24 bit mantissa (3 bytes).
The ieee double format uses a 11-bit exponent, plus 1 bit sign (1.5 bytes before start of mantissa).
So if we look at the double the mantissa and sign are in 0x3fb leaving 99999a (3 bytes) for the mantissa, which match the 3 bytes of mantissa in the float (cccccd) - i.e. same precission.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
I want my CEdit box only receive the number 0-9. And if other keys were pushed down, it will not be displayed in the CEdit box.
What can I do?
I looked up in the MSDN, But I didn't find any method.
|
|
|
|
|
set the property of your editbox
Number - True
|
|
|
|
|
|