|
You could always create the brush before the DC....
p_1960 wrote: Please can u explain the concept of the above lines in detail....
Which concept? That objects allocated on the stack are destructed strictly in the opposite order to which they were created?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
p_1960 wrote: Please can u explain the concept of the above lines in detail....
Nope, Got better things to do! (Sun is shining...)
But you are right to be slightly concerned.
The brush returned from SelectObject should have been selected back in. You'd almost certainly get away with the code as it is, but "get away with" is hardly good programming.
Better:
void CMainWindow::OnPaint ()
{
CPaintDC dc (this);
CBrush brush (RGB (255, 0, 0));
CBrush *brOld = dc.SelectObject (&brush);
dc.Ellipse (0, 0, 200, 100);
dc.SelectObject (brOld);
}
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
Hi,
I was wondering if there is a way to retrieve contents of a control(let's take list control) of another application? I think we can reach the control via FindWindowEx. But how we retrieve the contents?
Thanks a bunch!
Neil
|
|
|
|
|
If you have the window handle, you can send it messages. Like, for example, LVM_GETITEM[^], which you use to retrieve item details from a list control.
However, I'm unsure if it'll work cross-process. Try it and see!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Stealing Program's Memory[^]
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
I am working in a company with a lot of FREE time. Newly we've got a desktop computer for our office, but with a LIMITED user. One of the most terrible limitation is that we are not able to install ANYthing. Is there a way to get around this problem. By the way! Is there any way to recover ADMINISTRATOR password?
Thank you masters!
|
|
|
|
|
You can ask somebody who knows the password for it.
If it was so easy to do it that you expect a reply for this, Windows would have been long gone.
I mean who would want to use an OS which can be very easily compromised.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Frankly speaking! I knew this! But I got a brother who doesn't trust me and still believes there must be a way to do that. I just wanted to prove my word !!! that's why I said STUPID question ...
Thank you masters!
|
|
|
|
|
Suuuuuure, it was your brother. I believe you. Really!
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
|
use a pirated copy !!! or linux
sorry i dint understand ur question
|
|
|
|
|
wow! my brother was right! he has a tiny great application, enabling him to do it. microsoft???
Thank you masters!
|
|
|
|
|
Hi All,
I am trying to read text from ListView of other application.
I have created a demo application which is working fine for all listview (FolderView/ Winzip Listview control and listview of some application), but it is not working for a particular Listview.
I am able to get the RowCounts/ Column Counts but I am not able to read text.
Below is my code which I am executing to get ListItem.
The original code is in VB6, but Message API code/messages are similar in VC++/MFC.
<pre>Private Const LVM_FIRST = &H1000
Private Const LVM_GETITEMCOUNT = (LVM_FIRST + 4)
Private Const LVM_GETITEM = (LVM_FIRST + 5)
Private Const LVM_GETSTRINGWIDTH = (LVM_FIRST + 17)
Private Const LVM_GETCOLUMN = (LVM_FIRST + 25)
Private Const LVM_GETITEMTEXT = (LVM_FIRST + 45)
strLength = SendMessage(hWindow, LVM_GETITEMTEXT, iItem, ByVal pMyItemMemory)</pre>
Above code is working fine for other listview, and strLength is returning currect length of text of the List item.
I tried to debug, and understand nature of window (Listview Window) and I observed that all other listview where it is working fine having Windows Proc as Unicode and for list where it is not working having Windows Proc as ANSI (I got this information using Windows Spy++ utility).
My understanding is to get listview item for ANSI strings there would be different message needs to pass.
I appreciate your time and thanking you for any help or direction.
Regards
Rushi
|
|
|
|
|
You could specifically try to use SendMessageA .
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hi Superman ,
Thank you for your prompt reply.
But i guess I am using SendMessageA only see my declaration.
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As Any) As Long
</pre>
Regards
Rushi
|
|
|
|
|
it is a big problem,when I use socket send file from windows to linux and only receive unknown codes,how to design this program,server and client they both work well in file transfer.
|
|
|
|
|
Here's something[^], for a start...you may even be able to find FTP client and server source code.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi all
Can anybody tell me what is scalar deleting destructor.
When i try to delete a class pointer which is derived from CWnd it is showing this error.
class CGraphTollTip : public CWnd
{
....
....
}
class CGraphicsView : public CScrollView
{
....
....
CGraphTollTip *m_wndGraphTollTip;
void CGraphicsView::OnInitialUpdate()
{
....
m_wndGraphTollTip=new CGraphTollTip[SomeValue];
....
....
}
CGraphicsView::~CGraphicsView()
{
delete [] m_wndGraphTollTip;
}
....
....
}
While deleting m_wndGraphTollTip i am getting this error in vc6.0 callstack.
Please help me.
|
|
|
|
|
Here is the checklist:
1. Review the destructor of CGraphTollTip . Maybe it does delete this in its destructor.
2. Validate the pointer array when you are going to delete it.
CGraphicsView::~CGraphicsView()
{
if(m_wndGraphTollTip) {
delete [] wndGraphTollTip;
}
}
Maxwell Chen
|
|
|
|
|
I have checked the destructor of CGraphTollTip.In that delete this is not there
Also in CGraphicsView destructor i had validated the pointer but still the problem is not solved.
|
|
|
|
|
These two discussions (PCreview[^] and CodeGuru[^]) talked the same thing. Maybe they help...
Maxwell Chen
|
|
|
|
|
lbuttonDown out of a mode window, this mode window will refresh, but no message of paint spring.
witch message is spring?
handsome boy and beautiful girl!
who get this?
please tell me. thank you!
|
|
|
|
|
Your question is not clear.
Did you use any language translator? Then it is better to translate back to your language to ensure that what is translated is correct or not.
- ns ami -
|
|
|
|
|
Hi, someone can help with this ?
The objects composition are:
My user interface ... STProfissional ... Do_Start() ... Doing()
.....................
..................... STFabrica ....... STProducao ... STCelula ... STPacoteFabrica ... Move_()
.......................................
....................................... STLogistica ... STProjeto ... STPacoteCliente
Thread 1 = My user interface
Thread 2 = Worker thread started inside profissional (See code). (Blackground).
From STProfessional i would like to start Move_EntradaToBaseline() in STPacoteFabrica ...
My project is basicaly: Inside STFabrica, STProducao, STCelula, STPacoteFAbrica, STLogistica, STProjeto e STPacoteCliente i will make text files containing tasks informations and i put then into directories where a worker Thread (Thread 2) get it and manage it, openig it, reading the tasks informations e calling the apropriated function inside classes STFabrica, STProducao, STCelula, STPacoteFAbrica, STLogistica, STProjeto e STPacoteCliente that efectively do the task.
My Objects (Or classes if you prefer) are just a Set of CString object containing informations about directories, Names, Caracteristics,etc. Sametimes i use deque<cstring> for mantain necessary lists.
I receive the error when was did my first test that call Move_EntradaToBaseline()...(Thread 1, STPacoteFabrica.cpp) from Doing() (Thread 2, STProfessional.cpp) and the error happen.
I noted that, when i put a breakpoint in the line where the error heappen, Looking for variables content, they are invalid, with dirty content or invalid pointers ... I don´t now wy this heappen.
if someone needs i can send the code files ... I realy need help ... the approuch is essencial in my project.
Sorry by poor english, I´m brasiliam and student for this language ...
|
|
|
|
|
SNArruda wrote: I receive the error when was did my first test that call Move_EntradaToBaseline()...(Thread 1, STPacoteFabrica.cpp) from Doing() (Thread 2, STProfessional.cpp) and the error happen.
Sorry, but if you call a function from the worked thread, it's going to execute in the context of the worked thread, no matter if you think it should be executing in the UI thread.
SNArruda wrote: I noted that, when i put a breakpoint in the line where the error heappen, Looking for variables content, they are invalid, with dirty content or invalid pointers ... I don´t now wy this heappen.
Do you use any locking or any other technique to make sure that shared data isn't being altered by one of the threads while the other one's looking at it?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|