|
some people dont want choice it seems...
|
|
|
|
|
Hi,
I have an SDI application. I want to display the current mouse position in the view onto the Main frame status bar.
I have declared the variable m_ptCurrentPositon in the Main frame class which will contain the current mouse coordinates and I am updating it in the OnMouseMove() and OnNcHitTest() of my View class.
All I want is once the mouse moves out of the view window(client area), I should be able to detect that so that I could set the m_ptCurrentPositon value to (0,0), because currently when I mouse out of the view, I am still displaying the non-zero value in my Status bar.
How do I achieve the above mentioned?
|
|
|
|
|
Do the following:
1. Declare bool m_bMouseInside in class and initialize it as false.
2. In OnMouseMove()do the following.
if( !m_bMouseInside )
{
m_bMouseInside = true;
TRACKMOUSEEVENT tme = { 0 };
tme.cbSize = sizeof( tme );
tme.dwFlags = TME_LEAVE;
tme.hwndTrack = m_hWnd;
_TrackMouseEvent( &tme );
}
3. Map WM_MOUSELEAVE as OnMouseLeave or something
It will be called when the mouse leaves the client area.
- NS -
|
|
|
|
|
Hi to all!
If I was to change the appearance of scroll bars in my CListCtrl (from boring windows style to something else witch will match my background color) would it need to be an custom or owner drown control. If custom is enough (I hope because mine is), would it be on a 'OnCustomdrawList' function? Or it can not be done like that but by creation a new scrollbar members and build it in CListCtrl?
Please help!
|
|
|
|
|
Scrollbar customization is very much different than customizing a control, because the scrollbar is a part of the window and it is in the non-client area. So you have to manage it differently.
There are many articles in CP regarding this, having a look at them may help you a lot.
- NS -
|
|
|
|
|
Thanks for replay!
So I need to change it's appearance before and 'pass' them to my CListCtrl?
|
|
|
|
|
No you cant do so. Scrollbar is not a separate control. It is the part of the window. So the OS is drawing scrollbar. Having a look at the CP articles will help you in understanding more regarding this. And there are many solutions too.
- NS -
|
|
|
|
|
how to perform insert / delete in a file with out reading all the content and update whole content back in to the file.
//for eg;
//myfile.txt
[names]
name1
name2
name2
name3
name5
name2
.
.
.
[/names]
is it possible to delete name2 and insert name4 after name3. If i open a file and try to insert a text its allways replaces the existing content.
Thanks & Regards
|
|
|
|
|
No, you can't. You'll need to import the file in memory, modify it there and then save it back to the file afterwards. You could in your case read the file and store it in memory as a list of strings.
|
|
|
|
|
Hi.
I am really lost in using ADO with C++. Can anyone direct me to a site with information for beginners for database access.
Thanks.
Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|
|
Did you see Database section on the codeproject?
|
|
|
|
|
i hand't thought of that. Thanks
Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|
|
I want to make flexigrid non- editable in VC++.net2003.can anyone suggest me how
|
|
|
|
|
hi, all
I paint a bitmap image on picturebox control using Bitblt() function .
now but i want to do . I want to resizing the image and moving the image
on the picture box control with the help of the mouse. can any one help
me in this topic . any sample code or article . a search a lot on google
not find nay sample and idea how to start it .
Trioum
|
|
|
|
|
For change size of image you can use of StretchBlt (but it decrease quality of image) and with mouse you have two events WM_LBUTTONDOWN and WM_LBUTTONUP you can use of them.
|
|
|
|
|
About the size, use the function in the other answer.
About the movement, you can use those messages (OnMouseDown/Up) to set/reset a bool variable and then change the coordinates of the bitmap while mouse moving. Something like:
BOOL bAllowDragDrop
CPoint m_cpDragOffset;
void CMyView::OnLButtonDown(UINT nFlags, CPoint point)
{
cpDragOffset = cpBitmapCoord - point;
bAllowDragDrop = TRUE;
}
void CMyView::OnLButtonUp(UINT nFlags, CPoint point)
{
if (bAllowDragDrop)
{ cpBitmapCoord = point - cpDragOffset;
bAllowDragDrop = FALSE;
}
Invalidate ();
UpdateWindow ();
}
This would not move the bitmap while mouse moving, just take coordinates by downclicking and saving the new ones by upclicking. If you wanna see the movement, insert the OnMouseMove and do the same as by upclicking.
This is a way. Hope it helps
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
For the resizing, look up CRectTracker
It provides the pieces needed for moving or resizing a rectangular object. You still have to provide some of the plumbing but it gets the job done.
|
|
|
|
|
Hi all,
I have a board (embedded device) that send RAW data over USB to the PC, it also expects to receive some data and commands from USB, anybody knows how to write a program to send data from PC to USB and receive data from USB to PC?? any samples, articles or any kind of help is appreciated..
Thank you very much
Mohammad Gdeisat
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
USB doesn't work the same way as standard serial port (COM port) work. You cannot open the USB and send/receive data on it.
Instead, ýou'll need to open the driver associated with your device (using CreateFile) and then you'll be able to read/write data (using ReadFile/WriteFile) to your device. You'll be also be able to send specific command codes to your driver using DeviceIOControl.
Normally, you should have received documentation with your board (and the driver also). Everything should be explained ther (because for example IO control codes are specific to the driver).
|
|
|
|
|
Please help to figure out what is wrong with my program. It runs and yield correct results. The program is a hybrid of MFC and C++. After the program finish display the results and then when I hit the exit key I Got:
Loaded 'ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\user32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\gdi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\comdlg32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\shlwapi.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\advapi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\rpcrt4.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msvcrt.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\comctl32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\shell32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\winspool.drv', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\oledlg.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ole32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\olepro32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\oleaut32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\imm32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\lpk.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\usp10.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\entapi.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\psapi.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\netapi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\MSCTF.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\SynTPFcs.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\version.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\MSCTFIME.IME', no matching symbolic information found.
First-chance exception in blast_vib_proc.exe: 0xC0000005: Access Violation.
The program 'C:\blast_vib_proc_model_from_d\Debug\blast_vib_proc.exe' has exited with code 0 (0x0).
Please let me know where is the problem and how to fix it.
Thanks a lots.
|
|
|
|
|
There's no errors until the first-chance exception. If that exception isn't handled
then the app will terminate. If the exception is handled, it may or may not be fine,
depending on what code is causing the exception and how it's being handled.
In other words, if the exception is occurring in your code, you may want to look into it.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks Mark.
It seems that Exit function and Next Function got these errors because when I hit these buttons I got the message and program terminates.
Thanks again for any ideas.
|
|
|
|
|
If you run the application in the debugger, execution will break when the exception occurs.
You should at that point be able to see the offending line(s) of code.
If the exception didn't occur in your code, you can use the call stack window to
trace back to a point in your code and hopefully find the problem.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks Mark.
I followed your suggestion with break point and I got to Exit function and the program terminated. Here is my Exit function. please see if anything wrong. Thanks again.
//---------------------------------------------
void CBlast_vib_procDlg::OnExit()
{
// TODO: Add your control notification handler code here
//
CDialog::OnCancel();
}
//
here is message map:
BEGIN_MESSAGE_MAP(CBlast_vib_procDlg, CDialog)
//{{AFX_MSG_MAP(CBlast_vib_procDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDNext, Next)
ON_BN_CLICKED(IDExit, OnExit)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
|
|
|
|
|
Nothing that should cause an exception there.
Do you get an unhandled exception error or does it just terminate
as expected?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|