|
Hello,
Check the MS Advanced MFC sample -- MTMDI. It does exactly
what you want. When I studied this the first reaction was why will someone do anything like this, since the sample will still run correctly without the threaded support. Now, I realize such a need do exist!!!
Regards,
Paul.
|
|
|
|
|
Hi,
i am looking for an example which use
a TRANSPARENT(both button and window) toolbar
not in a rebar control
i am trying to host the tool bar in a CWindow(ATL)
derived,and i always get a white background
although the CWindow OnPaint draw a red background
thanks
tomer
|
|
|
|
|
How to load a bitmap from the disk (NOT as a resource) to a CBitmap or some other ... to be able to display it or put it in an image control ?
|
|
|
|
|
use this code...
CString fileName = "c:\\pics\\picture.bmp"; // this should be a path to the file to load, can also use CFileDialog to get path
// this wil load the image from disk into an HBITMAP
HBITMAP hBmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), fileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
CBitmap cBmp; // create a CBitmap to hold the image
cBmp.Attach(hBmp); // here is the CBItmap that contains the image
==================
The original message was:
How to load a bitmap from the disk (NOT as a resource) to a CBitmap or some other ... to be able to display it or put it in an image control ?
|
|
|
|
|
I have a view based SDI application. It monitors other process.
If no problems are detected I would like it to be invisible to the user. I do not want it to show on the task bar, nor should someone be able to Alt-Tab to it.
How do I hide the frame and the view?
|
|
|
|
|
Towards the end of your application InitInstance method,
the following lines exit
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
Changing the show (SW_SHOW) to hide (SW_HIDE) or something similar will prevent the window from showing. It will actually initial show and then hide. If you wish to prevent this too, you may have to take care of the actual creation functions in the mainframe class.
|
|
|
|
|
This may have been covered in a previous post, but I don't know because there are just too many previous posts to wade through.
I am trying to print a bitmap graphic that is generated from data. It is in a view, so currently I am just printing the view using the whole doc/view printing made easy functions. Actually, I didn't even have to do any programming at all because somehow it was all set up pretty well already just by the MFC standards. Only I have two imposing problems:
1) My bitmap's y axis is reversed or something, because it isn't just printed upside-down, it is printed with the entire y-axis completely reversed, but the x-axis normal. So my graphic is innacurate.
2) My bitmap is being printed really tiny, which makes it hard to see. Because it is generated from data, it needs to be able to be seen clearly.
So can anyone help me flip the y-axis and enlarge it when it gets printed but leave my view as it currently is (unflipped and not enlarged)? I can't seem to find any useful information on how to do either, because I'm not working with text. Any help would be appreciated.
If you would like to email me, you can do so at: ALeonard@bruker-axs.com
|
|
|
|
|
get the picture into a DC..
then use some code like this...
CPrintDialog printdlg(false, NULL); // instantiate the printer dialog
if (printdlg.DoModal() != IDOK) // show the printer setup dialog
return;
CDC srcDC; // this needs to be the image
HDC hDC = printdlg.GetPrinterDC(); // get a DC to the printer
CDC pDC;
pDC.Attach(hDC); // attach the printer dc to a CDC
pDC.StartDoc("printing"); // start the document
pDC.StartPage("page 1"); // start the current page
int width = 500 // image width
int height // image height
// this next function will stretch the image to full size (as it is displayed)...
pDC.StretchBlt(0, 0, width * 3, height * 3, &srcDC, 0, 0, width, height, SRCCOPY);
pDC.EndPage();
pDC.EndDoc();
==================
The original message was:
This may have been covered in a previous post, but I don't know because there are just too many previous posts to wade through.
I am trying to print a bitmap graphic that is generated from data. It is in a view, so currently I am just printing the view using the whole doc/view printing made easy functions. Actually, I didn't even have to do any programming at all because somehow it was all set up pretty well already just by the MFC standards. Only I have two imposing problems: 1) My bitmap's y axis is reversed or something, because it isn't just printed upside-down, it is printed with the entire y-axis completely reversed, but the x-axis normal. So my graphic is innacurate. 2) My bitmap is being printed really tiny, which makes it hard to see. Because it is generated from data, it needs to be able to be seen clearly.
So can anyone help me flip the y-axis and enlarge it when it gets printed but leave my view as it currently is (unflipped and not enlarged)? I can't seem to find any useful information on how to do either, because I'm not working with text. Any help would be appreciated.
If you would like to email me, you can do so at: ALeonard@bruker-axs.com
|
|
|
|
|
I did exactly what you have said to do here. But, apparently some printers do not support
dc.StretchBlt (). They did before because my code worked for about a year. I don't know
what happened but it stopped working.
I am now trying as follows (with little success):
HANDLE hBitamp = ::CreateCompatibleBitmap (printerDC, width, height);
memDC.SelectObject (hBitmap);
// do some drawing into the printerDC
CBitmap it;
it.Attach (hBitmap);
unsigned char *bits = new unsigned char [640*480];
it.GetBitmapBits (640*480, bits);
::StretchDIBits (printerDC.GetSafeHdc (),.... bits,....);
And it does most of what I want. The image is flipped about the Y axis, but that's not a
problem. But, none of the line graphics appear. Any ideas?
Thanks,
Mike
|
|
|
|
|
how do you add items (subitems) under a column header in a CListView control?
if you don't understand my question, please look at the image I attached. it should explain it.
|
|
|
|
|
ListView_SetItemText(GetDlgItem(IDC_YOURLISTIVEW), iRowNumber, iColNumber,"Text");
==================
The original message was:
how do you add items (subitems) under a column header in a CListView control? if you don't understand my question, please look at the image I attached. it should explain it.
|
|
|
|
|
how do you add items under column headers in a CListView (using report view). ie: subitems
|
|
|
|
|
after i highlight the text the text will be able to change colour
so i can know that the text has been highlight before
|
|
|
|
|
I have a child program that is opened by a parent app. This child program is actually a seperate fully
functional program (such as a game) that is executed as a child program of the parent. This
child program has user buttons on it, how would I get my parent app to send a click event to this
user button contained within the child program?
|
|
|
|
|
I'm trying to build a simple ActiveX server control for use in my ASP pages.
The coding part is going just fine, but the stopping and rebooting of my web servers is driving me crazy.
If I just try to do a NET STOP on all the web services, the .dll *will* unload and I can copy it over, but when I try to do a NET START I get a 1068 error saying one of the support services failed to load. Which requires me to reboot the machine before I can get it working again.
I've been searching through MSDN (which usually answers my questions just fine, but I can't find anything about remote compiling and stopping/starting the web services).
If anyone has a better method, I'd love to hear it.
|
|
|
|
|
I'm trying to build a simple ActiveX server control for use in my ASP pages.
The coding part is going just fine, but the stopping and rebooting of my web servers is driving me crazy.
If I just try to do a NET STOP on all the web services, the .dll *will* unload and I can copy it over, but when I try to do a NET START I get a 1068 error saying one of the support services failed to load. Which requires me to reboot the machine before I can get it working again.
I've been searching through MSDN (which usually answers my questions just fine, but I can't find anything about remote compiling and stopping/starting the web services).
If anyone has a better method, I'd love to hear it.
|
|
|
|
|
When I add buttons to CMDIChildWnd I cannot tab between them, but the buttons respond on mouse. How make the tab key working ?
|
|
|
|
|
Hello -
I've a client application. The server sends data packs through a stream socket. It works very well for clients running on WinNT and Win95/98. But for some how, when I run the client in a Win2000 PC, whenever the server sends a specific large message (large compared with the other messages, but it's about only 650 bytes long) the client side gets a disconnection notification with error WSAENOBUFS.
I don't believe socket buffer are this small in Windows 2000. Does anyone out there have any clue... tip... trick?
Thanks in advance.
Best regards.
- Thales
|
|
|
|
|
I want to add some GIF (and animated GIF) files to my dialog app. Does anybody knows some links/source samples, where I could get inspiration? Please let me know. Thanks for your help.
|
|
|
|
|
Hmmmmm!
Do you really know about the licensing issue involved in using GIF in an application?
Please forget this and try animated icons, or take control and do a complete bitmap selection/rotation yourself, see MS debugger sample DEB for illustration.
Regards,
Paul.
|
|
|
|
|
Hi Forum,
I would like to set a bitmap (sign of firm) in the frame of the mainframe of a mdi-document! normaly its windows-default gray.
Have somebody a solution?
Thanks!
|
|
|
|
|
Here's the solution from The MFC Answer Book by Eugène Kain:
- Create a new CWnd-derived class (we'll call it CMdiBackground). This will be used to subclass the MDI client window.
- Add handlers to this class for WM_ERASEBKGND and WM_SIZE.
- In OnEraseBkgnd, call CWnd::OnEraseBkgnd() and then do whatever custom painting you want.
- Your OnSize() handler should call CWnd::OnSize(), followed by Invalidate(TRUE).
- Add a CMdiBackground member variable (call it m_wndMdiBackground) to your CMainFrame class.
- Add this code to the end of CMainFrame::OnCreate()
if ( !m_wndMdiBackground.SubclassWindow(m_hWndMDIClient))
{
return -1;
}
--Mike--
==================
The original message was:
Hi Forum,
I would like to set a bitmap (sign of firm) in the frame of the mainframe of a mdi-document! normaly its windows-default gray. Have somebody a solution?
Thanks!
|
|
|
|
|
Hello,
My codes at the following does this and more!!!
http://www.codeproject.com/docview/mditab.asp
Regards,
Paul.
|
|
|
|
|
I have created a custom control in a DLL and it works perfectly when used in a
dialog box or property page.
However, if I try to use the control in a view window, I get infinite recursion.
The following window procedure is straight out of David Kruglinksi:
LRESULT CALLBACK AFX_EXPORT
OCTimeslotCtrlWndProc(HWND h_wnd,UINT message,WPARAM w_param,LPARAM l_param)
{
CWnd* p_wnd;
p_wnd = CWnd::FromHandlePermanent(h_wnd);
if (p_wnd == NULL)
{
//
// first-time; a new window has been created
//
p_wnd = new OCTimeslotCtrl;
p_wnd->Attach(h_wnd);
ASSERT(p_wnd == CWnd::FromHandlePermanent(h_wnd));
}
ASSERT(p_wnd->m_hWnd == h_wnd);
LRESULT l_res = AfxCallWndProc(p_wnd,h_wnd,message,w_param,l_param);
return (l_res);
}
As I said, this works fine when the control is used in a dialog box. However, when used
in a view, the call to AfxCallWndProc simply indirectly recurses back to OCTimeslotCtrlWndProc.
A stack overflow immediately occurs.
Does anyone know how to get a custom control in a DLL to work everywhere?
|
|
|
|
|
I want to give people a 30 day working version of software that I write and after which time, if they haven't entered the correct password then the program fails to execute.
If I just hardcode some password like 'duckpond', then what stops an individual from giving that password to
someone else? Nothing.
I am confused and frustrated. Please, any response you can give me will be greatly appreciated. Details and a sample project would be cherished.
Sincerely,
Erich J. Ruth (an overworked graduate student)
|
|
|
|