|
the code to place the control is fine and that is done in my class's constructor. The problem is that using the CRectTracker, the m_rect member is based upon the control's coordinates. If I move the control over to the left one unit, the m_rect will have -1 as it's Left member. so when I use MoveWindow, the control is placed at -1 in its parent instead of just moving over to the left one unit. m_rect is using the control's coordinates, and Movewindow is using the parent's coordinates.
If it's broken, I probably did it
bdiamond
|
|
|
|
|
bdiamond wrote:
If I move the control over to the left one unit,
Sorry but now you have lost me. That does not match what your original post said
bdiamond wrote:
I dynamically draw a CListCtrl object at a random position when the user clicks a button.
So if you are trying to move the window based on it's current position you need this:
1) GetWindowRect of the list control
2) Transform the screen coordinates to client coordinates of the picture control
3) Adjust the rect as per positioning requirements.
4) Move the list control using the resulting coordinates
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
got it now, thanks!!
If it's broken, I probably did it
bdiamond
|
|
|
|
|
Hello,
I have downloaded and installed the latest service pack (6) for developer studio, and it seems to me that files I had saved with my programs using CObject serialization (I know, I know, bad choice), now can't be opened with the new compiled code and crash the program.
Has anybody else experienced this?
Have no fear of perfection - You will never reach it
|
|
|
|
|
It seems odd that Microsoft would break something as ubiquitous as serialization with a service back, but you never know. Have you tried debugging and stepping through your routines? Can you tie the crash to a particular line in your code (e.g., a certain piece of data being deserialized)?
Also, what happens if you serialize with the latest service pack (6) and then deserialize?
I guess it's possilbe you were doing something that may have been working by accident, or some undocumented feature, and SP6 ended up changing that for whatever reason and broke your code. I'm merely suggesting some possible ways of figuring out what's wrong.
I think VC++ comes with something called a document viewer that can actually view serialized data files - but I am not sure as I have never used or experimented with it.
"Fish and guests stink in three days." - Benjamin Franlkin
|
|
|
|
|
If you're interested, this[^] article describes how to do serialize objects without any reliance on CObject .
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi
How can i use the function IHTMLTxtRange::moveToBookmark?
I have a bookmark in my xml file(like #32346).I've got the IHTMLTxtRange for the document.But couldn't move to the bookmark(return VARIANT_FALSE).
Or i have to use IHTMLTxtRange::getBookmark for that?
Please help me
Thanks
|
|
|
|
|
has anyone got the active x component to work correctly
in unmanaged c++ (mfc 7.1) in visual studio.net 2003 ?
|
|
|
|
|
It seems that you have posted this here before! I can't speak for 10 as I have only used upto 8.5.
BusinessObjects ought to have examples of their API. Have you tried there?
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Irish_GUI wrote:
has anyone got the active x component to work correctly
in unmanaged c++ (mfc 7.1) in visual studio.net 2003 ?
Not tried it yet as I haven't the funds to upgrade. What kind of problems are you running into?
Have you tried any of the samples that come with Crystal.
Michael
CP Blog [^]
|
|
|
|
|
I have been trying to implement the MRU option for a MFC Dialog program. I have a Menu for New, Open, Save etc, but would like to add a Menu option for MRU files.
All the examples are based on SDI or MDI MFC applications.
The Menu is defined in the AppDlg.cpp file but LoadStdProfileSettings(); is not a member of this dialog class, only the App.cpp class.
Are they any dialog based samples, even the Microsoft site uses a SDI example.
|
|
|
|
|
I have been trying to implement the MRU option for a MFC Dialog program. I have a Menu for New, Open, Save etc, but would like to add a Menu option for MRU files.
All the examples are based on SDI or MDI MFC applications.
The Menu is defined in the AppDlg.cpp file but LoadStdProfileSettings(); is not a member of this dialog class, only the App.cpp class.
Are they any dialog based samples, even the Microsoft site uses a SDI example.
|
|
|
|
|
Hello,
I am creating an application in MFC which, among many other features, has to perform keyboard input processing.
My question has to do with the fact that the custom control that I am coding has to take in account what the state of INSert/OVeRwrite is (as seen in the status bar). I would like to know if it is possible to know this without having to listen to ALL the keyboard input. Can anyone give me a hint? That would be much appreciated.
David Nimrod
|
|
|
|
|
In OnKeyDown catch the Insertbutton then set a bool to true/false?
just an idea.
good luck!
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
Just for clarification, why does your application care about the state of the INS key?
I've seen a few applications that use this implementation.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
The application I am developing uses several Custom Controls (which I am also working on) and (mostly) all these controls accept keyboard input. Because of this fact and also because I want to provide the user with the best * standard * input interface I can, I have to allow overwrite/insert at the current cursor position, among many other features (such as cut&past, drag&drop, etc, etc).
I was asking if it is possible to know (in a simple way) what the state of INS/OVR is without having to recur to a (main) Keyboard Listener, which in turn would set Global flags on/off.
I take it there is not.
dNimrod#X
________________________
|
|
|
|
|
dNimrod#X wrote:
I was asking if it is possible to know (in a simple way) what the state of INS/OVR is without having to recur to a (main) Keyboard Listener, which in turn would set Global flags on/off.
I take it there is not.
But there is. Try:
if (GetKeyState(VK_INSERT) == 0x01)
AfxMessageBox("Key is down");
else
AfxMessageBox("Key is up");
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
No, you are not understanding my question. Allow me to rephrase:
I need to know whether Text Insert is on or not, meaning if text should be appended (inserted) or overwritten at the current cursor position.
I don't want to know whether a certain key is being pressed or not -- that is out of the scope of the question.
Up till now, the only possible solution I have thought of would be to add a keyboard listener at the application level, which would in turn set 1 boolean variable on/off. Something like: bOverstrike = true/false
To avoid all this, I was wondering if there is either a MFC or a Win32 API function which automatically deals with text overwrite/insert.
Do you [or does anyone] know about such a feature?
David Nimrod
|
|
|
|
|
dNimrod#X wrote:
I need to know whether Text Insert is on or not, meaning if text should be appended (inserted) or overwritten at the current cursor position.
Which is exactly the solution I provided you.
dNimrod#X wrote:
I don't want to know whether a certain key is being pressed or not -- that is out of the scope of the question.
Actually, that is the root of the question - whether the INS key is on or off.
dNimrod#X wrote:
Up till now, the only possible solution I have thought of would be to add a keyboard listener at the application level, which would in turn set 1 boolean variable on/off. Something like: bOverstrike = true/false
Implementing a keyboard hook or checking the status when it is needed, the net result is the same - a global variable being set.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
The task manager does not promise cleanup when you end the process from the Processes tab. In fact, it wafrns you that some DLL's may not shut down, etc, etc.
The only reason someone would want to "End Process" on your app is because your app crashed and locked up. The only fix for that is writing better code so that the user doesn't have to use the "End Process" button.
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I am trying to have a overlapped blocking pipe write so that I can have either data sent signal or a timeout signal... The code I have written is as follows
<br />
DWORD dwMode = PIPE_READMODE_MESSAGE | PIPE_WAIT;<br />
BOOL bSuccess = ::SetNamedPipeHandleState(m_hPipe, &dwMode, NULL, NULL);<br />
and my pipe write function have code
<br />
OVERLAPPED op = {0};<br />
op.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);<br />
<br />
bSuccess = ::WriteFile(m_hPipe, lpBufferPos, dwToWrite,<br />
&dwNumberOfBytesWritten, &op);<br />
<br />
if(bSuccess)<br />
{<br />
return TRUE;<br />
}<br />
else<br />
{<br />
m_dwLastError = ::GetLastError();<br />
if(m_dwLastError == ERROR_IO_PENDING)<br />
{<br />
switch(WaitForSingleObject(op.hEvent, m_dwTimeOut))<br />
{<br />
case WAIT_OBJECT_0:<br />
return TRUE;<br />
break;<br />
case WAIT_TIMEOUT:<br />
m_dwLastError = ::GetLastError();<br />
return FALSE;<br />
case WAIT_FAILED:<br />
m_dwLastError = ::GetLastError();<br />
return FALSE;<br />
break;<br />
}<br />
}<br />
else<br />
{<br />
return FALSE;<br />
}<br />
} <br />
}<br />
The problem that I am facing is that all my Write to pipe function calls keeps returning with TRUE code and the corresponding first Read call in the child process remains locked at the WaitForSingleObject call and then after some write pipe operation in the parent process Read returns with "More data is available" error.
Can anyone direct me what I am doing wrong.
|
|
|
|
|
PS> what I need is a blocking write with a timeout so that if no read is performed for a specified time the thread unlocks.
|
|
|
|
|
Hi there! The thing I would like to know is how to lock and unlock a single variable, such as int or double? All these semaphores and events must be declared within a class, but how can I do it with simple types?
|
|
|
|
|
You still have to use at least a Critical Section to lock against while accessing the simple type.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Hmm, I've found InterlockedExchange and I guess that's what I need. By the way, what will happen if I read variable's value in one thread and write to it from another thread using InterlockedExchange, something like this:
bool yes_no; //Common variable
void Thread1Func()
{
bool tmp;
tmp=yes_no;
}
void Thread2Func()
{
InterlockedExchange((LPLONG)&yes_no,true);
}
So, if thread 1 get's to yes_no first is it going to work correctly?
|
|
|
|