|
it's a colon.
actually, it's a 'bitfield' specification, used to set a specific bit position for data within a struct or union.
from the MSDN:
This example defines a two-dimensional array of structures named screen.
struct
{
unsigned short icon : 8;
unsigned short color : 4;
unsigned short underline : 1;
unsigned short blink : 1;
} screen[25][80];
The array contains 2,000 elements. Each element is an individual structure containing four bit-field members: icon, color, underline, and blink. The size of each structure is two bytes.
Bit fields have the same semantics as the integer type. This means a bit field is used in expressions in exactly the same way as a variable of the same base type would be used, regardless of how many bits are in the bit field.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Thanks, Chris, and you're right it is a colon
Is there and MSDN article or knowledgbase number you can refer me too? Doing a search for bitfield specification brings up nothing we'll things I can't make sense of. Basically, I just want to see if they have an example, like:
struct Length
{
unsigned short begin:4;
unsigned short end:4;
};
Does this designate the structure to be a size of 1 byte (4 bits * 2) or is it still a 4 byte structure, in which you do a read in it will only ready the first 1 byte of data? For example, we have a binary data that looks like this:
00001111000000000000000000000000 <= 4 bytes long
we read it into our LENGTH struct is it now read as:
begin = 00001111
end = 00000000
extra bits are ignored.
or is read like this:
begin = 0000111100000000
end = 0000000000000000
Thanks for the quick answer, and I hope I'm not annoying anyone
Sam C
----
Systems Manager
Hospitality Marketing Associates
|
|
|
|
|
an MSDN search on "bitfield struct" gives a ton of articles. but the first one that comes up for me is titled "INFO: Initializing Bitfields as Integers in C" is has some sample code.
not annoying me... i'd forgotten all about the mysterious bitfield stuff. now, thanks to your question, i have another bit (pun intended) of C trivia to impress people with.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Thanks, Chris! That sort of explained it, I'm just going to brute force the rest and add a strucutre with that information an dthen add it to watch and see what values are assigned to each member variable
Btw, did you get my email, I am definetly looking forward to a reply. I am very interested in your IMGDLL file on our website and had a couple of questions basically, what is the size of the DLL if you do a static link how much does that add to my final EXE.
Maybe you may want to post that information here so others can view it, but for someone who created non-DB applications that are not part of work you can't beat the value on that piece of software
Sam C
----
Systems Manager
Hospitality Marketing Associates
|
|
|
|
|
ImgDLL was discontinued a while ago. It was replaced by the even-more-capable ImgSource (http://www.smalleranimals.com/isource.htm). ImgSource does much much more than ImgDLL, and is faster, more stable, easier to use, etc..
static linking to the ImgSource .LIBs adds anywhere from 30K to 700K, depending on which of the functions you pull in; simple image processing stuff gets you just a few K, TIFF support brings in over 300K, JPG is 100K or so, etc..
(sorry, didn't get your mail until late night, CP email notifications were delayed again today, i guess)
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Sorry it is ImgSource, however what is the ImgX product? I see no mention of that on your website, just on the boards, is this the one going for version 5? Sorry, but I am really interested in this product for my own personal library, and is their any licensing issues associated with this control? Is there a license fee associated with any distributed work using this control?
But basically what is the difference between ImgX and ImgSource? I don't see a reference to ImgX on your site under Products.
Thanks, and sorry about all the questions, but you're product seems very interesting
Sam C
----
Systems Manager
Hospitality Marketing Associates
|
|
|
|
|
ImgX is a VB wrapper for ImgSource. It is a product from a company called Designer Controls. We share boards because a lot of the ImgX issues are ImgSource issues. There are links to ImgX sites from the boards and from the ImgSource home page.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Oh a VB control, I'll take a look at ImgSource then It took me a long time to totally ween myself away from VB development. Chris, let me say that if your responses here are any indication of the type of support your provide, and your pricing is that good, you may find yourself having a new customer before the end of the day But first I'm going to try it out and see if I can remeber how to make all the extern calls to DLL functions or is that LoadLib and GetProcessEntryPoint to return function pointers?? Oh, well I'll figure it out and I see that you do offer samples with the download
Thanks again Chris for all your help, now I'm going to download and evaluate the library.
Sam C
----
Systems Manager
Hospitality Marketing Associates
|
|
|
|
|
Hello,
I am trying to implement a bar like the outlook bar and want to insert drag and drop functionality in that bar. For example if you check the outlook bar you can move the 'contacts' to the end of the list of items in the bar i.e. drag contacts at the end of the list and drop it there. Any hints on how I would go about getting this functionality. I am confused as to whether I should use the method OnBeginDrag to start the operation or OnLButtonDown(). All the items on the bar I believe would be components so how would I start a drag operation.
Please let me know.
Thank you
vg
|
|
|
|
|
I have been trying to provide some changes to a CListViewCtrl via superclassing in a WTL/ATL SDI application. The error returned during the creation of the window is "class does not exist" error (error code 1411). Below is the code sample. Any suggestions on what is missing or needed?
//////////////////////////////////////////////////////////////////////
class DCPListCtrl : public CWindowImpl<DCPListCtrl, CListViewCtrl>
{
public:
DCPListCtrl();
virtual ~DCPListCtrl();
public:
BEGIN_MSG_MAP(DCPListCtrl)
MESSAGE_HANDLER(WM_PAINT, OnPaint)
END_MSG_MAP()
public:
LRESULT OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
// DECLARE_WND_SUPERCLASS(_T("NewDCPListCtrl"), GetWndClassName())
static CWndClassInfo& GetWndClassInfo()
{
static CWndClassInfo wc = {
{
sizeof(WNDCLASSEX),
0,
StartWindowProc,
0, 0, NULL, NULL, NULL, (HBRUSH)(COLOR_WINDOW+1), NULL,
_T("NewDCPListCtrl"), NULL
},
GetWndClassName() , NULL, IDC_CROSS, TRUE, 0, _T("")
};
return wc;
};
static LPCTSTR GetWndClassName() { return _T("NewDCPListCrtl"); };
};
//////////////////////////////////////////////////////////////////////
HRESULT DCPStatus::open(const HWND hWnd)
{
HRESULT hr = S_FALSE;
if (list_view) {
RECT rect;
::GetClientRect(hWnd, &rect);
HWND h = list_view->Create(hWnd, rect, DCPListCtrl::GetWndClassName(),
WS_CHILD |
WS_VISIBLE |
WS_CLIPSIBLINGS |
WS_CLIPCHILDREN |
LVS_REPORT,
WS_EX_CLIENTEDGE);
if (!h) {
UINT err = ::GetLastError();
hr = E_FAIL;
}
}
return hr;
}
|
|
|
|
|
|
The error was the same whether I use my code or the DECLARE_WND_SUPERCLASS. I have it commented out to as a reminder that the GetWndClassInfo() is the structure of the DECLARE_WND_SUPERCLASS().
I was looking at overriding the cursor (IDC_ARROW to IDC_CROSS)in the view and the CS_HREDRAW & CS_VREDRAW to eliminate flicker during resize (not provided in the default DECLARE_WND_SUPERCLASS.
Thanks...
|
|
|
|
|
I was looking at overriding the cursor (IDC_ARROW to IDC_CROSS)in the view
Isn't handling WM_SETCURSOR easier than superclassing?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
That maybe. I was looking at overriding the flicker issue based on the knowledge-based article Q183210. Having a different cursor would come for free (changing the icon handle).
For some reason I thought this would be an east fix
|
|
|
|
|
Hi all,
How can i load bmp picture from access 2000 database with ADO ?
and
How can i save bmp picture in access 2000 database with ADO ?
Thanks for helps ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
The best way is to use BLOB data with the ADO stream object. Don't bother with GetChunk & SetChunk, it's a real pig to use. Here's a quick cut'n'paste from my code so its not exactly clear, but this is for loading blob data but you'll be able to easily change it to save blob data:
<br />
_RecordsetPtr pAnnoRs = NULL;<br />
_StreamPtr pStream = NULL;<br />
CString strSQL;<br />
_bstr_t strMissing(L"");<br />
BOOL bEmpty = TRUE;<br />
<br />
try<br />
{<br />
TESTHR(pAnnoRs.CreateInstance(__uuidof(Recordset)));<br />
TESTHR(pStream.CreateInstance(__uuidof(Stream)));<br />
strSQL.Format(_T("SELECT `tblAnnotations`.* FROM `tblAnnotations` WHERE `tblAnnotations`.`imageID` = %d;"), nImageID);<br />
TESTHR(pAnnoRs->Open( (_bstr_t) strSQL, _variant_t((IDispatch*) thisMainFrm.pConnection), adOpenKeyset, adLockOptimistic, adCmdTableDirect));<br />
<br />
if (!pAnnoRs->GetadoEOF())<br />
{<br />
TESTHR(pStream->Open(vtMissing, adModeUnknown, adOpenStreamUnspecified, strMissing, strMissing));<br />
TESTHR(pStream->put_Type(adTypeBinary));<br />
TESTHR(pStream->Write(pAnnoRs->Fields->GetItem(L"BLOB")->Value));
TESTHR(pStream->SaveToFile( (_bstr_t) strDir, adSaveCreateOverWrite));
TESTHR(pAnnoRs->Close());<br />
TESTHR(pStream->Close());<br />
bEmpty = FALSE;<br />
}<br />
}<br />
catch (_com_error &e)<br />
{<br />
TRACE(_T("COM error in CThumbBar::OnThumbCopyAndPaste()"));<br />
TRACE(_T("Error:%081x.\n"), e.Error());<br />
TRACE(_T("ErrorMessage:%s.\n"), e.ErrorMessage());<br />
TRACE(_T("Source:%s.\n"), (LPCTSTR) _bstr_t(e.Source()));<br />
TRACE(_T("Description:%s.\n"), (LPCSTR) _bstr_t(e.Description()));<br />
return FALSE;<br />
}<br />
catch (int)<br />
{<br />
;<br />
}<br />
good luck.
|
|
|
|
|
Does anybody know where I can find ROP code table.
|
|
|
|
|
HI
I’m confused between pointer to CWnd and handle also to CWnd .What’s the difference between handle and pointer in CWnd object .For example when I want to chat text color in text box control :
HBRUSH CMyDlg::OnCtlColor(CDC*pDC,CWnd*pWnd,UINTCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
//////////////////////////////////////////////
CWnd* wnd=GetDlgItem(IDC_EDIT1);
if(wnd==pWnd) // using pointers
{
pDC->SetTextColor(RGB(255,0,0));
}
///////////////////////////////////////////////
return hbr;
}
this code doesn’t chang text color .But when I use handles like this example :
HBRUSH CMyDlg::OnCtlColor(CDC*pDC,CWnd*pWnd,UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
////////////////////////////////////////////////
CWnd* wnd=GetDlgItem(IDC_EDIT1);
if(wnd->m_hWnd==pWnd->m_hWnd) // using handles
{
pDC->SetTextColor(RGB(255,0,0));
}
///////////////////////////////////////////////////
return hbr;
}
now this code do what I want to chang text color .
Can any one tell me what difference between pointers and handles in CWnd objects ?
Thank you …
AHMAD ALWASHALI
|
|
|
|
|
I believe that a pointer is an actual object (CWnd for example) and a handle is the location in memory of that object (or object referenced by the pointer). So say you have a window in memory and you want to access the methods/properties of that window...you would have a pointer/object that "attaches" itself to the window at that memory location thereby giving you access to its "structure and methods". Hope that helps.
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
Handle to a window (HWND) is a Win32 animal - it's a magic cookie which is used to identify windows in the system. Ok, it's not exactly magic: HWND is just a 32-bit number without meaning outside of running Windows system.
MFC is a C++ library, and represents windows as C++ objects derived from class CWnd. Each CWnd-derived object has a data member, m_hWnd, which holds the corresponding Win32 HWND. But the connection between HWNDs and CWnd pointers doesn't stop here: MFC also uses handle maps to provide C++ pointers to CWnd-derived objects when it's needed. In your example, OnCtlColor function receives C++ pointer to a CWnd. Before calling your handler, MFC checks if there's already some CWnd object, if not it creates temporary one and passes its address instead of HWND.
Actually, the mapping is somewhat more complicated: there are 'permanent' and 'temporary' maps, I believe this could be the source of your problems.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
|
In general, a handle is just a 32-bit key to a data structure maintained by Windows. Some common handles are:- HACCEL - Handle to an accelerator table.
- HANDLE - Handle to an object.
- HBITMAP - Handle to a bitmap.
- HBRUSH - Handle to a brush.
- HCOLORSPACE - Handle to a logical color space.
- HCONV - Handle to a dynamic data exchange (DDE) conversation.
- HCONVLIST - Handle to a DDE conversation list.
- HCURSOR - Handle to a cursor.
- HDC - Handle to a device context (DC).
- HDDEDATA - Handle to DDE data.
- HDESK - Handle to a desktop.
- HDROP - Handle to an internal drop structure.
- HDWP - Handle to a deferred window position structure.
- HENHMETAFILE - Handle to an enhanced metafile.
- HFILE - Handle to a file opened byOpenFile, notCreateFile.
- HFONT - Handle to a font.
- HGDIOBJ - Handle to a GDI object.
- HGLOBAL - Handle to a global memory block.
- HHOOK - Handle to a hook.
- HICON - Handle to an icon.
- HIMAGELIST - Handle to an image list.
- HIMC - Handle to input context.
- HINSTANCE - Handle to an instance.
- HKEY - Handle to a registry key.
- HKL - Handle to a keyboard layout.
- HLOCAL - Handle to a local memory block.
- HMENU - Handle to a menu.
- HMETAFILE - Handle to a metafile.
- HMODULE - Handle to a module.
- HMONITOR - Handle to a display monitor.
- HOOKPROC - Pointer to an application-defined hook function specified toSetWindowsHookEx.
- HPALETTE - Handle to a palette.
- HPEN - Handle to a pen.
- HRGN - Handle to a region.
- HRSRC - Handle to a resource.
- HSZ - Handle to a DDE string.
- HTREEITEM - Handle to an item in a tree-view control.
- HWINSTA - Handle to a window station.
- HWND - Handle to a window.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.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 three 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???
3- How can I get data from multi row selection ?
Thank you very much …
AHMAD ALWASHALI
|
|
|
|
|
Read the help file, boy. It is the file
c:\Winnt\Help\MsFlxGrd.hlp
or
c:\Windows\Help\MsFlxGrd.hlp
|
|
|
|
|
Hello,
I have a dialog type app, I use a minimize to system tray class that puts the icon to the system tray.. When I close the app the icon is still visible until I pass the mouse over it, then it goes away.. What's the best way to kill the app so it removes all traces from the system.. Right now I just do a OnOK();
Rob
|
|
|
|
|