Hi :) i need your (or any one's) help again :) I'm trying for long time to change this code in order to make an 8Bit color Bitmap but it's not working :confused: I'll be greatfull for any help!
im79
Posts
-
Creating a Bitmap from a Framegrabber Image -
CEdit max text size (MFC, VC++6, WinXP)Hello, I use the following funktion to write log info into a write protected CEdit window for debuging purposes: void CMyprogDlg::log(LPCTSTR lpszText) { long iBegin, iEnd; CString time; CString msg; time = m_CTime_time.Format("%d.%m %H:%M:%S"); msg.Format("[%s] %s", time, lpszText); iBegin = m_CEdit_log.LineIndex(-1); iEnd = iBegin + m_CEdit_log.LineLength(iBegin); m_CEdit_log.SetSel(iBegin, iEnd); m_CEdit_log.ReplaceSel(msg); } for example : log("blablabla\r\n"); It works well and i'm using it in alot of programs instead of stdout. The problems is that when i'm trying to put a lot text lines in the window, after a few hundred lines, the function doesn't work as supposed anymore. Instead of creating new lines, the new text replaces the last line. I'll be very greatfull for any help! Best Regards, im79
-
Writing a range to a text file ?Hello everybody, i'm new to VB and i need to write a macro for Execl with VBA :~ . I'm trying to save a part of table to a text file. I know alreay how to makr this part with the range function, unfortunately there's nothing like range.save() . Can you tell me how to write it to a text file? Thank you very much in advance :-)
-
CString Pathnames - backslashHi toxcct, hi everybody, i' get the pathname CString with CFileDialog and then i pass it to function casts the CString to char* then it opens the file with fopenf. The C function fopenf is used because of a legacy code with a lot of fscanf calls with a specific foramt. I'm forecd to use theh old code for many reasons. Now, the orignal code workes with double backslashes, and if don't change the single backslashes to double, it won't work. Now i'm more confused :confused: Is there a difference when useing CFile::open() instead? In that case i need to rewrite the whole fscanf block :~ Thank u all for u help :)
-
CString Pathnames - backslashHi, i need the pathname to open the file. I get the filenames list form a CFileDialoge object. I found some examples in MSDN while reading about CFile where the pathnames have double back slashes. So i think i have to change the back slashes into double backslashes :confused:
-
CString Pathnames - backslashHi everybody, i have a problem with fullpath file names containing back slashes. The file names are saved in a CString array. The problem are the singel back slashes for ex. "C:\dir1\dir2\file.txt". Is there an easy way to substitute each "\" with "\\"? Thanks in advance :-)
-
Creating a Bitmap from a Framegrabber ImageHi hfry It's working :-D Thank you very much :rose:
-
Creating a Bitmap from a Framegrabber Imagehfry wrote:
im79 wrote: myBitmap->CreateCompatibleBitmap(pDC, m_iWidth, m_iHeight); What are you trying to do here?
I thought that i have to convert the DIB to a DDB Bitmap, so i guess that's wrong :~ I just want to display the Bitmap in a picture control, but it's not as easy as i thought
hfry wrote:
The CBitmap::LoadBitmap function is used to load an image into the bitmap, not set an image into a picture control...
Yes that's stupid, I should have read the MSDN manuals
-
Creating a Bitmap from a Framegrabber ImageHi, i've tried your code in my appicaltion and have another problem now :sigh:. I need a CBitmap object, so i tried the following:
CDC *pDC = GetDC(); CBitmap* myBitmap; myBitmap = CBitmap::FromHandle(hBitmap); myBitmap->CreateCompatibleBitmap(pDC, m_iWidth, m_iHeight); myBitmap->LoadBitmap(IDC_STATIC_PICTURE);//picture control in my dialog
I get an Unhandled exception in wingdi.cpp line 1102:BOOL CGdiObject::Attach(HGDIOBJ hObject) { ASSERT(m_hObject == NULL); // <= line 1102 if (hObject == NULL) return FALSE; CHandleMap* pMap = afxMapHGDIOBJ(TRUE); ASSERT(pMap != NULL); pMap->SetPermanent(m_hObject = hObject, this); return TRUE; }
This is the call stack: >mfc71d.dll!CGdiObject::Attach(void * hObject=0x0305061d) Line 1102 + 0x1c C++ mfc71d.dll!CBitmap::CreateCompatibleBitmap(CDC * pDC=0x00816af4, int nWidth=400, int nHeight=400) Line 217 + 0x25 C++ I hope you can help me again here:) im79 -
Creating a Bitmap from a Framegrabber ImageHello all, hello hrfy and thanks for your answer :) Yes it is 8-bits per pixel. I didn't set the color table. I just called CreateBitmap or DIBitmap passing width, length, the pointer to the pixel array and so on. I as i explaind in my first posting, i don't have a BITMAPINFO, can make one manualy? :confused: I tried manythings but nothing worked. I'm new to windows programming and MFC. I'm not at work now, so i don't have the source code here right now. Eventhough i cann't provide enough info, i hope u can still help me on this one :~ Kind regards and thanks again , im79
-
Creating a Bitmap from a Framegrabber ImageHello all, i'm trying to display a Bitmap in a Picture Control. The picture is captured by a CMOS camera (gray), and all i have is a pointer to the image in the Framegrabber buffer. The problem is that i don't have a real bitmap in that buffer, just an array with pixel values. The technical support of the Framgrabber producer couldn't help me till now and i'm still waiting for thier reply :sigh:. I was trying to create a Bitmap manualy and fill in all the needed structures like BITMAPINFO and so on but nothing worked. Can you tell me how to construct a bitmap from an pixelarray, just knowing the lenght, width and that's it is gray scale picture. I would be very greatfull for any kind of help! I wish you a nice Weekend :) im79