|
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
|
|
|
|
|
Can you please tell more on how you close the app while it's in minimized state? (sending a message from somewhere else?)
Generally speaking, there are a few SDK functions that are used to terminate Win32 apps explicitly.
(1) ::TerminateProcess(HANDLE hProc);
(2) ::PostQuitMessage(WM_QUIT);
See MSDN documentation to find more..
// Fazlul
Get RadVC today! Play RAD in VC++
http://www.capitolsoft.com
|
|
|
|
|
The system tray icon will hang around until you remove/destroy it. When your app exits, you should remove/destroy the systray icon.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
When I close the app the icon is still visible until I pass the mouse over it,
That's because you're not calling Shell_NotifyIcon() to remove the tray icon before your app exits.
--Mike--
http://home.inreach.com/mdunn/
"The Earth is doomed." -- Rupert Giles
your with and
|
|
|
|
|
I feel dumb ... that worked like a charm.
Thanks!
Rob
|
|
|
|
|
I was wondering, is there a way to wait for a single process to complete with out using treads? I am reading data from a serial port at a low baud rate, and before the read is complete my program cuts it off and starts processing the data. Any help is appreciated.
Thanks.
|
|
|
|
|
I'm not sure what do you mean by 'process' in your post. Is that just some activity of your program, like reading from serial port, or OS object created with a call to CreateProcess?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
What I mean by process is the read... When I do my read call, before the read has finished reading all the data it is supposed to, my program is already trying to use that data... this results in data being lost or corrupted. Is there anyway to wait for the read to finish and then when it is done, continue the program?
|
|
|
|
|
Is there anyway to wait for the read to finish and then when it is done, continue the program?
How do you read the bytes from the serial port?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I connected to the serial port like this...
hCommPort = CreateFile( "COM1",GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
then I read like this...
ReadFile (hCommPort, buffer, 8, &dwBytesTransferred, NULL);
|
|
|
|
|
So ReadFile returns an error and exits prematurely? You're not using overlapped I/O - there's no FILE_FLAG_OVERLAPPED flag in the call to CreateFile.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
No, there is not an error... It just reads and continues, but the read is not finished when it goes on... I have put a Sleep(500) after the read, and it then works correctly, but I know that this is not a good approach.
|
|
|
|