|
of course as you say about overlap
the thing that i want say is how to paint a bitmap when mouse click event happened and location that bitmap is drawed is belong to coordinate of mouse !
i tryed many code but if i minimize the dialog of program,
then nothing to see!
void CGomokuDlg::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if((nFlags & MK_LBUTTON)== MK_LBUTTON)
{
//get Device context:
CClientDC dcc(this);
//draw pixel:
dcc.SetPixel(point.x,point.y,RGB(0,0,0));
}
CDialog::OnMouseMove(nFlags, point);
}
void CGomokuDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CClientDC dc(this); // device context for painting
CBitmap bitmap;
bitmap.LoadBitmap (IDB_BITMAP1);
CDC dcMem;
dcMem.CreateCompatibleDC(&dc);
CBitmap* pOldBitmap = dcMem.SelectObject(&bitmap);
CPen pen1(PS_SOLID,16, RGB(255,100,0));
dc.SelectObject(&pen1);
//dc.StretchBlt(100, 130, 20, 20, &dcMem,
// 0, 0, 20, 20, SRCCOPY);
dc.MoveTo(0,0);
dc.LineTo(30,400);
CDialog::OnLButtonDown(nFlags, point);
}
-- modified at 22:14 Sunday 9th April, 2006
|
|
|
|
|
See the following link
<a href="http://www.codeproject.com/buttonctrl/hoverbutton.asp" rel="nofollow">http:
Knock out "T" from CAN'T
You 'CAN' if you think you 'CAN'
|
|
|
|
|
I have a spoiled problem with OpenFileDialog in .net 2003, if the number of files inside a folder was too much, I can't see anything to select. Does anybody have any experience with this problem?
Let's come together to know more!
|
|
|
|
|
LRESULT CALLBACK KeyboardHookProc( int code,WPARAM key, LPARAM lParam)
{
(1) if (((DWORD)lParam & 0x40000000) &&(HC_ACTION==code))
{
...
(2) GetKeyboardState(ks);
...
(3) ToAscii(key,scan,ks,&w,0);
}
...
}
Please, could somebody explain in simple terms what the meaning of lines 1..3 is. I've been doing my nut trying to figure it out, and good Net explanations are thin on the ground. Your help is deeply appreciated.
EvScott
|
|
|
|
|
Have you looked up those functions in MSDN? MSDN has a pretty plain explanation that I can parrot here but it is easier for you to look it up yourself. If you need any clarification then post a more specific question.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Could you post the Complete Code, rather than the bits you seem to consider important. It is actually quite simple, and all well documented. Just, the snippet you show leaves out the reasons for calling the API's
LateNightsInNewry
|
|
|
|
|
Hi,
I am using Visual Studio .NET 2003. I'd like to know if there is some way to run a memory leak checker (like CodeGuard in Borland C++).
Thank you,
Rafael Fernández López.
|
|
|
|
|
install Bounds Checker
never say die
|
|
|
|
|
Hi all,
could any one help me with an STL problem? the code below throws an assertion error [_SCL_SECURE_VALIDATE(this->_Mycont != NULL); from vector.h, line 117] when executing line #5 only after executing line #4. Line #5 works fine as long as the 'if' block is not entered. I am using MSVC 2005 and did not have this problem with the previous version. Is there any change to the way STLs are handled now? Thx everyone,
Ralf.
1 ivFKey = szvCopy.begin();
2 while (ivFKey != szvCopy.end()) {
3 if (*ivFKey == szFKey) //delete all equal; what's left are 0-catches
4 szvCopy.erase(ivFKey);
5 ++ivFKey;
6 }
ralf.riedel@usm.edu
|
|
|
|
|
|
ivfKey = szvCopy.erase(ivFKey)
|
|
|
|
|
I am coding an application that displays a couple of CRgn objects. Each CRgn is filled using anoher brush. So I need two arrays to store the CRgn and CBrush objects.
I also need to save to a file the arrays so when I open the application again I can continue to work with those objects.
It would like to use CArray because I can use m_rgnArray.Serialize(ar) to save the array to a file...
But my program doesn`t work as expected and I get a lot of "assertion failed" messages.
This is how I declared the variables:
<br />
CArray <CRgn, CRgn> m_rgnArray;<br />
CArray <CBrush, CBrush> m_brushArray;
Is this the way I should use CArray with CBrush and CRgn? Is it even possible to use CArray with CBrush and CRgn?
|
|
|
|
|
You can't persist GDI objects like that. You'll need to store the coordinates of the regions and attributes of the brushes, and recreate the GDI objects later.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
<i>LRESULT CALLBACK KeybrdHook( int code,WPARAM key, LPARAM lParam)
{
if (((DWORD)lParam & 0x40000000) &&(HC_ACTION==code))(<b>1</b>)
{
...
GetKeyboardState(ks);(<b>2</b>)
...
ToAscii(key,scan,ks,&w,0);(<b>3</b>)
}
...
}</i>
Could someone please put me out of my misery and explain the lines numbered 1..3. It's driving me potty. There's not a lot of useful, simple to understand explanations on the Net. Many thanks.
EvScott
|
|
|
|
|
EvScott wrote: Could someone please put me out of my misery and explain the lines numbered 1..3.
1) The bits in lParam are being ANDed with 0x40000000. If that result is non-zero and code equals HC_ACTION , the next two statements are executed.
2) The function GetKeyboardState() is being called. When finished, ks is a 256-byte array that will receive the status data for each virtual key.
3) The function ToAscii() is being called. This will translate the specified virtual-key code and keyboard state to the corresponding character or characters.
EvScott wrote: There's not a lot of useful, simple to understand explanations on the Net.
Actually, quite the opposite is true.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
void foo1()
{
foo2();
}
void foo2()
{
foo3();
}
void foo3()
{
STACKFRAME64 frame;
DWORD_PTR programcounter;
programcounter = getprogramcounter();
memset(&frame, 0x0, sizeof(frame));
frame.AddrPC.Offset = programcounter;
frame.AddrPC.Mode = AddrModeFlat;
frame.AddrFrame.Offset = framepointer;
frame.AddrFrame.Mode = AddrModeFlat;
StackWalk64(, , , &frame, , NULL, , , NULL);
}
DWORD_PTR getprogramcounter()
{
DWORD_PTR programcounter;
__asm mov AXREG, [BPREG + SIZEOFPTR]
__asm mov [programcounter], AXREG
return programcounter;
}
My assumption about the above code snippet is that foo3 obtain the address of "getprogramcounter()(program counter?)" by calling getprogramcounter(), and it is
from there the foo3 begin to trace back. So in this case getprogramcounter()->foo3()-2()->1()? But What's the relation between foo3()'s getprogramcounter()'s address and its frame pointer, as the "frame.AddrPC.Offset" and "frame.AddrFrame.Offset" indicate.Doesn't the frame pointer alone enough to get its caller's stack frame? why use program counter? How the StackWalk64 deal with them. What exactly happened?
|
|
|
|
|
Having moved back to Visual Studio 2005, it is now bombarding me with warnings about ISO C++ deprecation of certain functions (such as strdup and stricmp). Most of these warnings disappear when I tell it to mind it's own business with _CRT_SECURE_NO_DEPRECATE. However, is it advisable to actually do what Microsoft say and switch everything over to the new versions of the functions?
|
|
|
|
|
Yes the annoying security warnings
There are many reasons to not use the new functions, even if MS recommends:
- your code gets much more complicated
- no cross-compiling with other compilers/operating systems possible
- every open-source lib you use will bring again these warnings
It is also widely not understood that the wrong functions were blamed by
MS. Most of them are not unsafe and never were. But they depend on correct
usage, so you as the programmer are in charge to not give them garbage.
So, my advice is to use the old functions, and check (if you must use plain C)
every buffer for long enough size, esp. if you get data from user input.
Hans
|
|
|
|
|
Thankyou, Hans. I was thinking something along the same lines, although I never thought of the cross-compatibility issue. Best to check.
HWM
|
|
|
|
|
hi,
I actually have a very simple application,I need to retrieve 2 record from my database.Everytime I click a button then records should be displayed sequentially into my edit boxes.
So,for that I used the code while(!objrs.ISEOF()) and objrs.movenext() where objrs is the recordset object,I can get only one record.
so,pls solve my problem.
bye
swapna_signsin
|
|
|
|
|
|
swapna_signsin wrote: So,for that I used the code while(!objrs.ISEOF())...
Why are you using a while loop when you are only interested in two rows? That would not be very intuitive to someone having to read through the code.
swapna_signsin wrote: ...I can get only one record.
Have you called objrs.MoveNext() a second time to advance to the next row?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
|
i use ShellExecuteEx to open many other 3rd programme, then i use EnumWindows to get the main window by hProcess returned by shellexecuteex. i found that some programmes, such as notepad.exe, calc.exe, cmd.exe, work correctly. but it couldn't get the correct window of some programmes like word.exe.
|
|
|
|
|
ask yourself, what is the diffrenece between running notepad.exe and winword.exe?
one answer could be that notepad opens immediately and winword first opens a splash screen,
then initialize and only then display the main frame window....
the only way to overcome this is the hook into the creation of the process, and then find out who is the main window and use it.....
hope this helps
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|