|
I have a bitmap that I get from a third party decompressor of a video stream. The bitmap comes out at a resolution of 720*243 and 24-bits. I would to like to shrink it down and copy it to an offscreen bitmap that is 320*240 and 24-bits in order to speed up my motion detection algorithm and then blit that image to a screen without using the original image and StretchDIBits().
I believe I would want to create a CompatibleDC and a compatible bitmap to go with it then do a StretchDIBits to that CompatibleDC.
Am I right in this assumption and does anyone have some example code of how that is done?
Thanks,
Clint
|
|
|
|
|
You can also use CopyImage API function to resize the bitmap.
Deepak Khajuria
|
|
|
|
|
I think this is what I am looking for but what does it mean when it refers to the handle of the image. Would it be something like a HBITMAP?
Cheers,
Clint
|
|
|
|
|
You can pass HBITMAP in handle(First Parameter) of CopyImage.
Deepak Khajuria
|
|
|
|
|
Hi,
I am trying to draw a grid onto a CView.
The grid doesn't fit into the far right and lower bottom regions correctly. My suspicion is its some strange effect with rounding. It creates a strange effect when you look at the result after resizing the view.
Anyway it's only a small fragment of code, and i would be very grateful if someone would give it a whirl and give their diagnosis.
void CTestView::OnPaint()
{
CPaintDC dc(this); // device context for painting
CRect ScreenDimensions;
GetClientRect(ScreenDimensions);
POINT line[2]; //Array Of Points, Start And End Of Line
//Draw The Columns
for (int col=0; col <=50; col++)
{
line[0].x = ScreenDimensions.Width() / m_cols * col;
line[0].y = 0;
line[1].x = ScreenDimensions.Width() / m_cols * col;
line[1].y = ScreenDimensions.Height();
dc.Polyline(line,2);
}
//Draw The Rows
for (int row=0; row <=50; row++)
{
line[0].x = 0;
line[0].y = ScreenDimensions.Height() / 50 * row;
line[1].x = ScreenDimensions.Width() ;
line[1].y = ScreenDimensions.Height() / 50 * row;
dc.Polyline(line,2);
}
}
Cheers
Richard Jackson
|
|
|
|
|
To help with rounding errors, always multiply first, then divide.
The following works for me.
int m_cols = 42;
CPaintDC dc(this);
CRect ScreenDimensions;
GetClientRect(ScreenDimensions);
POINT line[2];
for (int col=0; col <= 50; col++)
{
line[0].x = ScreenDimensions.Width() * col / m_cols;
line[0].y = 0;
line[1].x = ScreenDimensions.Width() * col / m_cols;
line[1].y = ScreenDimensions.Height();
dc.Polyline(line,2);
}
for (int row=0; row <=50; row++)
{
line[0].x = 0;
line[0].y = ScreenDimensions.Height() * row / 50;
line[1].x = ScreenDimensions.Width() ;
line[1].y = ScreenDimensions.Height() * row / 50;
dc.Polyline(line,2);
}
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
I am currently writing an app that does not support doc/view. I want to be able to section of the FrameWnd into different views. I am able to split the windows fine at compile time. I want to be able to split the windows while the app is running. I tried to use the dynamic splitwindow but I had trouble because I am not using documents.
Does anyone have a sample of code that does this without using doc/view?
Or does anyone have any ideas?
|
|
|
|
|
(1) Add a CSplitterWnd to your CMainFrame class say m_split.
(2) Derive two view classes [say you have CMyTree and CMyList which are classes derived from CTreeView and CListView]
(3) m_split.CreateStatic(this,1,2);
(4) m_split.CreateView(0,0,RUNTIME_CLASS(CMyTree),CSize (150,100), NULL);
m_split.CreateView(0,0,RUNTIME_CLASS(CMyList),CSize (150,100), NULL);
Hope this helps
Nish
|
|
|
|
|
Thanks for replying,
This is what I had done for the original split window....
if(!m_ospltWindow.CreateStatic(this,1,2))
return false;
if(!m_ospltWindow.CreateView(0,1,RUNTIME_CLASS(CGraphView),CSize(200,200),pContext) )
return false;
if(!m_ospltWindow.CreateView(0,0,RUNTIME_CLASS(CChildView),CSize(200,200),pContext) )
return false;
I tried doing what you said for splitting one of the above splits but it didnt work. I have a menu option that when selected I want one ov the above splits to split again...know what I mean...
So in my OnSplitAgain function I had....
m_ospltWindow1.CreateStatic(m_ospltWindow,1,2);
m_ospltWindow1.CreateView(0,1,RUNTIME_CLASS(CGraphView),CSize(200,200),NULL);
m_ospltWindow1.CreateView(0,0,RUNTIME_CLASS(CChildView),CSize(200,200),NULL);
but it didnt work....
Jeremy
|
|
|
|
|
Hi,
I have a slight problem copying a class whose pointer I have. I have an abstract base class, and several derived classes, and a pointer pointing to one of the derived classes, but the pointer is of BaseClass* type. I want to copy the derived. Can I do it using the copy constructor?
Here's a little code
class CBaseClass
{
protected:
CBaseClass();
CBaseClass(CBaseClass &src) {.... foo ....};
}
class CDerivedClass : public CBaseClass
{
public:
CDerivedClass();
CDerivedClass(CDerivedClass &src) {.... foo ....};
}
In the example how could I do this
CBaseClass *destination;
CBaseClass *source = new CDerivedClass();
.... how can I copy the "source" to "destination", and I don't mean a binary copy - there must be a proper C++ way of doing it.
With time we live, with money we spend!
Joel Holdsworth
|
|
|
|
|
Hmmm, what you're asking for is the equivalent of a virtual copy constructor, which C++ doesn't have. I'm not sure how common your scenario is, but I personally haven't run into it, as far as I can remember...
Anyway, you have one of two options:
1. Create a virtual "Clone" function in your base class and override it in your derived classes.
2. Find the type of the object to which the pointer points and create a new object of that type using the copy constructor. For example, you the code you give, you know that source points to a CDerivedClass object. You can then do this:
CBaseClass* destination = new CDerivedClass(*(CDerivedClass*)source);
I'd go with option 1; it's cleaner and safer.
Regards,
Alvaro
|
|
|
|
|
Is destination initialized to anything or do you just want to point destination at the same data source is pointing at? If the later then it's just
<br />
destination = source;<br />
or did you mean
<br />
CDerivedClass *destination;<br />
CBaseClass *source = new CDerivedClass();<br />
in which case it's
<br />
destination = dynamic_cast<CDerivedClass*>(source);<br />
could you provide more info on what you want to do? How are destination and source being used?
Todd Smith
|
|
|
|
|
Hi,
I have an ActiveX control on top of a CFormView and I'm trying to use tooltips in my application. It appears that when the OnToolTipNeedText() method is called, it get's called once for the ActiveX control and once for the CFormView. I'm pretty sure of this because I get two tooltips in my application, one below the mouse and the other at the bottom of the window.
Does anyone know how I can tell if the message is coming from the ActiveX control or the CFormView? I tried looking at the pNMHDR->hwndFrom and compared it to myCtrl->m_hWnd but it is never equal, in fact, it never equals the CFormView->m_hWnd either. I basically just need to concern myself with the message from the ActiveX control and ignore all other messages.
Thanks for any help you can provide,
Craig
|
|
|
|
|
I am building a rather simple dialog program that receives input, however, I am having trouble linking this generated output to be transmitted in email form through outlook explorer. I am still pretty much a beginner programer in C++, so any help would be appreciated.
Thanks
B-rock
B-Rock
|
|
|
|
|
I'm getting very frustrated with trying to send email from my computer programmatically. From what I've been able to find out, there are two choices:
- use MAPI:
problem: It pops up dialog boxes requiring user input when it is unable to send messages or when various errors happen. Therefore it is not useful to me since I want to run the program on a computer that isn't being looked at by a human.
- use SMTP:
problem: You need a computer that you can connect to on port 25 and say HELO\r\nMail From: a@b.c\r\nRCPT To: x@y.z\r\ndata\r\nfirstline\r\nlastline\r\n.\r\nQUIT\r\n or whatever. In any case I don't have a computer that I can send this through so I can't do this either.
But check out the code below for an example of doing MAPI. You have to put a line of code each of mapi init and uninit and include mapi.h. The functions i call at the end here just display the appropriate error message according to a switch statement using strings taken from the msdn docs. hope it helps.
/*
CMfcserverDlg::Mail(CString subject, CString text) {
LPMAPISENDMAIL lpfnMAPISendMail = (LPMAPISENDMAIL) GetProcAddress (m_mapiModule,"MAPISendMail");
LPMAPILOGON lpfnMAPILogon = (LPMAPILOGON) GetProcAddress (m_mapiModule,"MAPILogon");
LPMAPILOGOFF lpfnMAPILogoff = (LPMAPILOGOFF) GetProcAddress (m_mapiModule,"MAPILogoff");
LHANDLE lhSession = 0;
char subject[] = "this is the subject";
char message_text[] = "automated\r\nhello\r\nthis is the message text\r\nblah\r\nblah\r\nblah\r\ngoodbye";
char str_originator_name[] = "alexander the originator";
char str_recip_name[] = "alexander the recipient";
char str_originator_address[] = "snowman@north.pole";
char str_recip_address[] = "SMTP:agriffing@hotmail.com";
MapiRecipDesc originator;
originator.ulReserved = 0;
originator.ulRecipClass = MAPI_ORIG;
originator.lpszName = str_originator_name;
originator.lpszAddress = str_originator_address;
originator.ulEIDSize = 0;
originator.lpEntryID = 0;
MapiRecipDesc recip;
recip.ulReserved = 0;
recip.ulRecipClass = MAPI_TO;
recip.lpszName = str_recip_name;
recip.lpszAddress = str_recip_address;
recip.ulEIDSize = 0;
recip.lpEntryID = 0;
MapiMessage msg;
msg.ulReserved = 0;
msg.lpszSubject = subject;
msg.lpszNoteText = message_text;
msg.lpszDateReceived = 0;
msg.lpszConversationID = 0;
msg.flFlags = 0;
msg.lpOriginator = &originator;
msg.nRecipCount = 1;
msg.lpRecips = &recip;
msg.nFileCount = 0;
msg.lpFiles = 0;
ULONG ret;
ret = lpfnMAPILogon(0, 0, 0, 0, 0, &lhSession);
if (ret != SUCCESS_SUCCESS) {
HandleMAPILogonError(ret);
} else {
ret = lpfnMAPISendMail(lhSession, 0, &msg, 0, 0);
if (ret != SUCCESS_SUCCESS) {
HandleMAPIError(ret);
}
}
lpfnMAPILogoff(lhSession, 0, 0, 0);
}
*/
|
|
|
|
|
If you want to use Outlook Express or whatever it is, that is your default email client, try this.
Use ShellExecute and open "mailto:aaa@aaa.com"
replace aaa@aaa.com with your target email address
I hope I got your question correct.
Nish
|
|
|
|
|
How can I show the progress of an upload or download I have in progress in my program?
My program connects to my ftp and nagivates to a folder and uploads a specific file type, sdm.
I have a progress control in the same window which has time to complete underneath. How do I go about making it work for when an upload is being done or a download?!?
Hope that wasnt too broad!
Thanks
Ashman
|
|
|
|
|
Start off a thread which can update the progress bar till your upload/download finishes
Nish
|
|
|
|
|
or put your upload/download stuff in a thread. And update the progress bar in your main thread
Nish
|
|
|
|
|
Is there a way to align text in a status bar pane? I need to right align one of the panes in my status bar.
Also, I need to know how to include a tool-tips type display when the pane is scrolled over. Any help is appreciated.
Thanks,
Andrew
|
|
|
|
|
Hi all,
I have two custom open file dialog. One is very large, and the other is approximatively the same size as the default open dialog.
My problem is under win2000, the open dialog remember it's last size. You see the problem, if i open the bigger one first, and after closing, i open the small one, suprise, it's not small, it's now the same size as the last one.
I can not find a trick to not let Win2000 remember the last size.
Can someone have some clues?
|
|
|
|
|
Is there a way to highlight the entire first column of a listview and not just highlight the contents of the cell?? LVS_EX_FULLROWSELECT highlights the entire row, which I don't want. But not using that means that only the contents of the first column are highlighted.
Is there a way to adjust the margin in either;
a subitem of a listview
or a combobox
like you can set the margin in CEdit?
What i'd really like to be able to do...is move, ever so slightly, the edit portion of the combobox. I paint a combobox in a subitem of a listview. When the row gets focus, I grab the text from the subitem and put it in the combobox. The text shifts to the right a couple pixels. Plus the combobox border takes up a lot of space and i'd like to shift the text shown up 2 pixels. Any ideas?
Anyone have an example of column resizing when the user drags the gridline. I don't have a listview header but still want the user to be able to resize the column width.
thanks
mike
|
|
|
|
|
Can a VB Active X dll be call from a win32 console application? I have managed to call it from a MFC but I would like to called it from a win32 console application. If the answer to the question is yes HOW????
thanks
|
|
|
|
|
How are you calling it from MFC? As far as I'm aware COM objects can be called from console applications. A simple call to CoCreateInstance with the IID and CLSID of your COM server should be prove either way if it works. Don't forget to call CoInitialize first though.
Michael
|
|
|
|
|
Create a new class from Importing library. This option will create a new class with the method in the dll
Best Regards
Carlos Antollini.
|
|
|
|
|