|
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.
|
|
|
|
|
|
If you are trying with MS-Access, then you can use classes CDaoDatabase, CDaoRecordset from the MFC framework. If you are interested only in ODBC, then you can try classes CDatabase, CRecordset again from MFC framwork.
|
|
|
|
|
If u r interested in ODBC,there is two way of connection.
1. Tru coding::for example
CString avc;
CString abb ;
CString tempstr ;
abb="\"";
avc ="odbcconf.exe /a {CONFIGSYSDSN """ + abb+ """Microsoft Access Driver (*.mdb)""" +abb+ " " + abb + abb+ """DSN=Restore;DBQ="""+ abb + tempstr + abb + ";""" + abb+ abb + " Description=PRI_SD_ODBC}""";
int length=avc.GetLength();
CFile file;
CFileException e;
file.Open(_T("C:\\boot.bat"),CFile::modeCreate|CFile::modeWrite,&e);
file.Write(avc,length);
file.Close();
ShellExecute(NULL,_T("open"),_T("C:\\boot.bat"),NULL, NULL, SW_HIDE);
2.
you goto control panel there is ODBC data source admininstrator.
there are two option create whether user DSN or System DSN.
Select anyone and click ADD.
open a window for create new data souce.Select Microsoft Access Driver(*.mdb).click on finish.
ODBC microsoft setup window open.
fil entry like DSN name, database path
then click ok.
connection is estabilsh.
You can chk you DSN name in User DSN or System DSN window whter u selected .
now in your code you go to in class view and add class and select MFC ODBC Consumer,click on DatSOurce and select ur created DSN.
Than select a table for which you cant to create class and than use.
ok.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Hi
i need a logic for given issue that i have a interface of third party application in my application (mfc application), using this interface , i launch the third party applicaiton. my problem is that when my appliction exit, the third party applicaiton also is forced to close. Is any alernative this.
by
paul
|
|
|
|
|
paul crescent wrote: using this interface
Probably you should read interface documentation (if any).
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]
|
|
|
|
|
create a new process of that application
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/xml>
|
|
|
|