|
I have LPBITMAPINFOHEADER structure (it's a frame from avi file),
i can save it as bmp file, but i need array of pixels only,
like this:
12 11 34 ....
32 11 22 ....
.............
22 44 44 ....
and save it as txt file
|
|
|
|
|
If it's a BITMAPINFOHEADER and not a BITMAPINFO, then you don't have a bitmap at all, just a descriptor of what dimensions one should be. Try casting to BITMAPINFO and accessing bmiColors. The first member of BITMAPINFO is BITMAPINFOHEADER, so a cast from BI to BIH will work fine where a BIH is needed.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I tryed, but i don't know how to get every pixels at all (array of RGB)!
If you know how it works, please help me.
I really need it.
Thanks
|
|
|
|
|
It's an array of RGBQUAD, so it's a pointer that contains the values for each pixel as red/green/blue/reserved. Generally Windows bitmaps go bottom to top, left to right, I presume this is the case here.
So to get the values you could do something like:
BITMAPINFO * pBMI = (BITMAPINFO*)MyBitmapInfoHeader;
RGBQUAD * pQuad = pBMI->bmiColors;
for (int x = 0; x < pBMI->bmiHeader.biWidth)
for (int y=0; y < pBMIHeader.biHeight)
{
unsigned char Red = *pQuad;
++pQuad;
unsigned char Green = *pQuad;
++pQuad;
unsigned char Blue = *pQuad;
++pQuad;
++pQuad;
}
That is untested, but you get the idea.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
|
I'm having trouble getting VB to pass in a String into a ATL Object created with VC++ 6.0 -- I dont use MFC. Please help if ya' can! all i really need to know is how to pass in/return... I found some MSDN articles, but they werent using an ATL object. Thanks in advance...
SHABBA!!
|
|
|
|
|
What seems to be the problem? You are using BSTR, right?
|
|
|
|
|
I wasnt using BSTR - I found several "ways to do it" on the net, but I wasnt sure so I didnt want to jump in before I asked.. but I'm using BSTR now and it works - thx!
SHABBA!!
|
|
|
|
|
Hi all,
If I have a global group which has another global
group inside it.For example I have a global group named test and another
global group test1 which is a member of test. I have a user say "A"
which is a member of test1. Now Is there a way I can programmatically find
out whether "A" is a member of test or not. If I try to use the
function "NetUserGetGroups" for "A" it does not return test as one
of the groups to which "A" belongs .
Thanks in advance
|
|
|
|
|
A co-worker sent me the following code so that I could read and write file properties to the file. I pretty much used the open file, open stream in one part to read the properties. I use the open file, open stream to write the properties elsewhere. I don't know why it's not opening the file for writing, and I was hoping someone knew why. At first, I also had Windows Explorer running because I constantly had to retype new comments and authors for test. That's not what's happening. I don't think IPropertySetStorage has a close, so I'm not sure what to do.
int main(int argc, char* argv[])
{
CoInitialize(NULL);
try
{
USES_CONVERSION;
CComPtr<ipropertysetstorage> l_spIPropertySetStorage;
HRESULT hr;
hr = StgOpenStorageEx( L"e:/test/test.spw", STGM_READWRITE | STGM_SHARE_EXCLUSIVE,
STGFMT_ANY, NULL, NULL, NULL, IID_IPropertySetStorage, (void**)&l_spIPropertySetStorage );
if (FAILED(hr)) throw _T("Failed in StgOpenStorageEx");
CComPtr<ipropertystorage> l_spIPropertyStorage;
hr = l_spIPropertySetStorage->Open(FMTID_SummaryInformation,
STGM_READWRITE | STGM_SHARE_EXCLUSIVE, &l_spIPropertyStorage);
if (FAILED(hr)) throw _T("Failed in l_spIPropertySetStorage->Open");
PROPSPEC l_aPropertySpec[2];
l_aPropertySpec[0].ulKind = PRSPEC_PROPID;
l_aPropertySpec[0].propid = PIDSI_AUTHOR;
l_aPropertySpec[1].ulKind = PRSPEC_PROPID;
l_aPropertySpec[1].propid = PIDSI_COMMENTS;
PROPVARIANT l_aResults[2];
hr = l_spIPropertyStorage->ReadMultiple( 2, l_aPropertySpec, l_aResults );
if (FAILED(hr)) throw _T("Failed to l_spIPropertyStorage->ReadMultiple");
if (S_FALSE == hr) throw _T("Properties not found");
if ( l_aResults[0].vt != VT_LPSTR ) throw _T("vt is not VT_LPSTR");
if ( l_aResults[1].vt != VT_LPSTR ) throw _T("vt is not VT_LPSTR");
CComBSTR l_bstrAuthor = l_aResults[0].pszVal;
CComBSTR l_bstrComment = l_aResults[1].pszVal;
MessageBox(NULL, OLE2T(l_bstrAuthor), _T("Author"), MB_OK);
MessageBox(NULL, OLE2T(l_bstrComment), _T("Comment"), MB_OK);
CComBSTR l_bstrNewAuthor = L"Brad";
CComBSTR l_bstrNewComment = L"Here's my new comments";
// set new values
PROPVARIANT l_aNewValues[2];
l_aNewValues[0].vt = VT_LPSTR;
l_aNewValues[0].pszVal = OLE2A(l_bstrNewAuthor);
l_aNewValues[1].vt = VT_LPSTR;
l_aNewValues[1].pszVal = OLE2A(l_bstrNewComment);
hr = l_spIPropertyStorage->WriteMultiple( 2, l_aPropertySpec, l_aNewValues, NULL );
if (FAILED(hr)) throw _T("Failed in l_spIPropertyStorage->WriteMultiple");
hr = FreePropVariantArray(2, l_aResults);
if (FAILED(hr)) throw _T("Failed in FreePropVariantArray");
}
catch(TCHAR *errMsg)
{
MessageBox(NULL, errMsg, NULL, MB_OK );
}
catch(...)
{
MessageBox(NULL, _T("Unknown Exception"), NULL, MB_OK);
}
CoUninitialize();
return 0;
}
|
|
|
|
|
Is there a easy way to convert a "int" to CString "Days:Hours:Minutes:Seconds";
.. Knowing that the "int" is a total of seconds..
Thanks,
Rob
|
|
|
|
|
time_t defined in <time.h> is an integral type (usually long int ) intended to store the number of seconds elapsed since 00:00, Jan 1, 1970 UTC. The function gmtime() accepts such a time_t value and returns a pointer to a tm struct whith that instant in time expressed as year, month, day and so forth. Assumming the number of seconds elapsed refer to that very moment in time (1970), your code should go along this line:
int iTime;
CString strTime;
tm * ptm=gmtime(&((time_t)iTime));
strTime.Format("%d:%d:%d:%d",ptm->tm_yday,ptm->tm_hour,
ptm->tm_min,ptm->tm_sec); The extension of this to the cases when the time elapsed is more than a year and when your zero time is not what gmtime() assumes I left you as an exercise
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Good day,
How would I go about determining whether a checkbox is checked/unchecked on a webpage inside my HTMLView? This is a custom webpage that I have the source and know all the info about it. The view doesn't allow users to cruise the net, its like the Outlook Express startup page. Any leads/info/help is greatly appreciated.
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
|
This is a nice article and I thank you for your response. The problem is that this is for CE and is a CCtrlView which uses DISPLAYCLASS (the name of the html control class under CE). Is it still possible with this as the base class or do I need to redo this class? Thank you once again for your response.
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
I will give that a shot. I will respond a bit later with the results.
Thank you very much.
|
|
|
|
|
I tried to get an IHTMLWindow2 interface using your suggestion, but was unsuccessful. I need to use the function HRESULT IHTMLWindow2::get_history(IOmHistory **p), but I have yet to find a way to reach that interface.
Perhaps I am not looking at the right place or that interface is not reachable. I am a little new to this area of VC++, please excuse me if the answer might be apparent.
Jamie Parent
VC++ Developer
Digital Immersion
jamie@digital-immersion.com
|
|
|
|
|
HI
I use (Microsoft FlexGrid Control, version 6.0) which is active x control .
It’s very useful, but some member functions are unclear .
Now I’m interested in how useing two functions and maybe they
will be the keys of the rest functions .
1 – void AddItem(LPCTSTR Item, const VARIANT& index)
to add new rwo BUT HOW???
2 - long GetRowData(long index)
to get data from specific row BUT HOW???
I put this qustion befor and one told me look for (MsFlxGrd.hlp) I tried to find it
but there is no file like this
Thank you very much …
AHMAD ALWASHALI
|
|
|
|
|
AddItem insert the text in the FixedRow for example:
AddItem("nnnn", 2) insert the text in the second row of the fixed column
If you want to insert data in a FlexGrid you need to set teh Row (SetRow), then the column (SetCol) and then SetText for insert the text in that Row and column.
If you need to read you can use the function GetText.
Good Luck
Carlos Antollini.
|
|
|
|
|
AddItem insert the text in the FixedRow for example:
AddItem("nnnn", 2) insert the text in the second row of the fixed column
If you want to insert data in a FlexGrid you need to set teh Row (SetRow), then the column (SetCol) and then SetText for insert the text in that Row and column.
If you need to read you can use the function GetText.
Good Luck
Carlos Antollini.
|
|
|
|
|
Hi every one
I use try and catch to initial some things or destroy when some thing wrong.
It’s works fine ,but an debug assertion occurred when destroy window.
My code like this :
BOOL MyDlg::OnInitDialog()
{
m_dat = new CDaoDatabase;
try {
m_dat->Open("dat.mdb");
}
catch (CDaoException* e){
delete m_dat;
m_dat=NULL;
e->ReportError();
e->Delete();
CDialog::OnCancel();
}
}
I hope for any one can help me to avoid that debug assertion and tell me more about it ...
Thank you,,,
AHMAD ALWASHALI
|
|
|
|
|
Off the top of my hat, try replacing OnCancel() with EndDialog(IDCANCEL) .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
The reason you get a debug assertion is so you can go into the debugger and see where the ASSERT has failed, and therefore do something about it. Often it doesn't actually kill your program, it is warning you however that you've leaked memory or done something else that needs cleaning up.
I'd suggest if you have this problem in future, you look at where it is occuring, and if you can't fix it, post where it crashes as well as the block of code that is crashing.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I have a program connected to SQL. It use 4 tables.In each table around 1 mln record. What should I do to spead up my programm. Basicly it doing the select and delete statement on 4 tables.
Thanks
|
|
|
|
|
Always for the better performance, you need to execute store procedure.
I need to do some questions.
How you select the records?
How delete the records? Theses are consecuence from the select, or the user select the records that he wants to delete? etc.
The better performance depends that you need to do, and how you must to do it.
Say me some details.
Best Regards....
Carlos Antollini.
|
|
|
|