|
**************************************
//#include "simple calculator.h" ->code
class CExerciseApp : public CWinApp
{
public:
virtual BOOL InitInstance();
};
class CMainFrame : public CFrameWnd
{
//CString s = _T("1032");
//int n = ParseInt( s );
public:
CButton b1, b2, b3, b4, b5;
CEdit text1, text2, res;
CString str1, str2;
//CFont font;
long a, b, c;
CMainFrame();
void addition();
void substruction();
void production();
void dividation();
void modulation();
DECLARE_MESSAGE_MAP()
};
*******************************
#include <afxwin.h>
#include <string.h>
#include <windows.h>
#include <math.h>
#include "simple calculator.h"
#define plus 11
#define minus 12
#define product 13
#define divide 14
#define mod 15
#define textone 500
#define texttwo 600
#define result 700
char str[50];
CMainFrame::CMainFrame()
{
Create(NULL, L"MENU BUILDING");
text1.Create (WS_CHILD | WS_VISIBLE | WS_BORDER, CRect(5,10,120,30), this, textone);
text2.Create (WS_CHILD | WS_VISIBLE | WS_BORDER, CRect(140,10,255,30), this, texttwo);
res.Create (WS_CHILD | WS_VISIBLE | WS_BORDER, CRect(275,10,390,30), this, result);
text1.GetWindowText(str1);
text2.GetWindowText(str2);
wsprintf (str,L"%s",str1 );
a=atol(str);
wsprintf (str,L"%s",str2 );
b=atol(str);
//wsprintf ( a,L"%s",str1);
//wsscanf(str1,"%ld",&a);
//a=atol(str);
//wsprintf ( (LPWSTR)str,L"%c",str2 );
//wsprintf ( b,L"%s",str2 );
//b=atol(str);
//wsscanf(str2,"%ld",&b);
b1.Create (L"+", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, CRect(5,50,30,70), this, plus);
b2.Create (L"-", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, CRect(45,50,70,70), this, minus);
b3.Create (L"*", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, CRect(85,50,110,70), this, product);
b4.Create (L"/", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, CRect(125,50,150,70), this, divide);
b5.Create (L"%", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, CRect(165,50,190,70), this, mod);
//font.CreateFont(20,0,0,0,20,0,0,0, ANSI_CHARSET,OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_DONTCARE,L"arial");
//sta.SetFont(&font);
}
BEGIN_MESSAGE_MAP( CMainFrame, CFrameWnd)
ON_BN_CLICKED (plus, addition)
ON_BN_CLICKED (minus, substruction)
ON_BN_CLICKED (product, production)
ON_BN_CLICKED (divide, dividation)
ON_BN_CLICKED (mod, modulation)
END_MESSAGE_MAP()
void CMainFrame::addition()
{
c=a+b;
}
void CMainFrame::substruction()
{
c=a-b;
}
void CMainFrame::production()
{
c=a*b;
}
void CMainFrame::dividation()
{
c=a/b;
//SetDlgItemInt(result,UINT(c),1);
}
void CMainFrame::modulation()
{
c=a%b;
sprintf(str,"%ld",c);
//SetDlgItemInt(result,UINT(c),1);
CClientDC dc(this);
//wsprintf(str1,"%ld",c);
//res.SetWindowText(str1);
//dc.TextOut(50, 50, L"goutom", 6);
//wsprintf((LPWSTR)str, L"%c", c);
dc.TextOut(280, 15, (LPCTSTR)str, strlen(str));
//str1.Format(L"%ld",c);
//res.SetWindowText(str1);
}
//SetDlgItemInt(IDC_BUTTON4,UINT(c),1);
BOOL CExerciseApp::InitInstance()
{
m_pMainWnd = new CMainFrame;
m_pMainWnd->ShowWindow(SW_NORMAL);
m_pMainWnd->UpdateWindow();
return TRUE;
}
CExerciseApp theApp;
// when i run this code , it run but not give me a error message. plz solve my error.
|
|
|
|
|
goutom roy wrote: when i run this code , it run but not give me a error message. plz solve my error.
Are you saying that it runs correctly? If so then there is nothing to fix. However, if you are saying it does give an error message, then please tell us what the message is.
|
|
|
|
|
goutom roy wrote: when i run this code , it run but not give me a error message. plz solve my error.
Assuming you mean the opposite of what you wrote - Why don't you just step through the code with the debugger and see where it fails?
Also, next time you post your code please embed it in the "code block" tags.
|
|
|
|
|
goutom roy wrote: ...it run but not give me a error message. plz solve my error.
Contradiction.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
could i place a CFromView class on a CDialog class int a dialog-based app?
how to place CFromview on CDialog?
I mean: I have a dialog template with CFromView class ,could I doModal this dialog?
modified on Sunday, November 8, 2009 7:40 PM
|
|
|
|
|
Do you mean CFormView?
Величие не Бога может быть недооценена.
|
|
|
|
|
Why would you even want to? Just add the controls you need to the dialog template.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi,
you can add a TabWnd to the Dialog.
Then you can add a CFormView to this TabWnd.
When you move/resize the TabWnd, you can "hide" the TabWnd and you only see the active CFormView.
Naturally you can switch the View into the TabWnd with another View...
I hope this helps you
Greetings
|
|
|
|
|
Hi All
I am getting Unhandled exception at 0x7714c3c2 accident.I know it's hard to say why came.Becouse it's not in fix step.
When i try to debug the code then it's jump in Disassembly.And it's point here
mov ecx,dword ptr [eax+0Ch)
I know it's difficult to say reason. How can i trace point wahy unhandled exception come.
Plz help me
|
|
|
|
|
Check the call stack to trace the location of the expection on debugging!!!!
Величие не Бога может быть недооценена.
|
|
|
|
|
yaa
Unhandled exception at 0x7714c3c2 rt.exe 0xC0000005: Access violation reading location 0x0
|
|
|
|
|
Can u tell the function in which it is crashing?
Величие не Бога может быть недооценена.
|
|
|
|
|
|
It is difficult solve your issue until we see the code?
Величие не Бога может быть недооценена.
|
|
|
|
|
This makes no sense. Threads are not something you call.
When the exception is thrown, check the Call Stack window.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Please check the call stack and see which function in your code causes the problem (and which line). You can then put breakpoints just before the crash location and check if everything is correct (values have correct values, pointers are correctly initialized, ...). If you are still stuck, then post here the call stack with the code (your code) that causes the problem.
|
|
|
|
|
I do understand that some crashes will take you right into the disassembly and won't show any code that you've written. But to confirm that this is such a case, what exactly does the callstack show when the crash occurs?!
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
call stack show this
oleaut32.dll!7714c3c2()
[Frames below may be incorrect and/or missing, no symbols loaded for oleaut32.dll]
oleaut32.dll!7714c46c()
|
|
|
|
|
Hi everybody, i put a group box which id is IDC_GB in a dialog. i add a message function to it and
change it's styles notify to true. but it doesn't respond when i click it use mouse.
who can tell me how to do?
|
|
|
|
|
Just a guess here but try handling the NM_CLICK notification message instead of BN_CLICKED, aside of that, try using spy++ to see what the parent of the groupbox receives when you click the box.
p.s: i hate groupboxes.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Hi all,
Im working on a program , its fuction is that it should open a tiff file in Paint and save it as jpg file. What are the Windows API fnctions used to open,save and close a image file.
Thanks,
modified on Friday, November 6, 2009 2:31 AM
|
|
|
|
|
Karthika85 wrote: it should open a tiff file in Paint and save it as jpg file.
Karthika85 wrote: What are the Windows API fnctions used to open,save and close a image file.
If you need to open Paint for the purpose, why are you asking for image related Windows API ?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Ok. then what are the functions used to open and save the image
Thanks
|
|
|
|
|
Why cant to Google it.
I found a lot on googling just see below [^]
Величие не Бога может быть недооценена.
|
|
|
|
|
After loading a bitmap,how to save it as jpg file?
|
|
|
|
|