相关文章推荐
严肃的西装  ·  Java中出现[Ljava.lang.Str ...·  3 月前    · 
英俊的大脸猫  ·  Window postMessage() ...·  1 年前    · 
体贴的柿子  ·  Deepin V20 ...·  1 年前    · 
重情义的卤蛋  ·  书写.d.ts文件 | ...·  1 年前    · 

indicates new messages since 31-Dec-99 18:00
Yes, it's ok now. I'm just curious why the error can be report this way, maybe it's the compiler's problem.
Thanxxxxxxxxxxxxxxxxxx
CString FilePath=ff.GetFilePath();<br /> WCHAR *p=FilePath.AllocSysString();<br /> Bitmap bmp(p);<br /> ::SysFreeString(p);<br /> Color clr( 255 , 0 , 0 , 0 );<br /> HBITMAP hBmp;<br /> bmp.GetHBITMAP(clr,&hBmp);<br /> CBitmap *pBmp= new CBitmap;<br /> pBmp->Attach(hBmp);<br />
Sign In · View Thread My teacher just threw us into this world of Visual C++ so I really don't know what to do on this one. I am making a randomly generating Maze in Visual Studio. Here is the public section to my header file:
public:
CMaze ();
CMaze (const CMaze & other);
~CMaze ();
CMaze & operator = (const CMaze & other);
void Init (int R, int C);
void Instructions (CFrameWnd * windowP);
void Display (CFrameWnd * windowP);
CRect Move (dType direction);
void Message (CFrameWnd * windowP);
bool Finished();
What is CFrameWnd * windowP and what do I need to pass to the Display function to get my program to go to it?
Any Help Would be awesome.
Sign In · View Thread The CFrameWnd class provides the functionality of a Windows single document interface (SDI) overlapped or pop-up frame window, along with members for managing the window.
To create a useful frame window for your application, derive a class from CFrameWnd. Add member variables to the derived class to store data specific to your application. Implement message-handler member functions and a message map in the derived class to specify what happens when messages are directed to the window.
There is different possibilities to get your programm running, depending on the existance of CView/CDoc or just Win32 API.
Take a look into your documentation.
Greetings.
--------
M.D.V. Wink | ;)
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson

Sign In · View Thread Actually Im in real problem.
I need to take user input (both text and bmp image). These two element can exist together ie picture need to described by text. These input must be converted to PDF how can I do. Please Explain me in detail I have know Knowledge.
Sign In · View Thread
keyto wrote:
Please Explain me in detail

If you really want to write your own PDF Writer, the PDF Reference is the item you'll need...
PDF Reference, Sixth Edition, Version 1.7 [ ^ ]
Just a fair warning, the text was written from one professor to another and is not easy to digest, navigate, or absorb. It lacks practical samples and the file format is binary which makes exposition even more confusing since at first glance it looks like its a text format.
I think I spent a few months on it before I had anything useful but once you get going and start to figure out the approach, it gets much easier.
I strongly recommend using GDI+ for bitmap and text conversion. You need to extract the bitmap bits yourself and encode them (PDF supports just about every useful encoding scheme). You will need an implementation of LZW or you can use zlib to compress your streams, otherwise the PDF file size gets quite large.
You need to synthesize things like font glyph underlining and strikethrough since those features are not part of the font glyphs. This requires you dig into the font files or use GDI font metric functions to get the cell ascent, cell descent, underline thickness, strikethrough position, etc...
If you want your screen previews to match your PDF output, you can use GDI+ antialiased fonts which are very close once you translate font heights and line placement. PDF does not support multiline in a way that matches line spacing with GDI or GDI+ so you must calculate each lines coordinates and place each line of text.
I'd say if you skip some of the more advanced PDF features, you should have a good working model of a PDF writer in about 6 months.
If this timeframe is too long, you might try printing your graphics primitives from GDI or GDI+ to a PDF print driver like "PrimoPDF" or "Acrobat".
Sign In · View Thread OnCreate() is not virtual - you need to add a ON_WM_CREATE() message map
entry in your dialogbar class in order for it to be called when the dialog bar is
created.
OnOnitDialog() IS virtual, but CDialogBar doesn't call it.  You can catch it yourself with a message map
entry though, just like CDialogBar does.
Here's a working example.  OnCreate() and HandleInitDialog() are called, in that order.
CDialogBar::DoDataExchange(pDX); DDX_Control(pDX, IDC_COMBO1, m_ComboBox); DDX_Control(pDX, IDC_PROGRESS1, m_ProgressCtrl); CSize CMyDialogBar::CalcFixedLayout(BOOL bStretch, BOOL bHorz) CSize size = CDialogBar::CalcFixedLayout(bStretch, bHorz); if (!IsFloating()) CRect rect; GetParentOwner()->GetClientRect(&rect); if (bHorz) size.cx = rect.Width(); size.cy = rect.Height(); return size; BEGIN_MESSAGE_MAP(CMyDialogBar, CDialogBar)     ON_WM_CREATE()     ON_MESSAGE(WM_INITDIALOG,&CMyDialogBar::HandleInitDialog) END_MESSAGE_MAP() // CMyDialogBar message handlers LRESULT CMyDialogBar::HandleInitDialog(WPARAM wParam, LPARAM lParam) LRESULT lRet = CDialogBar::HandleInitDialog(wParam, lParam);     UpdateData(FALSE); m_ComboBox.SetWindowText(_T( " Test" )); m_ProgressCtrl.SetRange( 0 , 100 ); m_ProgressCtrl.SetPos( 50 ); return lRet; int CMyDialogBar::OnCreate(LPCREATESTRUCT lpCreateStruct) if (CDialogBar::OnCreate(lpCreateStruct) == -1) return -1; return 0 ;
Mark Salsbery
Microsoft MVP - Visual C++

Sign In · View Thread
If you need, there is a good .pdf floating around the net titled "Advanced MFC Programming.pdf"
Section 1.8 and 1.9 have good info on how to set up CDialogBar.
Be forewarned, I downloaded my copy years back but a current search yields a few sites that smell like adware so be very cautious on which site you download a copy from.
If you can get the .pdf, you'll find it has a lot of good stuff in it. It was probably written in the Visual C++ 5.0 or 6.0 days but MFC hasn't changed too much so it still fits in nicely.
Sign In · View Thread If you have a utility class with some static methods A, B, and C and each has identical parameter lists with 10 parameters each, and A usually calls B and B calls C, would it be more efficient to make the methods non-static and simply require the parameters in a constructor (setting member variables in the initialization list) and remove the paramters from A, B, and C and have those methods refer to the member variables?
Keep in mind the typical usage scenario would instantiate an instance of the class, call method A, then the object would go out of scope soon after without calling a method on the object again while in the same scope.
Method A is called quite a bit during a window refresh all over the code so any ideas on which design would likely yield less overhead in general would be greatly appreciated.

Sign In · View Thread
bob16972 wrote:
would it be more efficient to make the methods non-static and simply require the parameters in a constructor

I would say yes, slightly.
In the static A calls static B calls static C scenario, the 10 params are pushed on and copied off the stack 3 times.
In a constructor the 10 params would only need to be pushed/copied once (plus there's an additional call/return to
the constructor added on).  The 3 method calls only have the implicit "this" pointer pushed on the stack.
Mark Salsbery
Microsoft MVP - Visual C++

Sign In · View Thread Good deal.
I use some utility classes to convert MFC types to GDI+ types for drawing text and passing all those parameters around seems clunky and now I need to add more functionality and wasn't sure if cleaning it up and making it a nice solid class would waste any more clock ticks.
If anything, I just need to make sure I don't weigh it down any more since GDI+ is pretty darn slow as it is.
Thanks for the input.
Sign In · View Thread I am a new comer to programming and this forum.
I have been looking at some code I found on the internet and in the header files they have what i believe are called header wrappers. Which I understand are to stop the header file from being defined more than once.
The code looks like this:
#if !defined(AFX_MYDERIVATIVE_H__AC73BB0F_CC43_4B4B_850A_4DC13A664B8C__INCLUDED_)
#define AFX_MYDERIVATIVE_H__AC73BB0F_CC43_4B4B_850A_4DC13A664B8C__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "myFunction.h"
namespace Ovalkey {
//class definitions
#endif
My question is why the strange symbol AFX_MYDERIVATIVE_H__AC73BB0F_CC43_4B4B_850A_4DC13A664B8C__INCLUDED_
Is this something generated by Visual Studio? or just some strange thing the programmer decided to call the variable?
Many thanks

Sign In · View Thread This strange constant was generated by your friendly MFC Wizzard, when you used it to generate the Class Files. It is based on a GUID (Globally Unique Identifier). It's purpose is to ensure that this constant is unique in the world for your header. I.e. Someone else anywhere anytime who decides to generate a Class CMyDerivative, will have a different constant.
Bram van Kampen

Sign In · View Thread To add to the other reply,
It seems Visual C++ class wizard stopped putting these in class files after VC++ 6.0 so if your using a newer Visual C++ IDE, you probably won't see these in classes created with those newer IDE's.
For what it's worth.
Sign In · View Thread Question reg: error C2440: 'specialization' : cannot convert from '' to ' (__cdecl *)(const char *)' [modified] Pin
naresh_t 1-Dec-07 3:45
naresh_t 1-Dec-07 3:45 i have downloaded autumnframework which is IOC for C++
but when i compile the autumnframework workspace using VC++ 6.0 but
iam getting the following errors.......
class 'Autumn::IBeanWrapper'
error C2440: 'specialization' : cannot convert from '' to ' (__cdecl *)(const char *)'
None of the functions with this name in scope match the target type
error C2975: 'BasicType' : invalid template argument for 'createfun', constant expression expected
error C2440: 'specialization' : cannot convert from '' to 'void (__cdecl *)()'
None of the functions with this name in scope match the target type
...........
The code is
the errors are at
.....................................
const string charAT("char");
const string ucharAT("unsignedchar");
char atoch(const char* s){return s[0];}
short atosh(const char* s){return (short)atoi(s);}
void freech(char p){}
void freesh(short p){}
TypeManager::TypeManager()
//I think that unsigned is same to singed to deal with except long
// The following is for basic type.
this->TypeList.push_back( new BasicType(charAT) );
this->TypeList.push_back( new BasicType(ucharAT) );
this->TypeList.push_back( new BasicType(shortAT) );
this->TypeList.push_back( new BasicType(ushortAT) );
The template def is
..................
template<class t,="" t="" createfun(const="" char*),="" void="" freefun(t)="">class BasicType:public IAutumnType{
private:
string typeFormat;
public:
BasicType(const string& name): typeFormat(name){}
please any can figure out the error
thanks in advance
naresh
General Re: reg: error C2440: 'specialization' : cannot convert from '' to ' (__cdecl *)(const char *)' Pin
David Crow 14-Mar-08 5:59
David Crow 14-Mar-08 5:59
nareshtummanapalli wrote:
error C2440: 'specialization' : cannot convert from '' to ' (__cdecl *)(const char *)'
please any can figure out the error

See here .

"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne


Sign In · View Thread I'm c# programmer and I'm familiar with declaring methods inside a class body. Now c++ says that I should put in the body just prototypes and declare methods somewhere else using :: scope operator.
My question is: what happen if I declare a method inside a class anyway? I read somewhere that it would make it 'inline', I mean the compiler would copy it everywhere it is called instead of putting actual 'call' command... What you c++ guys say on this?
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.

Sign In · View Thread
gajatko wrote:
My question is: what happen if I declare a method inside a class anyway? I read somewhere that it would make it 'inline',

True.
gajatko wrote:
...the compiler would copy it everywhere it is called instead of putting actual 'call' command... What you c++ guys say on this?

You should only request inline for small functions. Even so, the compiler is free to ignore your request.

"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne


Sign In · View Thread i wanna assign a bitmap for a button. like in VB.
Could Some One tell how could i do that?
Thank you
"The Ultimate Limit Is Only Your Imagination."

Sign In · View Thread it tells me that the CImage is not defined. or sth like that . Sniff | :^)
"The Ultimate Limit Is Only Your Imagination."

Sign In · View Thread