|
Hi 'g':
Thank you very much for bringing that into attentaion as well.
I have learnt a lot from both of you.
Thank you
|
|
|
|
|
dear friends,
i am encountering a strange problem.
i have built a DLL containing a MFC Dialog in which i have inserted an active X component - Date Time Picker control.
when i try to call this dialog from my main application
the dialog doesnot appear at all.
i tried with simple MFC Dialog based exe it works fine.
can any one of you guide me on this
thanks and regards
prashant
|
|
|
|
|
have you put AFX_MANAGE_STATE( AfxGetStaticModuleState()); in dll before creating the dialog?
nave
|
|
|
|
|
hi naveen,
yes i have added the above macro correctly.
can you please try it once, and tell me if it works
thanks and regards
prashant
|
|
|
|
|
can you show me how you called the dialog from the exe?
prash pissey wrote: can you please try it once, and tell me if it works
nave
|
|
|
|
|
hi naveen,
here is he code
extern "C" __dllspec(dllexport) void CallDate()
{
AFX_MANAGE_STATE( AfxGetStaticModuleState());
CDateTimeDlg DateTimeDlg;
DateTimeDlg.DoModal();
}
thanks and regards
prashant
|
|
|
|
|
did u try removing that activex from the dialog?
where did u get this datetimectrl ActiveX? Is it the normal Date Time control among the windows common controls?
nave
|
|
|
|
|
hi nave,
it is Microsoft Date Time Picker control.
open VC++ go to dialog editor ,
right click, you will get a menu,
select "insert Active X",
a list of Active x components will appear.
in the list select "Microsoft Date Time Picker Control".
i have tried to remove the active X component and calling the DLL dialog.
then the dialog appears,works fine.
i suspect that acive x is causing the problem
thanks and regards
prashant
thanks and
|
|
|
|
|
ok I got the pblm. Put AfxEnableControlContainer(); in the InitInstance() function of the dll and then try.
nave
|
|
|
|
|
hi naveen,
i tried by adding AfxEnableControlContainer(); in the InitInstance() function of the dll . it didn't work.
if you have code sample. pls give it to me.
prashant
|
|
|
|
|
send me your mail id...
nave
|
|
|
|
|
hi naveen,
here is my mail id
pissey123@indiatimes.com
thanks and regards
prashant
|
|
|
|
|
I"m building a screen reader for my college project and I need to detect
words by the cursors position. Active Accessibilty(aac) is doing the job
well, but it gives me a full sentence and not the specific word in the
sentence where the mouse coursor is pointing at. For the ability to get this
word I need the Font properties, mainly width and height, of this acc
object. I need something like GetTextExtent but for the AccObject.
So how can I get the Font properties of an ActiveAccessibilty Object?
|
|
|
|
|
Hi to everyone, i have this code that tansform an IlpImage* in a bmp format..
char* bitmap_buf;
IplImage* image;
BITMAPINFOHEADER InfoBitmapHdr;
BITMAPFILEHEADER BitmapHdr;
image=cvLoadImage("nome_file.ext",1);
memset(&InfoBitmapHdr, 0, sizeof(BITMAPINFOHEADER));
memset(&BitmapHdr, 0, sizeof(BITMAPFILEHEADER));
InfoBitmapHdr.biWidth = image->width;
InfoBitmapHdr.biHeight = image->height;
InfoBitmapHdr.biSize = sizeof(BITMAPINFOHEADER);
InfoBitmapHdr.biPlanes = 1;
InfoBitmapHdr.biBitCount = 24;
InfoBitmapHdr.biSizeImage = image->imageSize;
BitmapHdr.bfType = 0x4d42;
BitmapHdr.bfSize = (DWORD) image->imageSize + sizeof(BITMAPFILEHEADER);
BitmapHdr.bfOffBits = (DWORD) sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + InfoBitmapHdr.biClrUsed * sizeof (RGBQUAD);
bitmap_buf= new char[image->imageSize];
memcpy( bitmap_buf, (char*)&BitmapHdr, sizeof(BITMAPFILEHEADER));
memcpy( bitmap_buf + sizeof(BITMAPFILEHEADER), (char*)&InfoBitmapHdr, sizeof(BITMAPINFOHEADER));
memcpy( bitmap_buf + sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER), (char*)image->imageData, image->imageSize - 60);
Can you tell me which variable must i use to visualize the bmp in a picture box of a window form application in visual c++??
Thanks for answers, regards.
|
|
|
|
|
You have all the info you need to use CreateDIBSection() to create a HBITMAP that can be set to
a picture box.
Even without a picture box, you could use StretchDIBits() with a BITMAPINFO and a pointer to
the image bits to draw the image diectly on a window.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Thanks Mark, i see form msdn the definition of hBitmap = CreateDIBitmap(hDC, lpInfo, CBM_INIT, lpBits, lpInfo,wUsage); but i can't associate my variable to that are required in the function. For example hdc(where is in my code??), lpinfo( InfoBitmapHdr.biWidth),CBM_INIT,lpbits(??),lpinfo(InfoBitmapHdr.biHeight),wUsage(??)
Thanks for answers, regards.
|
|
|
|
|
A BITMAPINFOHEADER is part of the BITMAPINFO struct required by CreateDIBSection().
The HDC is only used for bitmaps requiring a color table. The palette selected into the DC
is used by CreateDIBSection() to construct a color table when necessary. Since you have 24-bit
pixels it's not needed. You can use a screen DC.
I haven't used IplImage but based on what I've seen, the imageSize member is the size of just
the pixel data, not pixel data with Windows BITMAPINFO stuff attached. If I'm wrong you'll
have to adjust the following code a bit
Here's a modified version of your sample code. Note that this code is hardwired for 24-bit
images...
BYTE* bitmap_buf;
IplImage* image;
BITMAPINFO bmi;
image=cvLoadImage("nome_file.ext",1);
memset(&bmi, 0, sizeof(BITMAPINFO));
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = image->width;
bmi.bmiHeader.biHeight = image->height;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 24;
bmi.bmiHeader.biCompression = BI_RGB;
bmi.bmiHeader.biSizeImage = image->imageSize;
HDC hdc = ::GetDC(0);
HBITMAP hBitmap = ::CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &bitmap_buf, NULL, 0);
::ReleaseDC(0, hdc);
if (hBitmap)
{
memcpy( bitmap_buf, image->imageData, image->imageSize );
...
}
*EDIT*
I looked up the IplImage structure. I'm not sure what the default alignment of rows of pixel
data is in OpenCV, but for a Windows DIB, rows must be aligned to a DWORD (4-byte) boundary.
If this does not match the IplImage alignment (based on image->widthStep) then your resulting
bitmap will look skewed
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Thanks for answers,it's very useful.
There's a prolem when i try to compile:
HBITMAP hBitmap = ::CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &bitmap_buf, NULL, 0);
generate error C2664: 'CreateDIBSection' : cannot convert parameter 4 from 'BYTE **' to 'void **'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
so i try to do a safe cast, i add this line before the CreateDIBSection
void* buff=safe_cast<void *="">(bitmap_buf);
and use &buff instead of bitmap_buf in CreateDIBSection but the result is a list of build error:
error LNK2028: unresolved token (0A0002FA) "extern "C" int __stdcall ReleaseDC(struct HWND__
*,struct HDC__ *)" (?ReleaseDC@@$$J18YGHPAUHWND__@@PAUHDC__@@@Z) referenced in function "private: void __clrcall WinCam::Form1::capimgbut_Click(class System::Object ^,class System::EventArgs ^)" (?capimgbut_Click@Form1@WinCam@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
WinCam.obj : error LNK2028: unresolved token (0A0002FB) "extern "C" struct HBITMAP__ * __stdcall CreateDIBSection(struct HDC__ *,struct tagBITMAPINFO const *,unsigned int,void * *,void *,unsigned long)" (?CreateDIBSection@@$$J224YGPAUHBITMAP__@@PAUHDC__@@PBUtagBITMAPINFO@@IPAPAXPAXK@Z) referenced in function "private: void __clrcall WinCam::Form1::capimgbut_Click(class System::Object ^,class System::EventArgs ^)" (?capimgbut_Click@Form1@WinCam@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
...and so on.
I don't know why...
Thanks however for help.
Regards.
|
|
|
|
|
How to do a listbox that have columns in different width?
|
|
|
|
|
You can use CListViewCtrl if you want more than one column with different width.
For more information on how to use it, Search google.
Anurag Gandhi.
|
|
|
|
|
Is CListViewCtrl same as CListCtrl?
|
|
|
|
|
Im not sure but I think I saw like your answer some time ago and I answered to its question with an example(I think it was with CListCtrl) search on the Search comments.
|
|
|
|
|
I would like to resize a group box control during run-time (for instance in the OnInitDialog function). I only need to change it's height (make it smaller).
How can I do this?
I tried the following (which didn't work..):
CRect rect;
GetDlgItem(IDC_STATIC_GRP_SEARCH)->GetClientRect(rect);
rect.SetRect(11,280,66,280);
rect.DeflateRect(0,0,0,rect.Height()-50);
SetRect did not work so I tried using DeflateRect - and that also did not work.
Please help...
|
|
|
|
|
You're changing a RECT , but you still need to change the size of the control. SetWindowPos() will do that.
|
|
|
|
|
Then set the modified rect back to the control. Use either of;
SetWindowPos
MoveWindow
--
=====
Arman
|
|
|
|