|
hi.
i write a program that is dialogbased.
i have 2 dialogbased form in my program and every of this 2 form want to access to another form
first dialog can access the data from another form but when i define one variable from another dialog error happen.
can u help me?
|
|
|
|
|
keyvan_jaferzade wrote: ...error happen.
Is it the red error?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
the error is
c:\documents and settings\kone\desktop\fractal\decompress_dialog.h(20) : error C2146: syntax error : missing ';' before identifier 'com'
c:\documents and settings\kone\desktop\fractal\decompress_dialog.h(20) : error C2501: 'CCompressor_Dialog' : missing storage-class or type specifiers
|
|
|
|
|
keyvan_jaferzade wrote: c:\documents and settings\kone\desktop\fractal\decompress_dialog.h(20) : error C2146: syntax error : missing ';' before identifier 'com'
What is to the left of com ?
keyvan_jaferzade wrote: c:\documents and settings\kone\desktop\fractal\decompress_dialog.h(20) : error C2501: 'CCompressor_Dialog' : missing storage-class or type specifiers
Have you included the file where CCompressor_Dialog is declared?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
|
i included that file but yet there is error
i use VC++6.
i hear if i use newer version this problem can solve
this means that i can include first class into second
and second class into once without error in compiling
can i upgrade my code into newer version of vc++ without any loose?
|
|
|
|
|
This is my code for first Dialog
#if !defined(AFX_DIALOG1_H__F50AB9B4_5FA3_4068_843C_01A10ED22766__INCLUDED_)
#define AFX_DIALOG1_H__F50AB9B4_5FA3_4068_843C_01A10ED22766__INCLUDED_
#include "dialog2.h" // Added by ClassView
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// dialog1.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// dialog1 dialog
class dialog1 : public CDialog
{
// Construction
public:
dialog2 d2;
dialog1(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(dialog1)
enum { IDD = IDD_DIALOG1 };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(dialog1)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(dialog1)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DIALOG1_H__F50AB9B4_5FA3_4068_843C_01A10ED22766__INCLUDED_)
//**************************************************************************
And second dialog Code is
#if !defined(AFX_DIALOG2_H__B49F8072_EB87_4558_8CE9_E83A7852E553__INCLUDED_)
#define AFX_DIALOG2_H__B49F8072_EB87_4558_8CE9_E83A7852E553__INCLUDED_
#include "dialog1.h" // Added by ClassView
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// dialog2.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// dialog2 dialog
class dialog2 : public CDialog
{
// Construction
public:
dialog1 d1;
dialog2(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(dialog2)
enum { IDD = IDD_DIALOG2 };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(dialog2)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(dialog2)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DIALOG2_H__B49F8072_EB87_4558_8CE9_E83A7852E553__INCLUDED_)
|
|
|
|
|
Do you want to have access of one dialog at two dialog and vice versa?
|
|
|
|
|
first class want to access to second
and second want to access to first just this is my problem
|
|
|
|
|
Sounds like a circular reference problem.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hello all,
Please tell me is it possible to send the WM_KEYDOWN message to the program without pressing any key in the keyboard. I want to call a method which has been written in the keydown event without pressing any key for the first time only. Please help me.
Many thanks in advance.
|
|
|
|
|
Yes you can send a WM_KEYDOWN message but it doesn't make a lot of sense. Why don't you instead move that specific code into a separate function that you call from within your key down handler and that you can call directly instead of sending the WM_KEYDOWN message.
|
|
|
|
|
You can use the well named (for a change) SendInput funcion. Or rearrange your question to give an answer of "SendMesssage (WM_KEYDOWN,...".
But as Cedric said, this is a TERRIBLE idea if you have any sort of access to the software involved. Otherwise there are lots of errors for you to make. If you don't send a matching WM_KEYUP for example, there could be all sorts of "fun" !
Iain.
|
|
|
|
|
|
If in a Visual C++ 2008 I have an image which i set up by BITMAPFILEHEADER and BITMAPINFO and BITMAPINFOHEADER, how can I enclose it in a device-context so that graphics functions can draw lines and write text on it, as if it was a screen?
Currently the MSDN Library http://msdn.microsoft.com/en-us/library/default.aspx is 404 or not answering queries, else I would have looked in it. When is there the least load on the MSDN Library?
|
|
|
|
|
Look for the Cbitmap and CDC classes, where you can make an output.
Greetings from Germany
|
|
|
|
|
Do you mean something like this?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Cannot understand why is heavily attacked by the trolls.
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
[Image resize DLL]
|
|
|
|
|
To DavidCrow: thanks, but in my case the image that I want to write to is already in memory as BITMAPINFO etc bit patterns (without an HBITMAP hande), and does not need to be read from a file.
|
|
|
|
|
Load it in (or create it) as a DIBsection instead -
then you'll have an HBITMAP to use like David's code shows.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
That is, please, I want somehow to set up in RAM memory an image object which I can write text to by TextOut() etc via a Device Context (HDC) and also directly by reading and writing its internal data layout.
|
|
|
|
|
Unless you render the text pixels yourself directly to the
bitmap bits in memory (or use a library that does it for you),
you're going to need to obtain an HBITMAP for the bitmap.
With GDI, a DIBSection works great, and pretty much matches your
current data perfectly.
With GDI+, which has better text capabilities, a Bitmap object is easy
to create from Windows DIB (bmp) data. GDI+ can do this stuff with only
a few lines of code.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I have a program with a set of C++ functions which I wrote to handle image bitmaps directly.
I have been developing this program since around year 1999, and to develop it for a long time I used a good old faithful Borland 5.1 C++ compiler, until I needed a new computer, which came with Windows Vista, which proved incompatible with many old programs and software, and so I had to change to Visual C++.
There is an old (Borland C++) version of this program, including source text, in http://www.buckrogers.demon.co.uk/software/ppp.zip .
It does not use classes (except some classes that I wrote), but calls the Windows graphics functions directly.
But please now I want to be able to write text to those images. So I need some way to set up an image which all of:-
* Has an HDC device-context handle and so can be written to by TextOut() etc.
* Can be written to or from by BitBlt().
* I can access its component bit patterns directly.
|
|
|
|
|
Anthony Appleyard wrote: But please now I want to be able to write text to those images. So I need some way to set up an image which all of:-
* Has an HDC device-context handle and so can be written to by TextOut() etc.
* Can be written to or from by BitBlt().
* I can access its component bit patterns directly.
Besides the fact that a bitmap doesn't "have" an HDC (a bitmap can
be selected into a DC), a DIBsection fits your requirements exactly.
CreateDIBSection[^]
You say you've got the BITMAPINFO and bitmap bits in memory.
Given a BITMAPINFO *bmi and a void *bmbits, the following code will
create a DIBSection - a bitmap that you can select into a DC and also read/write
its pixel bits directly:
BITMAPINFO *bmi = ...;
void *bmbits = ...;
BYTE *pDIBSectionBits;
HBITMAP hBitmap = ::CreateDIBSection(NULL, bmi, DIB_RGB_COLORS, (void**)&pDIBSectionBits, NULL, 0);
if (hBitmap)
{
LONG lStride = (((bmi->bmiHeader.biWidth * (long)bmi->bmiHeader.biBitCount + 31L) & (~31L)) / 8L);
memcpy(pDIBSectionBits, bmbits, lStride * abs(bmi->bmiHeader.biHeight));
::DeleteObject(hBitmap);
}
Pretty simple
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I have a SDI formview based application and I want to store some results into MS-Access or such database. I am presently working on VC++ 6.0. Can any one suggest me that whether this can be done in VC++ using ODBC. Any lead is highly appreciated.
Thank you.
Shanmukha.
|
|
|
|