|
Do a search on this forum for:
Sorting data in CListCtrl columns
I asked the same question. Let me know when you are done with the sorting implementation.
Ammar
|
|
|
|
|
Thanks a lot. I have solved the problem.
|
|
|
|
|
I try to create and show a bitmap based on one short array.No error occours during compile,but the bitmap just don't show on the view.
My code as follow:
void CReadfile1View::DrawDIBSection(HDC hDC , int xDest,int yDest,int w, int h,signed short*image)
{
BITMAPINFOHEADER *bih=0;
// HDC hDC=0;
HBITMAP hbm;
void *bits;
try
{ // allocate room for BITMAPINFOHEADER and color mask's
if(!(bih = (BITMAPINFOHEADER*)malloc(sizeof(BITMAPINFOHEADER))))
throw 0;
ZeroMemory(bih,sizeof(BITMAPINFOHEADER));
bih->biSize = sizeof(BITMAPINFOHEADER);
bih->biWidth = w; // .
bih->biHeight = h; // match array-size
bih->biPlanes = 1;
bih->biBitCount = 16;
bih->biCompression = BI_RGB; // we use 5:5:5 format
bih->biSizeImage = bih->biWidth * 2 * bih->biHeight;
if(!(hDC = ::GetDC(0))) throw 0; // create the 16-bit DIBSECTION
if(!(hbm = ::CreateDIBSection(hDC,(BITMAPINFO*)bih,DIB_RGB_COLORS,&bits,0,0))) //
throw 0; // get the array into the DIBSECTION
if(::SetDIBits(hDC,hbm,0,h,image,(BITMAPINFO*)bih, DIB_RGB_COLORS) != h)
throw 0;
}
catch(...)
{
// cout<<"unknown type of exception throw"<<'\n';
}
HDC hDCMem=::CreateCompatibleDC(hDC);
HGDIOBJ hBmpOld=::SelectObject(hDCMem,hbm);
BitBlt(hDC,xDest,yDest,bih->biWidth,bih->biHeight,hDCMem,0,0,SRCCOPY);
::SelectObject(hDCMem, hBmpOld);
::DeleteDC(hDCMem);
if(hDC) ::ReleaseDC(0,hDC);
if(bih) free(bih);
}
void CReadfile1View::OnDraw(CDC* pDC)
{
CReadfile1Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
DrawDIBSection(*pDC,10,10,WIDTH,HEIGHT,pDoc->Image[0]);
}
Who can tell me why it don't works and how to improve?!
thanx!
fly against the wind
|
|
|
|
|
Hi,
I didn't have much time to check your code completely, but I think the source line:
if(!(hDC = ::GetDC(0))) throw 0; // create the 16-bit DIBSECTION
is incorrect.
You re-initialize the local parameter hDC, which was sent by the call to your DrawDIBSection(..) function in the OnDraw method. It will be set to a DC for the desktop, by ::GetDC(0).
This hDC is used for the BitBlt(..) command later.
Not a sollution, but just a hint...
Istvan Eperjesy
|
|
|
|
|
Hi All !!
I've stupid problem !!! It make me crazy
I want to use WinAPI struct ALTTABINFO
this struct is contained in <winuser.h>
but no way to use this struct because compiler performs an output:
error C2065: 'ALTTABINFO' : undeclared identifier
for example
//#include <winuser.h> //but I must include windows.h, look in help
#include<windows.h>
void main(void)
{
ALTTABINFO myInfo;// error!! why???
.....
}
Best regards VitSoft
|
|
|
|
|
If you do not have MSDN, get it and get it quick, you can't possible write windows programs without it (I have but that was many moons ago).
The ALTTABINFO structure contains status information for the application-switching (ALT+TAB) window.
typedef struct tagALTTABINFO {
DWORD cbSize;
int cItems;
int cColumns;
int cRows;
int iColFocus;
int iRowFocus;
int cxItem;
int cyItem;
POINT ptStart;
} ALTTABINFO, *PALTTABINFO, *LPALTTABINFO;
Members
cbSize
Specifies the size, in bytes, of the structure.
cItems
Specifies the number of items in the window.
cColumns
Specifies the number of columns in the window.
cRows
Specifies the number of rows in the window.
iColFocus
Specifies the column of the item that has the focus.
iRowFocus
Specifies the row of the item that has the focus.
cxItem
Specifies the width of each icon in the application-switching window.
cyItem
Specifies the height of each icon in the application-switching window.
ptStart
Specifies the top-left corner of the first icon.
Requirements
Windows NT/2000 or later: Requires Windows NT 4.0 SP6 or later.
Windows 95/98/Me: Requires Windows 98 or later.
Header: Declared in Winuser.h; include Windows.h.
See Also
Windows Overview, Window Structures, GetAltTabInfo
|
|
|
|
|
Hi !!!
Thanks !!
I've MSDN lib,I know it possible to redefine this struct, but when you want use GetAltTabInfo(..) function
you have the same problem.
Why compiler don't know about this function or struct ?
error C2065: 'GetAltTabInfo' : undeclared identifier
I'm a long time work with VC, but it's first time when i have problem like this ;(
Thanks and Good Luck
|
|
|
|
|
If you look in winuser.h, you'll see the ALTTABINFO declaration is wrapped in an #if (WINVER >= 0x0500) block. You'll need to #define WINVER 0x0500 before your #include statements.
--Mike--
http://home.inreach.com/mdunn/
The Signature, back by popular demand: Buffy. Pajamas.
|
|
|
|
|
I need to change the MSysObjects attributes to read only thru VC.
I will be able to read tables info if I could do that. By default, MSysObjects cannot be read. I can change the setting thru Access 2000 but I want to do it thru VC.
Help!
Ammar
|
|
|
|
|
Is there a function that will tell me if
Day Light Savings is turned on and if an OS is
running in summer or winter
Warm Regardz
|
|
|
|
|
I think the CRT variable _daylight indicates whether daylight savings time is in effect. The docs aren't exactly crystal clear, though.
--Mike--
http://home.inreach.com/mdunn/
The Signature, back by popular demand: Buffy. Pajamas.
|
|
|
|
|
Thanks for the speedy response Mike,
Yes you are right !
but its now proving a devil to test for
I'll implement it anyway as its several months before DST comes into effect here, To see if it works correctly.
Regardz
Colin
|
|
|
|
|
I am looking for a fast algorithm for outputing the co-ordinates of points along an ellipse, given the bounding rectangle.
Basically as the Ellipse drawing function only that it outputs the co-ordinates of the pixels rather than drawing them.
Any suggestions would be gratefully received.
Happy programming!!
|
|
|
|
|
This is just quick and dirty code (written straight in an untested). This code assumes the definition of things like point2d (it's a floating point 2d point) and pi. The maths is pretty simple trigonometry, so if you have any trouble go to the library. Here goes:
<br />
point2d *GetEllipsePoints(float height, float width, point2d center, long divisions)<br />
{<br />
point2d *theList = new point2d[divisions];<br />
<br />
for (long i = 0; i < divisions; i++)<br />
{<br />
theList[i].x = cos(((float)i/(float)divisions) * pi / 180.0f)*width*0.5;<br />
theList[i].y = sin(((float)i/(float)divisions) * pi / 180.0f)*height*0.5;<br />
}<br />
<br />
return theList;<br />
}<br />
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
I am getting linker error for CM_Locate_DevNode() &
CM_Reenumerate_DevNode()functions
as undefined functions.
I have included cfgmgr32.h & i am linking with cfgmgr32.lib.
Can anyone tell me,why is it so??
TIA
Neha
|
|
|
|
|
Hi All,
I want to generate a .LIB file from a .DLL. What is the tool that is available in VC++ to do this?
Thanks
regards,
YHTay
|
|
|
|
|
How do I start programming a Visual Basic Add-In? I tried the following:
#import "C:\\Program Files\\Microsoft Visual Basic\\VB98\\VB6EXT.OLB"
The compiler failed when it tried to define the 'CommandBarsPtr' type.
Any ideas?
Thanks in advance
Jamie Nordmeyer
Portland, Oregon, USA
|
|
|
|
|
How do I start programming a Visual Basic Add-In? I tried the following:
#import "C:\\Program Files\\Microsoft Visual Basic\\VB98\\VB6EXT.OLB"
The compiler failed when it tried to define the 'CommandBarsPtr' type.
Any ideas?
Thanks in advance
Jamie Nordmeyer
Portland, Oregon, USA
|
|
|
|
|
I'm wondering if it's at all possible to determine the hard drive location of a program from within that program. Any help would be greatly appreciated!
-Sparticus
|
|
|
|
|
char appPath[MAX_PATH+1];
DWORD res = GetModuleFileName(AfxGetInstanceHandle(), appPath, MAX_PATH);
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Greetings,
I am trying to get the length of the avi source file, and to play it in the time line at that length,
but for some reason I am always getting a "0" returned for the media length. Any suggestions on how
to retreive these?
I am under Windows 2000, and I am using directx 8.0 sdk with visual C++ 6.0.
The code I am having trouble with is marked below as "// PROBLEM AREA!!!!"
// ------------------------------------------------------------------
// Code from Directx 8.0 sdk help file.
// <article:> (Constructing a Timeline)
// ------------------------------------------------------------------
void main( void )
{
// Start by making an empty timeline.
IAMTimeline *pTL = NULL;
CoInitialize(NULL);
CoCreateInstance(CLSID_AMTimeline, NULL, CLSCTX_INPROC_SERVER,
IID_IAMTimeline, (void**)&pTL);
// GROUP: Add a video group to the timeline.
IAMTimelineGroup *pGroup = NULL;
IAMTimelineObj *pGroupObj = NULL;
pTL->CreateEmptyNode(&pGroupObj, TIMELINE_MAJOR_TYPE_GROUP);
pGroupObj->QueryInterface(IID_IAMTimelineGroup, (void **)&pGroup);
// Set the group media type.
AM_MEDIA_TYPE mtGroup;
ZeroMemory(&mtGroup, sizeof(AM_MEDIA_TYPE));
mtGroup.majortype = MEDIATYPE_Video;
pGroup->SetMediaType(&mtGroup);
pTL->AddGroup(pGroupObj);
pGroupObj->Release();
// TRACK: Add a track to the group.
IAMTimelineObj *pTrackObj;
IAMTimelineTrack *pTrack;
IAMTimelineComp *pComp = NULL;
pTL->CreateEmptyNode(&pTrackObj, TIMELINE_MAJOR_TYPE_TRACK);
pGroup->QueryInterface(IID_IAMTimelineComp, (void **)&pComp);
pComp->VTrackInsBefore(pTrackObj, 0);
pTrackObj->QueryInterface(IID_IAMTimelineTrack, (void **)&pTrack);
pTrackObj->Release();
pComp->Release();
pGroup->Release();
// SOURCE: Add a source to the track.
IAMTimelineSrc *pSource = NULL;
IAMTimelineObj *pSourceObj;
pTL->CreateEmptyNode(&pSourceObj, TIMELINE_MAJOR_TYPE_SOURCE);
pSourceObj->QueryInterface(IID_IAMTimelineSrc, (void **)&pSource);
// PROBLEM AREA!!!!
// How do I see how long the avi file is, and set the timeline to stay for that long????
// For some reason pSource->GetMediaLength(ref); always returns "0"???
// Set the times and the file name.
pSourceObj->SetStartStop(0, 50000000);
pSource->SetMediaName(L"C:\\MyExample.avi");
pSource->SetMediaTimes(40000000, 140000000);
pTrack->SrcAdd(pSourceObj);
pSourceObj->Release();
pSource->Release();
pTrack->Release();
// Preview the timeline.
IRenderEngine *pRenderEngine = NULL;
CoCreateInstance(CLSID_RenderEngine, NULL, CLSCTX_INPROC_SERVER,
IID_IRenderEngine, (void**) &pRenderEngine);
PreviewTL(pTL, pRenderEngine);
// Clean up.
pRenderEngine->ScrapIt();
pTL->ClearAllGroups();
pRenderEngine->Release();
pTL->Release();
CoUninitialize();
}
|
|
|
|
|
Hello,
How can one remove the scrollbars from a CFormView based app? I've spent way too many hours trying to figure this one out.
I've tried ModifyStyle(WS_HSCROLL | WS_VSCROLL, 0);
I've tried cs.style = ~WS_HSCROLL | ~WS_VSCROLL;
This should be simple, and its driving me crazy!!!
Thanks!
Frank
|
|
|
|
|
In your OnInitialUpdate() function, add this code:
SetScrollSizes(MM_TEXT,CSize(0,0));
Hadi Rezaie
|
|
|
|
|
Thanks Hadi!
It worked perfectly.
Frank
|
|
|
|
|
I had an ActiveX control in my C++ project but deleted it. It still shows up in the Class Wizard control list though. How do I remove all references to a control from a project?
|
|
|
|
|