|
class Custom public CWnd
{
Custom()
{
CWnd* pWnd = static_cast<CWnd>this;
}
}
I think it will work, I don't know.
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
i have serveral dialogs within an SDI.I need to take in user inputs through the dialogs and then based on these information, draw a graphic and show it on the SDI view, my problem is, i do not know where should i code this part, as i need info from 2-3 dialogs, so does that mean i link my user inputs in these dialogs to the document class then output to view? please advise....actually my project has a "view" button on each of the 3 dialogs such that when any one is pressed, the view panel will show the required image....
Also, how to draw small boxes to represent a 1 for a "pixel" that is present and 0 for a "pixel" that is etched away? urgent!
|
|
|
|
|
Hi,
my software did a lot of file access using MFC/CFile and did it very well as long as the files are not corrupted. In meantime the software has to deal with files on DVD+-R and +-RW media. Lots of them seems to be corrupted. When i did a File->Read to such a file (just a few bytes), this call takes seconds (between 10 to 20s) till it comes back (the file->open was quick and ok).
Question:
How can I react on that? If i tried to copy that file on the desktop the system tolds me within 0 to 2s that this file is not ok.
How can i do a QUICK check on small files (up to 100kByte) in advance for CRC errors and so on?
And what about very large files >Gbyte?
Thanks a lot for your help!
Eddie
|
|
|
|
|
It is a good idea to make such unsure function in another Thread. Then you start the thread and your original programm is running further and you can check the status of the thread.
PS: I do some network checking in threads and it works very well for me.
Try this @ home. (B&B)
|
|
|
|
|
dear all,
finally i managed to put myself into a number of wierd problems.....without any clue WHY and WHY ME?
these problems are :-
1) my app is a very simple dlg based mfc app. i'm unable to terminate the dialog by pressing the cross button in the top right corner..even Alt+F4 can't terminate my mighty dialog.
2) i'm using string comparision function as
<br />
if (sDir.CompareNoCase("M") != 0)<br />
{<br />
<br />
}<br />
i call this piece of code on click of a button. Everythiing is working fine in Xp, but in 2000 if i click on the button using mouse...the string comparision seems ok, but when same string is supplied and mouse is pressed using keyboard (enter or space bar), plz. (pause for a laughter)....the string comparision fails.
All i want to know is what is wrong with the code, or with me
Regards,
rIsHaBh
|
|
|
|
|
rishabhs wrote:
1) my app is a very simple dlg based mfc app. i'm unable to terminate the dialog by pressing the cross button in the top right corner..even Alt+F4 can't terminate my mighty dialog.
Have you done something to OnCancel() or OnClose() ?
rishabhs wrote:
...the string comparision fails.
What is the value of sDir at the point of comparison?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
1) haven't even touched OnCancel or OnClose()
2) value of sDir is "M"
any clues!!
rIsHaBh
|
|
|
|
|
If you create a dialog-based application, don't change anything, and run it, does the "X" (close) button behave as expected?
Have you stepped into the CompareNoCase() code to see why it is failing? What if you changed the code to:
char s[] = "M";
if (sDir.CompareNoCase(s) != 0)
{
...
} Does that make a difference?
|
|
|
|
|
I have the following case:
There's a Window, let's call it window A.
Window A contains a nested class which implements a COM-Interface.
the code behind window A is simple:
<br />
CWindowA* wndA = new CWindowA;<br />
wndA->DoModal();<br />
delete wndA;<br />
This code appears in the middle of an application, it has lots of stuff before and after it.
The thing is, that Window-A gives 'someone' a pointer to it's COM-Interface. This someone proceeds to make COM calls which are executed inside Window-A's nested class.
The design issue is this, Window-A decides it's time to die (call EndDialog, and thus get out of the DoModal() loop and get desturcted) in response to a COM call from mr. 'someone'.
So, if 'someone' makes this final COM-call, Window-A in response starts to destroy itself, and actually gets to it, without having 'someone' release the refcount it has on Window-A's COM-Object. This causes a mess/Assertion by MFC on the fact that references to this object still exist.
Is there a nice and clean way to solve this situation ?
It is assured that once this final call is made, the reference-count will be released and no COM-calls will be made to this object.
I've thought of posting a message that would cause a destruction and other numerous solutions, but none of them can assure that the ref-count is actually released...
Thank you
|
|
|
|
|
I've found this : void CCmdTarget::ExternalDisconnect()
the comment in the code states :
// ExternalDisconnect is used to remove RPC connections in destructors. This
// insures that no RPC calls will go to the object after it has been
// deleted.
This looks like a great solution. The only thing I'd like to final-check is that it would be ok to make this call in-response, or during the last COM-Call ?
thanks
|
|
|
|
|
hi,
This problem is specific to a third party code which uses DIRECTX to render a 3-D image on the screen. I do not have acces to the third party software which does this job. My intention is to somehow do the same job but instead of calling the DIRECTX code written in the third party software the client needs to go thru my code for doing the same job. For this I will need to identify the interfaces(directx interfaces) that are being called by the program to render the image on the screen. Is there any way of finding out the interfaces that are being invoked.
As per my knowledge the GUID's of the interfaces are present in the registry. Can we find out the sequence of interfaces being called by the client and then replace the rspective entries in the registries with our interface GUID's so that the screen coordinates( for the image to be rendered on the screen) are available to my program and I need to store it for further processing.
1) How do i implement the concept mentioned above
2) is there any other way of doing it???
Please reply soon
Thanks
|
|
|
|
|
Have you taken a look at D3DSpy, which ships with the DirectX 9 SDK? It may provide the information you're looking for.
- Mike
|
|
|
|
|
Dear Techies,
Please give me the differences between the member functions prefixed with Afx and without Afx.
For Example, AfxMessageBox() and MessageBox();
What's the additional features and capapbilities does the AfxMessageBox() has over MessageBox().
Thanking you,
Neelesh K J Jain.
|
|
|
|
|
one is api, and the other is mfc.
one is global, and the other is local.
little suggestions.
Hello World!
|
|
|
|
|
I want a book that's as thorough as Prosise's Programming Windows with MFC, only that it's MFC centric in the latest (7.0 or 7.1) versions of MFC. Is there such an animal? A search of the internet yields nada. There is a gaping hole here that needs to be filled. What's the hold up?
Ed
|
|
|
|
|
I need to write a small program that will run in the background and trap whatever is typed at the keyboard with whatever program that's running. Then save those keystrokes to a file. Is there an easy way to do this?
Thanks,
Fred
It's all magic.
|
|
|
|
|
Yes, but it's a rude thing to do.
--
-Blake (com/bcdev/blake)
|
|
|
|
|
Hm... may I ask you why you want to do this?
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
Rickard Andersson18 wrote:
Hm... may I ask you why you want to do this?
hmm... maybe he wants to create a keylogger so that he can install it onto everyone's pc and get all their passwords?! ;)
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
|
|
|
|
|
Sure true, then I won't help.
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
The part under the (if aorh == 0) works great . The part in the else{} brackets dosn't and causes a fatal error in my program when I run it as well as a WSAEPROTONOSUPPORT error I don't understand. I must be doing something screwy.
void CSSPingDlg::Ping(LPCSTR pstrHost, int aorh)
{
SOCKET rawSocket;
LPHOSTENT lpHost;
rawSocket = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
if (rawSocket == SOCKET_ERROR)
{
AfxMessageBox("Raw socket initialization failed.",MB_OK);
return;
}
if (aorh == 0)
{
lpHost = gethostbyname(pstrHost);
saDest.sin_addr.s_addr = *((u_long FAR *) (lpHost->h_addr));
saDest.sin_family = AF_INET;
saDest.sin_port = 0;
}
else
{
lpHost = gethostbyaddr(pstrHost,4,AF_INET);
saDest.sin_addr.s_addr = *((u_long FAR *) (lpHost->h_addr));
saDest.sin_family = AF_INET;
saDest.sin_port = 0;
}
|
|
|
|
|
the 'aorh' is your flag to go with gethostbyaddr but it doesn´t work. So you should check if your are allowed to use gethostbyaddr in this context/parameters. The error is poiting that you haven´t started the WSA properly to do this.
Try this @ home. (B&B)
|
|
|
|
|
KarstenK wrote:
The error is poiting that you haven´t started the WSA properly to do this.
Which is what WSANOTINITIALISED is used for.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
It also can be that the startup wasn´t with the correct version, because on the other "if" side it worked.
Try this @ home. (B&B)
|
|
|
|
|
This should work just fine:
ULONG ulAddr = inet_addr("192.168.200.100");
if (INADDR_NONE != ulAddr)
{
LPHOSTENT hostinfo = gethostbyaddr((char *) &ulAddr, sizeof(ulAddr), AF_INET);
if (NULL != hostinfo)
{
....
}
}
I'm not sure what your code is doing after assigning values to the saDest structure, but have you ruled out that as a potential problem? In other words, do you really want port 0, or should you be using a port in the range 1024–49151? You can also use 49152–65535, but no services are registered on them, which you may not even care about.
What is lpHost->h_addr ? Shouldn't that be lpHost->h_addr_list ?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|